summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/Root.module.scss2
-rw-r--r--src/ducks/app.js19
2 files changed, 20 insertions, 1 deletions
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;