aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2022-05-23 14:03:19 +0200
committerGravatar GitHub <noreply@github.com> 2022-05-23 14:03:19 +0200
commitf89819bd64bb5ada706f9b85abd6f7b600a95786 (patch)
tree9bc1649eb12d54f0cf9a6e6385772e91be6481f7 /app
parent8668ca7230e9198981e33f9882a6030c1733e7f3 (diff)
Custom logo HTML (#4369)
* Custom logo HTML Add option for custom HTML logo/title in the main Web UI view. Can potentially be different per user. #fix https://github.com/FreshRSS/FreshRSS/pull/3830/files#r850472247 * logo_html in main config With new `./data/config.custom.php` to provide custom values before install * Docker documentation * whitespace * Auto relax CSP to allow images for HTML logo * Documentation
Diffstat (limited to 'app')
-rw-r--r--app/Controllers/statsController.php1
-rw-r--r--app/FreshRSS.php8
-rw-r--r--app/Models/SystemConfiguration.php1
-rw-r--r--app/install.php8
-rw-r--r--app/layout/header.phtml8
-rw-r--r--app/layout/simple.phtml8
6 files changed, 32 insertions, 2 deletions
diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php
index be29bfac4..1798ee3cf 100644
--- a/app/Controllers/statsController.php
+++ b/app/Controllers/statsController.php
@@ -17,6 +17,7 @@ class FreshRSS_stats_Controller extends FreshRSS_ActionController {
$this->_csp([
'default-src' => "'self'",
+ 'img-src' => '* data:',
'style-src' => "'self' 'unsafe-inline'",
]);
diff --git a/app/FreshRSS.php b/app/FreshRSS.php
index dc5ed0999..602c46658 100644
--- a/app/FreshRSS.php
+++ b/app/FreshRSS.php
@@ -32,6 +32,14 @@ class FreshRSS extends Minz_FrontController {
die($message);
}
+ if (FreshRSS_Context::$system_conf->logo_html != '') {
+ // Relax Content Security Policy to allow external images if a custom logo HTML is used
+ Minz_ActionController::_defaultCsp([
+ 'default-src' => "'self'",
+ 'img-src' => '* data:',
+ ]);
+ }
+
// Load list of extensions and enable the "system" ones.
Minz_ExtensionManager::init();
diff --git a/app/Models/SystemConfiguration.php b/app/Models/SystemConfiguration.php
index 3170a4180..ec5960c0e 100644
--- a/app/Models/SystemConfiguration.php
+++ b/app/Models/SystemConfiguration.php
@@ -17,6 +17,7 @@
* @property-read string $http_auth_auto_register_email_field
* @property-read string $language
* @property array<string,int> $limits
+ * @property-read string $logo_html
* @property-read string $meta_description
* @property-read bool $pubsubhubbub_enabled
* @property-read string $salt
diff --git a/app/install.php b/app/install.php
index 9186404c1..b0363efbc 100644
--- a/app/install.php
+++ b/app/install.php
@@ -145,6 +145,14 @@ function saveStep2() {
$config_array['auth_type'] = Minz_Session::param('auth_type');
}
+ $customConfigPath = DATA_PATH . '/config.custom.php';
+ if (file_exists($customConfigPath)) {
+ $customConfig = include($customConfigPath);
+ if (is_array($customConfig)) {
+ $config_array = array_merge($customConfig, $config_array);
+ }
+ }
+
@unlink(DATA_PATH . '/config.php'); //To avoid access-rights problems
file_put_contents(DATA_PATH . '/config.php', "<?php\n return " . var_export($config_array, true) . ";\n");
diff --git a/app/layout/header.phtml b/app/layout/header.phtml
index b5a9b662c..94a83894e 100644
--- a/app/layout/header.phtml
+++ b/app/layout/header.phtml
@@ -1,7 +1,13 @@
<header class="header">
<div class="item title">
<a href="<?= _url('index', 'index') ?>">
- <img class="logo" src="<?= _i('FreshRSS-logo', true) ?>" alt="" />
+ <?php if (FreshRSS_Context::$system_conf->logo_html == '') { ?>
+ <img class="logo" src="<?= _i('FreshRSS-logo', true) ?>" alt="FreshRSS" />
+ <?php
+ } else {
+ echo FreshRSS_Context::$system_conf->logo_html;
+ }
+ ?>
</a>
</div>
diff --git a/app/layout/simple.phtml b/app/layout/simple.phtml
index 1858c3fed..b4d3530bc 100644
--- a/app/layout/simple.phtml
+++ b/app/layout/simple.phtml
@@ -30,7 +30,13 @@
<div class="header">
<div class="item title">
<a href="<?= _url('index', 'index') ?>">
- <img class="logo" src="<?= _i('FreshRSS-logo', true) ?>" alt="" />
+ <?php if (FreshRSS_Context::$system_conf->logo_html == '') { ?>
+ <img class="logo" src="<?= _i('FreshRSS-logo', true) ?>" alt="FreshRSS" />
+ <?php
+ } else {
+ echo FreshRSS_Context::$system_conf->logo_html;
+ }
+ ?>
</a>
</div>