mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-12 11:01:52 +00:00
fix theme switch to default bug and include google fonts in csp #6665
Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
parent
998769a888
commit
def62075c7
25 changed files with 5 additions and 6 deletions
|
@ -4,8 +4,8 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||||
// Load saved theme from local storage
|
// Load saved theme from local storage
|
||||||
const savedTheme = localStorage.getItem("theme");
|
const savedTheme = localStorage.getItem("theme");
|
||||||
if (savedTheme) {
|
if (savedTheme) {
|
||||||
const safeTheme = encodeURIComponent(savedTheme);
|
const safeTheme = ((savedTheme != 'default') ? encodeURIComponent(savedTheme) : encodeURIComponent('..'));
|
||||||
themeStylesheet.href = `styles/themes/${safeTheme}/bootstrap.min.css`;
|
themeStylesheet.href = `styles/themes/${safeTheme}/bootstrap-min.css`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize Select2 on all select elements with the 'select2' class
|
// Initialize Select2 on all select elements with the 'select2' class
|
||||||
|
|
|
@ -14138,10 +14138,9 @@
|
||||||
function account_switchThemeEx() {
|
function account_switchThemeEx() {
|
||||||
var themeSwitcher = document.getElementById('theme-switcher');
|
var themeSwitcher = document.getElementById('theme-switcher');
|
||||||
const selectedTheme = themeSwitcher.value;
|
const selectedTheme = themeSwitcher.value;
|
||||||
const safeTheme = encodeURIComponent(selectedTheme);
|
const safeTheme = ((selectedTheme != 'default') ? encodeURIComponent(selectedTheme) : encodeURIComponent('..'));
|
||||||
var themeStylesheet = document.getElementById('theme-stylesheet');
|
var themeStylesheet = document.getElementById('theme-stylesheet');
|
||||||
var newThemeStylesheet = `styles/themes/${safeTheme}/bootstrap.min.css`;
|
themeStylesheet.href = `styles/themes/${safeTheme}/bootstrap-min.css`;
|
||||||
themeStylesheet.href = newThemeStylesheet;
|
|
||||||
// Save selected theme
|
// Save selected theme
|
||||||
putstore('theme', selectedTheme);
|
putstore('theme', selectedTheme);
|
||||||
// Update last 4 themes selected
|
// Update last 4 themes selected
|
||||||
|
|
|
@ -6502,7 +6502,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
|
||||||
'Referrer-Policy': 'no-referrer',
|
'Referrer-Policy': 'no-referrer',
|
||||||
'X-XSS-Protection': '1; mode=block',
|
'X-XSS-Protection': '1; mode=block',
|
||||||
'X-Content-Type-Options': 'nosniff',
|
'X-Content-Type-Options': 'nosniff',
|
||||||
'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'"
|
'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'"
|
||||||
};
|
};
|
||||||
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
|
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
|
||||||
if ((parent.config.settings.allowframing !== true) && (typeof parent.config.settings.allowframing !== 'string')) { headers['X-Frame-Options'] = 'sameorigin'; }
|
if ((parent.config.settings.allowframing !== true) && (typeof parent.config.settings.allowframing !== 'string')) { headers['X-Frame-Options'] = 'sameorigin'; }
|
||||||
|
|
Loading…
Reference in a new issue