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:
@@ -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();
|
||||
|
Reference in New Issue
Block a user