diff options
Diffstat (limited to 'apps/accessibility/lib/Controller/AccessibilityController.php')
-rw-r--r-- | apps/accessibility/lib/Controller/AccessibilityController.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/accessibility/lib/Controller/AccessibilityController.php b/apps/accessibility/lib/Controller/AccessibilityController.php index 8f1ffa452af..cdc9e004404 100644 --- a/apps/accessibility/lib/Controller/AccessibilityController.php +++ b/apps/accessibility/lib/Controller/AccessibilityController.php @@ -28,6 +28,7 @@ use Leafo\ScssPhp\Formatter\Crunched; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataDisplayResponse; +use OCP\AppFramework\Http\DataDownloadResponse; use OCP\AppFramework\Utility\ITimeFactory; use OCP\App\IAppManager; use OCP\IConfig; @@ -185,6 +186,24 @@ class AccessibilityController extends Controller { } /** + * @NoCSRFRequired + * @PublicPage + * + * @return DataDownloadResponse + */ + public function getJavascript(): DataDownloadResponse { + $responseJS = '(function() { + OCA.Accessibility = { + theme: ' . json_encode($this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'theme', false)) . ', + + }; +})();'; + $response = new DataDownloadResponse($responseJS, 'javascript', 'text/javascript'); + $response->cacheFor(3600); + return $response; + } + + /** * Return an array with the user theme & font settings * * @return array |