diff --git a/package.json b/package.json index 2903576f7..8b81b5e6c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sub-store-front-end", - "version": "2.15.56", + "version": "2.15.60", "private": true, "scripts": { "dev": "vite --host", diff --git a/src/assets/icons/githubProxy.svg b/src/assets/icons/githubProxy.svg new file mode 100644 index 000000000..3490965f2 --- /dev/null +++ b/src/assets/icons/githubProxy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/locales/en.ts b/src/locales/en.ts index 2cc0415bc..939f593ee 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -591,12 +591,14 @@ export default { haveNotDownload: "Not download yet", githubUser: "Please input GitHub username", gistToken: "Please input Gist Token", + githubProxy: "Please input GitHub Proxy", defaultUserAgent: "Please input Default User-Agent", defaultProxy: "Please input Default Proxy/Policy", defaultTimeout: "Default Timeout (in milliseconds, default: 8000)", cacheThreshold: "Cache Threshold (in KB, default: 1024)", noGithubUser: "Not set GitHub username", noGistToken: "Not set Gist Token", + noGithubProxy: "Not set GitHub Proxy", noDefaultUserAgent: "Not set default user-agent", noDefaultProxy: "Not set default proxy/policy", noDefaultTimeout: "Not set default timeout", diff --git a/src/locales/zh.ts b/src/locales/zh.ts index f3097fff1..df8b775c3 100644 --- a/src/locales/zh.ts +++ b/src/locales/zh.ts @@ -586,12 +586,14 @@ export default { haveNotDownload: '暂无下载记录', githubUser: '请输入 GitHub 用户名', gistToken: '请输入 GitHub 令牌', + githubProxy: '请输入 GitHub 加速代理', defaultUserAgent: '请输入默认 User-Agent', defaultProxy: '请输入默认代理/策略', defaultTimeout: '默认超时(单位: 毫秒, 默认: 8000)', cacheThreshold: '缓存阈值(单位: KB, 默认: 1024)', noGithubUser: '未配置 GitHub 用户名', noGistToken: '未配置 GitHub 令牌', + noGithubProxy: '未配置 GitHub 加速代理', noDefaultUserAgent: '未配置默认 User-Agent', noDefaultProxy: '未配置默认代理/策略', noDefaultTimeout: '未配置默认超时', diff --git a/src/router/index.ts b/src/router/index.ts index 1547ded93..81622828e 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -118,7 +118,7 @@ const router = createRouter({ }, }, { - path: '/share/manage', + path: '/shares', component: ShareManage, meta: { title: 'shareManage', diff --git a/src/store/settings.ts b/src/store/settings.ts index c12b51a5c..64fc2fb55 100644 --- a/src/store/settings.ts +++ b/src/store/settings.ts @@ -15,6 +15,7 @@ export const useSettingsStore = defineStore("settingsStore", { return { syncPlatform: "", gistToken: "", + githubProxy: "", githubUser: "", defaultUserAgent: "", defaultProxy: "", @@ -58,6 +59,7 @@ export const useSettingsStore = defineStore("settingsStore", { if (res?.data?.status === "success" && res?.data?.data) { this.syncPlatform = res.data.data.syncPlatform || ""; this.gistToken = res.data.data.gistToken || ""; + this.githubProxy = res.data.data.githubProxy || ""; this.githubUser = res.data.data.githubUser || ""; this.defaultProxy = res.data.data.defaultProxy || ""; this.defaultUserAgent = res.data.data.defaultUserAgent || ""; @@ -100,6 +102,7 @@ export const useSettingsStore = defineStore("settingsStore", { if (res?.data?.status === "success" && res?.data?.data) { this.syncPlatform = res.data.data.syncPlatform || ""; this.gistToken = res.data.data.gistToken || ""; + this.githubProxy = res.data.data.githubProxy || ""; this.githubUser = res.data.data.githubUser || ""; this.defaultProxy = res.data.data.defaultProxy || ""; this.defaultUserAgent = res.data.data.defaultUserAgent || ""; diff --git a/src/types/store/settings.d.ts b/src/types/store/settings.d.ts index 8b47eae95..1a8cdbf4f 100644 --- a/src/types/store/settings.d.ts +++ b/src/types/store/settings.d.ts @@ -11,6 +11,7 @@ interface SettingsBase { interface SettingsPostData { syncPlatform?: string; gistToken?: string; + githubProxy?: string; githubUser?: string; defaultProxy?: string; defaultUserAgent?: string; diff --git a/src/views/CompareTable.vue b/src/views/CompareTable.vue index b22ffa1ee..4f98b82d4 100644 --- a/src/views/CompareTable.vue +++ b/src/views/CompareTable.vue @@ -562,7 +562,7 @@ } .compare-page-wrapper { - width: 100vw; + width: 100%; height: 100vh; z-index: 1000; overflow-x: hidden; diff --git a/src/views/FilePreview.vue b/src/views/FilePreview.vue index 8c2040117..65ce0893f 100644 --- a/src/views/FilePreview.vue +++ b/src/views/FilePreview.vue @@ -348,7 +348,8 @@ const copyUrl = async () => { // top: 0; // left: 0; // position: absolute; - width: 100vw; + width: 100%; + height: 100vh; z-index: 1000; overflow-x: hidden; diff --git a/src/views/My.vue b/src/views/My.vue index 6017f8b8c..79115dd0e 100644 --- a/src/views/My.vue +++ b/src/views/My.vue @@ -173,6 +173,18 @@ input-align="left" :left-icon="iconKey" /> + { @@ -316,7 +329,7 @@ const onClickAPISetting = () => { }; const onClickShareManage = () => { - router.push(`/share/manage`); + router.push(`/shares`); }; const onClickMore = () => { router.push(`/settings/more`); @@ -330,6 +343,7 @@ const onClickAbout = () => { const syncPlatformInput = ref(""); const userInput = ref(""); const tokenInput = ref(""); +const githubProxyInput = ref(""); const uaInput = ref(""); const proxyInput = ref(""); const timeoutInput = ref(""); @@ -347,6 +361,7 @@ const toggleEditMode = async () => { syncPlatform: syncPlatformInput.value, githubUser: userInput.value, gistToken: tokenInput.value, + githubProxy: githubProxyInput.value, defaultUserAgent: uaInput.value, defaultProxy: proxyInput.value, defaultTimeout: timeoutInput.value, @@ -357,6 +372,7 @@ const toggleEditMode = async () => { syncPlatformInput.value = syncPlatform.value; userInput.value = githubUser.value; tokenInput.value = gistToken.value; + githubProxyInput.value = githubProxy.value; uaInput.value = defaultUserAgent.value; proxyInput.value = defaultProxy.value; timeoutInput.value = defaultTimeout.value; @@ -400,6 +416,7 @@ const toggleSyncPlatform = () => { const setDisplayInfo = () => { syncPlatformInput.value = syncPlatform.value || ""; userInput.value = githubUser.value || ""; + githubProxyInput.value = githubProxy.value || ""; tokenInput.value = gistToken.value ? `${gistToken.value.slice(0, 6)}************` : ""; @@ -550,6 +567,18 @@ const downloadBtn = () => { lockScroll: false, }); } +const githubProxyTips = () => { + Dialog({ + title: '请填写完整 GitHub 加速代理地址', + content: '后端需 >= 2.19.97\n\n1. 仅用于上传/下载 Gist 和获取 GitHub 头像\n\n2. 请填写完整 如 https://a.com\n\n3. 需支持代理 https://api.github.com\n\n测试方式:\n浏览器打开\nhttps://a.com/https://api.github.com/users/xream\n有正常的响应\n\n4. 使用此方式时, 自行注意安全隐私问题', + popClass: 'auto-dialog', + textAlign: 'left', + okText: 'OK', + noCancelBtn: true, + closeOnPopstate: true, + lockScroll: false, + }); +}; const proxyTips = () => { Dialog({ title: '通过代理/节点/策略进行下载', diff --git a/src/views/SubEditor.vue b/src/views/SubEditor.vue index 5d965cf1d..819a3b09b 100644 --- a/src/views/SubEditor.vue +++ b/src/views/SubEditor.vue @@ -613,8 +613,9 @@ const padding = bottomSafeArea.value + "px"; } }; const selectedSubs = computed(() => { - if(!Array.isArray(form.subscriptions) || form.subscriptions.length === 0) return `: ${t(`editorPage.subConfig.basic.subscriptions.empty`)}` - return `: ${form.subscriptions.map((name) => { + const subscriptions = form.subscriptions || []; + if(!Array.isArray(subscriptions) || subscriptions.length === 0) return `: ${t(`editorPage.subConfig.basic.subscriptions.empty`)}` + return `: ${subscriptions.map((name) => { const sub = subsStore.getOneSub(name); return sub?.displayName || sub?.["display-name"] || sub.name; }).join(', ')}` @@ -640,7 +641,6 @@ const form = reactive({ passThroughUA: false, icon: "", isIconColor: true, - subscriptions: [], process: [ { type: "Quick Setting Operator", @@ -1147,6 +1147,10 @@ const urlValidator = (val: string): Promise => { // console.log(`${!v} -> ${v}`) // }; const subCheckboxClick = () => { + // 确保 form.subscriptions 存在 + if (!form.subscriptions) { + form.subscriptions = []; + } // const selected = toRaw(form.subscriptions) || [] const group = subsSelectList.value.filter(item => shouldShowElement(item[3])).map(item => item[0]) || [] if (subCheckboxIndeterminate.value) { @@ -1189,6 +1193,11 @@ const urlValidator = (val: string): Promise => { const selectedItems = []; const unselectedItems = []; + // 确保 form.subscriptions 存在 + if (!form.subscriptions) { + form.subscriptions = []; + } + // 优先添加已勾选的订阅 form.subscriptions.forEach(selectedName => { const item = filtered.find(item => item[0] === selectedName); @@ -1228,6 +1237,11 @@ const urlValidator = (val: string): Promise => { const newSubscriptions = []; + // 确保 form.subscriptions 存在 + if (!form.subscriptions) { + form.subscriptions = []; + } + // 先按新顺序添加当前过滤列表中已选中的订阅 newFilteredOrder.forEach(name => { if (form.subscriptions.includes(name)) { @@ -1245,7 +1259,7 @@ const urlValidator = (val: string): Promise => { console.log("更新后的 form.subscriptions:", form.subscriptions); }; watch([tag, form.subscriptions, subsSelectList], () => { - const selected = toRaw(form.subscriptions) || [] + const selected = toRaw(form.subscriptions || []) || [] const group = subsSelectList.value.filter(item => shouldShowElement(item[3])).map(item => item[0]) || [] // 1. group 中不包含 selected 中的任何元素, subCheckbox 为 false, subCheckboxIndeterminate 为 false // 2. group 中包含 selected 中的任意元素, subCheckbox 为 true, subCheckboxIndeterminate 为 true