From ea051032343c7c13b549dd81e4401fbcf6e205d6 Mon Sep 17 00:00:00 2001 From: xream Date: Mon, 7 Oct 2024 18:05:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E4=BB=A3=E7=90=86/=E7=AD=96=E7=95=A5=E8=AE=BE=E7=BD=AE,=20?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=20>=202.14.386?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/assets/icons/proxy.svg | 1 + src/locales/en.ts | 2 ++ src/locales/zh.ts | 4 +++- src/store/settings.ts | 3 +++ src/types/store/settings.d.ts | 1 + src/views/My.vue | 30 +++++++++++++++++++++++++++++- src/views/SubEditor.vue | 2 +- 8 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 src/assets/icons/proxy.svg diff --git a/package.json b/package.json index 133a353c..0b7cbbfc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sub-store-front-end", - "version": "2.14.265", + "version": "2.14.266", "private": true, "scripts": { "dev": "vite --host", diff --git a/src/assets/icons/proxy.svg b/src/assets/icons/proxy.svg new file mode 100644 index 00000000..a707c398 --- /dev/null +++ b/src/assets/icons/proxy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/locales/en.ts b/src/locales/en.ts index 2762a574..2dc0d069 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -473,11 +473,13 @@ export default { githubUser: 'Please input GitHub username', gistToken: 'Please input Gist Token', defaultUserAgent: 'Please input Default User-Agent', + defaultProxy: 'Please input Default Proxy/Policy', defaultTimeout: 'Please input Default Timeout (in milliseconds)', cacheThreshold: 'Please input Cache Threshold (in KB)', noGithubUser: 'Not set GitHub username', noGistToken: 'Not set Gist Token', noDefaultUserAgent: 'Not set default user-agent', + noDefaultProxy: 'Not set default proxy/policy', noDefaultTimeout: 'Not set default timeout', noCacheThreshold: 'Not set cache threshold', }, diff --git a/src/locales/zh.ts b/src/locales/zh.ts index 34606b2b..f97ae1ab 100644 --- a/src/locales/zh.ts +++ b/src/locales/zh.ts @@ -288,7 +288,7 @@ export default { }, proxy: { label: '代理/策略', - placeholder: '通过代理/节点/策略获取订阅', + placeholder: '通过代理/节点/策略获取订阅,不填使用默认', }, }, commonOptions: { @@ -475,11 +475,13 @@ export default { githubUser: '请输入 GitHub 用户名', gistToken: '请输入 GitHub 令牌', defaultUserAgent: '请输入默认 User-Agent', + defaultProxy: '请输入默认代理/策略', defaultTimeout: '请输入默认超时(单位: 毫秒)', cacheThreshold: '请输入缓存阈值(单位: KB)', noGithubUser: '未配置 GitHub 用户名', noGistToken: '未配置 GitHub 令牌', noDefaultUserAgent: '未配置默认 User-Agent', + noDefaultProxy: '未配置默认代理/策略', noDefaultTimeout: '未配置默认超时', noCacheThreshold: '未配置缓存阈值', }, diff --git a/src/store/settings.ts b/src/store/settings.ts index 8562722b..24a1f63d 100644 --- a/src/store/settings.ts +++ b/src/store/settings.ts @@ -17,6 +17,7 @@ export const useSettingsStore = defineStore("settingsStore", { gistToken: "", githubUser: "", defaultUserAgent: "", + defaultProxy: "", defaultTimeout: "", cacheThreshold: "", syncTime: 0, @@ -53,6 +54,7 @@ export const useSettingsStore = defineStore("settingsStore", { this.syncPlatform = res.data.data.syncPlatform || ""; this.gistToken = res.data.data.gistToken || ""; this.githubUser = res.data.data.githubUser || ""; + this.defaultProxy = res.data.data.defaultProxy || ""; this.defaultUserAgent = res.data.data.defaultUserAgent || ""; this.defaultTimeout = res.data.data.defaultTimeout || ""; this.cacheThreshold = res.data.data.cacheThreshold || ""; @@ -90,6 +92,7 @@ export const useSettingsStore = defineStore("settingsStore", { this.syncPlatform = res.data.data.syncPlatform || ""; this.gistToken = res.data.data.gistToken || ""; this.githubUser = res.data.data.githubUser || ""; + this.defaultProxy = res.data.data.defaultProxy || ""; this.defaultUserAgent = res.data.data.defaultUserAgent || ""; this.defaultTimeout = res.data.data.defaultTimeout || ""; this.cacheThreshold = res.data.data.cacheThreshold || ""; diff --git a/src/types/store/settings.d.ts b/src/types/store/settings.d.ts index 9739a9ae..348a0d45 100644 --- a/src/types/store/settings.d.ts +++ b/src/types/store/settings.d.ts @@ -12,6 +12,7 @@ interface SettingsPostData { syncPlatform?: string; gistToken?: string; githubUser?: string; + defaultProxy?: string; defaultUserAgent?: string; defaultTimeout?: string; cacheThreshold?: string; diff --git a/src/views/My.vue b/src/views/My.vue index ab9c2374..81cb11d8 100644 --- a/src/views/My.vue +++ b/src/views/My.vue @@ -172,6 +172,17 @@ input-align="left" :left-icon="iconKey" /> + { @@ -306,6 +318,7 @@ const syncPlatformInput = ref(""); const userInput = ref(""); const tokenInput = ref(""); const uaInput = ref(""); +const proxyInput = ref(""); const timeoutInput = ref(""); const cacheThresholdInput = ref(""); const isEditing = ref(false); @@ -322,6 +335,7 @@ const toggleEditMode = async () => { githubUser: userInput.value, gistToken: tokenInput.value, defaultUserAgent: uaInput.value, + defaultProxy: proxyInput.value, defaultTimeout: timeoutInput.value, cacheThreshold: cacheThresholdInput.value, }); @@ -331,6 +345,7 @@ const toggleEditMode = async () => { userInput.value = githubUser.value; tokenInput.value = gistToken.value; uaInput.value = defaultUserAgent.value; + proxyInput.value = defaultProxy.value; timeoutInput.value = defaultTimeout.value; cacheThresholdInput.value = cacheThreshold.value; } @@ -376,6 +391,7 @@ const setDisplayInfo = () => { ? gistToken.value.slice(0, 6) + "************" : t(`myPage.placeholder.noGistToken`); uaInput.value = defaultUserAgent.value || t(`myPage.placeholder.noDefaultUserAgent`); + proxyInput.value = defaultProxy.value || t(`myPage.placeholder.noDefaultProxy`); timeoutInput.value = defaultTimeout.value || t(`myPage.placeholder.noDefaultTimeout`); cacheThresholdInput.value = cacheThreshold.value || t(`myPage.placeholder.noCacheThreshold`); }; @@ -478,6 +494,18 @@ const sync = async (query: "download" | "upload") => { downloadIsLoading.value = false; uploadIsLoading.value = false; }; +const proxyTips = () => { + Dialog({ + title: '通过代理/节点/策略进行下载', + content: '1. Surge(参数 policy/policy-descriptor)\n\n可设置节点代理 例: Test = snell, 1.2.3.4, 80, psk=password, version=4\n\n或设置策略/节点 例: 国外加速\n\n2. Loon(参数 node)\n\nLoon 官方文档: \n\n指定该请求使用哪一个节点或者策略组(可以使节点名称、策略组名称,也可以说是一个Loon格式的节点描述,如:shadowsocksr,example.com,1070,chacha20-ietf,"password",protocol=auth_aes128_sha1,protocol-param=test,obfs=plain,obfs-param=edge.microsoft.com)\n\n3. Stash(参数 headers["X-Surge-Policy"])/Shadowrocket(参数 headers.X-Surge-Policy)/QX(参数 opts.policy)\n\n可设置策略/节点\n\n4. Node.js 版(模块 request 的 proxy 参数):\n\n例: http://127.0.0.1:8888', + popClass: 'auto-dialog', + textAlign: 'left', + okText: 'OK', + noCancelBtn: true, + closeOnPopstate: true, + lockScroll: false, + }); +}; const uaTips = () => { Dialog({ title: '默认为 clash.meta', diff --git a/src/views/SubEditor.vue b/src/views/SubEditor.vue index f244006f..6648ac47 100644 --- a/src/views/SubEditor.vue +++ b/src/views/SubEditor.vue @@ -849,7 +849,7 @@ const urlValidator = (val: string): Promise => { const proxyTips = () => { Dialog({ title: '通过代理/节点/策略获取订阅', - content: '1. Surge(需使用 有 ability=http-client-policy 的模块, 参数 policy/policy-descriptor)\n\n可设置节点代理 例: Test = snell, 1.2.3.4, 80, psk=password, version=4\n\n或设置策略/节点 例: 国外加速\n\n2. Loon(参数 node)\n\nLoon 官方文档: \n\n指定该请求使用哪一个节点或者策略组(可以使节点名称、策略组名称,也可以说是一个Loon格式的节点描述,如:shadowsocksr,example.com,1070,chacha20-ietf,"password",protocol=auth_aes128_sha1,protocol-param=test,obfs=plain,obfs-param=edge.microsoft.com)\n\n3. Stash(参数 headers["X-Surge-Policy"])/Shadowrocket(参数 headers.X-Surge-Policy)/QX(参数 opts.policy)\n\n可设置策略/节点\n\n4. Node.js 版(模块 request 的 proxy 参数):\n\n例: http://127.0.0.1:8888', + content: '1. Surge(参数 policy/policy-descriptor)\n\n可设置节点代理 例: Test = snell, 1.2.3.4, 80, psk=password, version=4\n\n或设置策略/节点 例: 国外加速\n\n2. Loon(参数 node)\n\nLoon 官方文档: \n\n指定该请求使用哪一个节点或者策略组(可以使节点名称、策略组名称,也可以说是一个Loon格式的节点描述,如:shadowsocksr,example.com,1070,chacha20-ietf,"password",protocol=auth_aes128_sha1,protocol-param=test,obfs=plain,obfs-param=edge.microsoft.com)\n\n3. Stash(参数 headers["X-Surge-Policy"])/Shadowrocket(参数 headers.X-Surge-Policy)/QX(参数 opts.policy)\n\n可设置策略/节点\n\n4. Node.js 版(模块 request 的 proxy 参数):\n\n例: http://127.0.0.1:8888', popClass: 'auto-dialog', textAlign: 'left', okText: 'OK',