Controllers

VerseController

Location: lib/Controller/VerseController.php

Responsibilities:

  • Provide an endpoint for retrieving the daily Bible verse

  • Accept language and version parameters

  • Return JSON containing verse text, reference, and source URL

  • Handle API errors gracefully

Request flow:

  1. JavaScript fetches the verse from the controller.

  2. The controller delegates to VerseService.

  3. The service calls the external API.

  4. The controller returns normalised JSON.

SettingsController

Location: lib/Controller/SettingsController.php

Responsibilities:

  • Read and write admin and personal settings

  • Use Nextcloud’s IConfig API

  • Enforce admin/user separation

  • Provide JSON responses for the settings UI

Security considerations:

  • Admin settings are restricted to administrators.

  • Personal settings are restricted to the authenticated user.

  • CSRF protection is handled by Nextcloud.