Skip to content

Commit

Permalink
fix(config): remote rules on Chromium disabled (#690)
Browse files Browse the repository at this point in the history
* fix(config): remote rules on Chromium disabled

* fix(views/Setting): update button

whether remote rules are enabled is up to UA, not synced config
  • Loading branch information
Rongronggg9 committed May 15, 2022
1 parent e015163 commit 71351fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/js/common/config.js
Expand Up @@ -26,7 +26,13 @@ export const defaultConfig = {
local: false,
},
refreshTimeout: 5 * 60 * 60,
enableRemoteRules: !navigator.userAgent.match(/firefox|safari/i),
// typical UA:
// Firefox: Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0
// Chromium/Chrome: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36
// Some Chromium: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/80.0.3987.87 Chrome/80.0.3987.87 Safari/537.36
// Safari: Mozilla/5.0 (Macintosh; Intel Mac OS X 12_3_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Safari/605.1.15
// Edge: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/99.0.1150.36
enableRemoteRules: !(navigator.userAgent.match(/firefox/i) || (navigator.userAgent.match(/safari/i) && !navigator.userAgent.match(/chrome/i))),
};

export function getConfig(success) {
Expand Down
6 changes: 3 additions & 3 deletions src/js/options/views/Setting.vue
Expand Up @@ -24,11 +24,11 @@
</div>
<div class="subtitle">规则更新</div>
<div class="setting-item">
<div class="setting-name" v-if="config.enableRemoteRules">我会自动更新,你也可以</div>
<div class="setting-input" v-if="config.enableRemoteRules">
<div class="setting-name" v-if="defaultConfig.enableRemoteRules">我会自动更新,你也可以</div>
<div class="setting-input" v-if="defaultConfig.enableRemoteRules">
<el-button style="width: 98px" size="medium" @click="refreshRu" :disabled="refreshDisabled">{{ refreshDisabled ? '更新中' : '立即更新' }}</el-button><el-progress :text-inside="true" :stroke-width="20" :percentage="percentage"></el-progress><span class="time">{{ time }}前更新,{{ leftTime }}后自动更新</span>
</div>
<div class="setting-name" v-if="!config.enableRemoteRules">远程更新被禁用</div>
<div class="setting-name" v-if="!defaultConfig.enableRemoteRules">远程更新被禁用</div>
</div>
<div class="subtitle">一键订阅</div>
<div class="setting-item">
Expand Down

0 comments on commit 71351fd

Please sign in to comment.