diff --git a/package.json b/package.json index 6297cad..af4baa0 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "keywords": [ "react" ], - "author": "Han Haishan (htttp://haishan.me)", + "author": "Haishan (https://haishan.me)", "private": true, "license": "UNLICENSED", "dependencies": { diff --git a/src/components/Root.module.scss b/src/components/Root.module.scss index 2ca2546..4c3653b 100644 --- a/src/components/Root.module.scss +++ b/src/components/Root.module.scss @@ -13,7 +13,7 @@ .content { flex-grow: 1; - overflow: scroll; + overflow: auto; // background: #202020; // $w: 7px; diff --git a/src/ducks/app.js b/src/ducks/app.js index 36bdd29..db32e17 100644 --- a/src/ducks/app.js +++ b/src/ducks/app.js @@ -60,11 +60,30 @@ const defaultState = { theme: 'dark' }; +function parseConfigQueryString() { + const { search } = location; + const collector = {}; + if (typeof search !== 'string' || search === '') return collector; + const qs = search.replace(/^\?/, '').split('&'); + for (let i = 0; i < qs.length; i++) { + const [k, v] = qs[i].split('='); + collector[k] = encodeURIComponent(v); + } + return collector; +} + function getInitialState() { let s = loadState(StorageKey); if (!s) s = defaultState; // TODO flat clashAPIConfig? + const configQuery = parseConfigQueryString(); + if (configQuery.port) { + s.clashAPIConfig.port = configQuery.port; + } + if (configQuery.secret) { + s.clashAPIConfig.secret = configQuery.secret; + } // set initial theme setTheme(s.theme); return s;