fix theme switch to default bug and include google fonts in csp #6665
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Jan 6, 2025 at 16:02 UTC
def62075c742f80c5c96db6ddf5e1300998fd6ea
25 files changed
+5
-6
public/scripts/themes/theme-switcher.js
+2
-2
@@ -4,8 +4,8 @@ document.addEventListener("DOMContentLoaded", function () {
4
// Load saved theme from local storage
5
const savedTheme = localStorage.getItem("theme");
6
if (savedTheme) {
7
- const safeTheme = encodeURIComponent(savedTheme);
8
- themeStylesheet.href = `styles/themes/${safeTheme}/bootstrap.min.css`;
7
+ const safeTheme = ((savedTheme != 'default') ? encodeURIComponent(savedTheme) : encodeURIComponent('..'));
8
+ themeStylesheet.href = `styles/themes/${safeTheme}/bootstrap-min.css`;
9
}
10
11
// Initialize Select2 on all select elements with the 'select2' class
public/styles/themes/cerulean/bootstrap-min.css
renamed
public/styles/themes/cosmo/bootstrap-min.css
renamed
public/styles/themes/cyborg/bootstrap-min.css
renamed
public/styles/themes/darkly/bootstrap-min.css
renamed
public/styles/themes/flatly/bootstrap-min.css
renamed
public/styles/themes/journal/bootstrap-min.css
renamed
public/styles/themes/litera/bootstrap-min.css
renamed
public/styles/themes/lumen/bootstrap-min.css
renamed
public/styles/themes/lux/bootstrap-min.css
renamed
public/styles/themes/materia/bootstrap-min.css
renamed
public/styles/themes/minty/bootstrap-min.css
renamed
public/styles/themes/morph/bootstrap-min.css
renamed
public/styles/themes/pulse/bootstrap-min.css
renamed
public/styles/themes/sandstone/bootstrap-min.css
renamed
public/styles/themes/simplex/bootstrap-min.css
renamed
public/styles/themes/sketchy/bootstrap-min.css
renamed
public/styles/themes/solar/bootstrap-min.css
renamed
public/styles/themes/spacelab/bootstrap-min.css
renamed
public/styles/themes/united/bootstrap-min.css
renamed
public/styles/themes/vapor/bootstrap-min.css
renamed
public/styles/themes/yeti/bootstrap-min.css
renamed
public/styles/themes/zephyr/bootstrap-min.css
renamed
views/default3.handlebars
+2
-3
@@ -14138,10 +14138,9 @@
14138
function account_switchThemeEx() {
14139
var themeSwitcher = document.getElementById('theme-switcher');
14140
const selectedTheme = themeSwitcher.value;
14141
- const safeTheme = encodeURIComponent(selectedTheme);
14141
+ const safeTheme = ((selectedTheme != 'default') ? encodeURIComponent(selectedTheme) : encodeURIComponent('..'));
14142
var themeStylesheet = document.getElementById('theme-stylesheet');
14143
- var newThemeStylesheet = `styles/themes/${safeTheme}/bootstrap.min.css`;
14144
- themeStylesheet.href = newThemeStylesheet;
14143
+ themeStylesheet.href = `styles/themes/${safeTheme}/bootstrap-min.css`;
14144
// Save selected theme
14145
putstore('theme', selectedTheme);
14146
// Update last 4 themes selected
webserver.js
+1
-1
@@ -6502,7 +6502,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6502
'Referrer-Policy': 'no-referrer',
6503
'X-XSS-Protection': '1; mode=block',
6504
'X-Content-Type-Options': 'nosniff',
6505
- 'Content-Security-Policy': "default-src 'none'; font-src 'self'; script-src 'self' 'unsafe-inline'" + extraScriptSrc + "; connect-src 'self'" + geourl + selfurl + "; img-src 'self' blob: data:" + geourl + " data:; style-src 'self' 'unsafe-inline'; frame-src 'self' blob: mcrouter:" + extraFrameSrc + "; media-src 'self'; form-action 'self'; manifest-src 'self'"
6505
+ 'Content-Security-Policy': "default-src 'none'; font-src 'self' fonts.gstatic.com data:; script-src 'self' 'unsafe-inline' " + extraScriptSrc + "; connect-src 'self'" + geourl + selfurl + "; img-src 'self' blob: data:" + geourl + " data:; style-src 'self' 'unsafe-inline' fonts.googleapis.com; frame-src 'self' blob: mcrouter:" + extraFrameSrc + "; media-src 'self'; form-action 'self'; manifest-src 'self'"
6506
};
6507
if (req.headers['user-agent'] && (req.headers['user-agent'].indexOf('Chrome') >= 0)) { headers['Permissions-Policy'] = 'interest-cohort=()'; } // Remove Google's FLoC Network, only send this if Chrome browser
6508
if ((parent.config.settings.allowframing !== true) && (typeof parent.config.settings.allowframing !== 'string')) { headers['X-Frame-Options'] = 'sameorigin'; }