1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-28 17:20:13 +02:00

app: add ability to override settings from query params

This commit is contained in:
Kushagra Gour
2019-06-26 13:10:35 +05:30
parent 2e29a89c27
commit dae410b1d4
3 changed files with 39 additions and 4 deletions

View File

@@ -79,6 +79,21 @@ const LocalStorageKeys = {
const UNSAVED_WARNING_COUNT = 15;
const version = '4.0.1';
// Read forced settings as query parameters
window.forcedSettings = {};
if (location.search) {
let match = location.search.replace(/^\?/, '').match(/settings=([^=]*)/);
if (match) {
match = match[1];
match.split(',').map(pair => {
pair = pair.split(':');
if (pair[1] === 'true') pair[1] = true;
else if (pair[1] === 'false') pair[1] = false;
window.forcedSettings[pair[0]] = pair[1];
});
}
}
export default class App extends Component {
constructor() {
super();