mirror of
https://github.com/Lissy93/dashy.git
synced 2024-12-24 09:22:53 +03:00
🔒 Prevent modification of users locally
This commit is contained in:
parent
a8cf946f76
commit
46c1ea87e8
@ -24,21 +24,25 @@ export default class ConfigAccumulator {
|
|||||||
/* App Config */
|
/* App Config */
|
||||||
appConfig() {
|
appConfig() {
|
||||||
let appConfigFile = {};
|
let appConfigFile = {};
|
||||||
if (this.conf) {
|
// Set app config from file
|
||||||
appConfigFile = this.conf.appConfig || {};
|
if (this.conf) appConfigFile = this.conf.appConfig || {};
|
||||||
}
|
// Fill in defaults if anything missing
|
||||||
let usersAppConfig = defaultAppConfig;
|
let usersAppConfig = defaultAppConfig;
|
||||||
if (localStorage[localStorageKeys.APP_CONFIG]) {
|
if (localStorage[localStorageKeys.APP_CONFIG]) {
|
||||||
usersAppConfig = JSON.parse(localStorage[localStorageKeys.APP_CONFIG]);
|
usersAppConfig = JSON.parse(localStorage[localStorageKeys.APP_CONFIG]);
|
||||||
} else if (appConfigFile !== {}) {
|
} else if (appConfigFile !== {}) {
|
||||||
usersAppConfig = appConfigFile;
|
usersAppConfig = appConfigFile;
|
||||||
}
|
}
|
||||||
|
// Some settings have their own local storage keys, apply them here
|
||||||
usersAppConfig.layout = localStorage[localStorageKeys.LAYOUT_ORIENTATION]
|
usersAppConfig.layout = localStorage[localStorageKeys.LAYOUT_ORIENTATION]
|
||||||
|| appConfigFile.layout || defaultLayout;
|
|| appConfigFile.layout || defaultLayout;
|
||||||
usersAppConfig.iconSize = localStorage[localStorageKeys.ICON_SIZE]
|
usersAppConfig.iconSize = localStorage[localStorageKeys.ICON_SIZE]
|
||||||
|| appConfigFile.iconSize || defaultIconSize;
|
|| appConfigFile.iconSize || defaultIconSize;
|
||||||
usersAppConfig.language = localStorage[localStorageKeys.LANGUAGE]
|
usersAppConfig.language = localStorage[localStorageKeys.LANGUAGE]
|
||||||
|| appConfigFile.language || defaultLanguage;
|
|| appConfigFile.language || defaultLanguage;
|
||||||
|
// Don't let users modify users locally
|
||||||
|
if (this.conf.auth) usersAppConfig.auth = appConfigFile.auth;
|
||||||
|
// All done, return final appConfig object
|
||||||
return usersAppConfig;
|
return usersAppConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user