diff options
author | Alexey Pyltsyn <lex61rus@gmail.com> | 2018-10-16 21:42:06 +0300 |
---|---|---|
committer | Alexey Pyltsyn <lex61rus@gmail.com> | 2018-10-18 20:49:46 +0300 |
commit | 30cbd137e8c32c32920292e285c06466392e89f9 (patch) | |
tree | 3edfac53b3bee3089012b2286a6e892bfda745fa /apps/accessibility/lib | |
parent | 5911367a18f362836e43222a4a3ba61f08b7a123 (diff) | |
download | nextcloud-server-30cbd137e8c32c32920292e285c06466392e89f9.tar.gz nextcloud-server-30cbd137e8c32c32920292e285c06466392e89f9.zip |
Fix illegible text color in columns Size and Modified on dark theme: rework after review
Signed-off-by: Alexey Pyltsyn <lex61rus@gmail.com>
Diffstat (limited to 'apps/accessibility/lib')
-rw-r--r-- | apps/accessibility/lib/AppInfo/Application.php | 18 | ||||
-rw-r--r-- | apps/accessibility/lib/Controller/AccessibilityController.php | 19 |
2 files changed, 37 insertions, 0 deletions
diff --git a/apps/accessibility/lib/AppInfo/Application.php b/apps/accessibility/lib/AppInfo/Application.php index 068fcc27b7a..6e3dc789d97 100644 --- a/apps/accessibility/lib/AppInfo/Application.php +++ b/apps/accessibility/lib/AppInfo/Application.php @@ -60,4 +60,22 @@ class Application extends App { } } } + + public function injectJavascript() { + $linkToJs = $this->urlGenerator->linkToRoute( + $this->appName . '.accessibility.getJavascript', + [ + 'v' => \OC::$server->getConfig()->getAppValue('accessibility', 'cachebuster', '0'), + ] + ); + + \OCP\Util::addHeader( + 'script', + [ + 'src' => $linkToJs, + 'nonce' => \OC::$server->getContentSecurityPolicyNonceManager()->getNonce() + ], + '' + ); + } } 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 |