summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaishan <[email protected]>2020-03-14 15:57:16 +0800
committerHaishan <[email protected]>2020-03-14 15:57:16 +0800
commit0b20e145caa224a61a5955a2c8bc4fe6975ab000 (patch)
treeeab0e72e35437eac0acb7fb182cb789d79a5c8dc /src
parent3444f61688524644285de0d69a568e86a110d44e (diff)
feat: support set theme with querystring
Diffstat (limited to 'src')
-rw-r--r--src/store/app.js19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/store/app.js b/src/store/app.js
index da0d775..465a564 100644
--- a/src/store/app.js
+++ b/src/store/app.js
@@ -105,15 +105,20 @@ export function initialState() {
s = { ...defaultState, ...s };
// TODO flat clashAPIConfig?
- const configQuery = parseConfigQueryString();
- if (configQuery.hostname) {
- s.clashAPIConfig.hostname = configQuery.hostname;
+ const query = parseConfigQueryString();
+ if (query.hostname) {
+ s.clashAPIConfig.hostname = query.hostname;
}
- if (configQuery.port) {
- s.clashAPIConfig.port = configQuery.port;
+ if (query.port) {
+ s.clashAPIConfig.port = query.port;
}
- if (configQuery.secret) {
- s.clashAPIConfig.secret = configQuery.secret;
+ if (query.secret) {
+ s.clashAPIConfig.secret = query.secret;
+ }
+ if (query.theme) {
+ if (query.theme === 'dark' || query.theme === 'light') {
+ s.theme = query.theme;
+ }
}
// set initial theme
setTheme(s.theme);