From 65a43811d4c952ec274c109d8a0408309bd3e523 Mon Sep 17 00:00:00 2001 From: xream Date: Mon, 8 Jan 2024 07:14:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E8=AF=B7=E6=B1=82=E8=B6=85=E6=97=B6(?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=20>=202.14.140)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/assets/icons/timeout.svg | 1 + src/locales/en.ts | 4 +++- src/locales/zh.ts | 4 +++- src/store/settings.ts | 3 +++ src/types/store/settings.d.ts | 1 + src/views/My.vue | 16 +++++++++++++++- 7 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 src/assets/icons/timeout.svg diff --git a/package.json b/package.json index 2af560eca..dff649d8e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sub-store-front-end", - "version": "2.14.29", + "version": "2.14.30", "private": true, "scripts": { "dev": "vite --host", diff --git a/src/assets/icons/timeout.svg b/src/assets/icons/timeout.svg new file mode 100644 index 000000000..9ff991467 --- /dev/null +++ b/src/assets/icons/timeout.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/locales/en.ts b/src/locales/en.ts index 20b5a5a9a..97c47586c 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -367,9 +367,11 @@ export default { githubUser: 'Please input GitHub username', gistToken: 'Please input Gist Token', defaultUserAgent: 'Please input Default User-Agent', + defaultTimeout: 'Please input Default Timeout (in milliseconds)', noGithubUser: 'Not set GitHub username', noGistToken: 'Not set Gist Token', - noDefaultUserAgent: 'Not set default user-agent' + noDefaultUserAgent: 'Not set default user-agent', + noDefaultTimeout: 'Not set default timeout' }, btn: { download: 'Download', diff --git a/src/locales/zh.ts b/src/locales/zh.ts index f9eb99097..c3f373a07 100644 --- a/src/locales/zh.ts +++ b/src/locales/zh.ts @@ -369,9 +369,11 @@ export default { githubUser: '请输入 GitHub 用户名', gistToken: '请输入 GitHub 令牌', defaultUserAgent: '请输入默认 User-Agent', + defaultTimeout: '请输入默认超时(单位: 毫秒)', noGithubUser: '未配置 GitHub 用户名', noGistToken: '未配置 GitHub 令牌', - noDefaultUserAgent: '未配置默认 User-Agent' + noDefaultUserAgent: '未配置默认 User-Agent', + noDefaultTimeout: '未配置默认超时' }, notify: { save: { diff --git a/src/store/settings.ts b/src/store/settings.ts index a48a6db6c..c763ba752 100644 --- a/src/store/settings.ts +++ b/src/store/settings.ts @@ -15,6 +15,7 @@ export const useSettingsStore = defineStore('settingsStore', { gistToken: '', githubUser: '', defaultUserAgent: '', + defaultTimeout: '', syncTime: 0, theme: { auto: true, @@ -36,6 +37,7 @@ export const useSettingsStore = defineStore('settingsStore', { this.gistToken = res.data.gistToken || ''; this.githubUser = res.data.githubUser || ''; this.defaultUserAgent = res.data.defaultUserAgent || ''; + this.defaultTimeout = res.data.defaultTimeout || ''; this.syncTime = res.data.syncTime || 0; this.avatarUrl = res.data.avatarUrl || ''; this.artifactStore = res.data.artifactStore || ''; @@ -64,6 +66,7 @@ export const useSettingsStore = defineStore('settingsStore', { this.gistToken = res.data.gistToken || ''; this.githubUser = res.data.githubUser || ''; this.defaultUserAgent = res.data.defaultUserAgent || ''; + this.defaultTimeout = res.data.defaultTimeout || ''; this.avatarUrl = res.data.avatarUrl || ''; this.artifactStore = res.data.artifactStore || ''; showNotify({ type: 'success', title: t(`myPage.notify.save.succeed`) }); diff --git a/src/types/store/settings.d.ts b/src/types/store/settings.d.ts index 7e484daf1..840a14502 100644 --- a/src/types/store/settings.d.ts +++ b/src/types/store/settings.d.ts @@ -11,6 +11,7 @@ interface SettingsPostData { gistToken?: string; githubUser?: string; defaultUserAgent?: string; + defaultTimeout?: string; theme?: { auto: boolean; name?: CustomTheme; diff --git a/src/views/My.vue b/src/views/My.vue index 14ee82b9b..f29ffe80e 100644 --- a/src/views/My.vue +++ b/src/views/My.vue @@ -173,6 +173,15 @@ input-align="left" :left-icon="iconUA" /> + @@ -226,6 +235,7 @@ import avatar from "@/assets/icons/avatar.svg?url"; import iconKey from "@/assets/icons/key-solid.png"; import iconUser from "@/assets/icons/user-solid.png"; import iconUA from "@/assets/icons/user-agent.svg"; +import iconTimeout from "@/assets/icons/timeout.svg"; import { useAppNotifyStore } from "@/store/appNotify"; import { useGlobalStore } from "@/store/global"; import { useSettingsStore } from "@/store/settings"; @@ -245,7 +255,7 @@ const router = useRouter(); const { showNotify } = useAppNotifyStore(); const { currentUrl: host } = useHostAPI(); const settingsStore = useSettingsStore(); -const { githubUser, gistToken, syncTime, avatarUrl, defaultUserAgent } = +const { githubUser, gistToken, syncTime, avatarUrl, defaultUserAgent, defaultTimeout } = storeToRefs(settingsStore); const displayAvatar = computed(() => { @@ -269,6 +279,7 @@ const onClickAbout = () => { const userInput = ref(""); const tokenInput = ref(""); const uaInput = ref(""); +const timeoutInput = ref(""); const isEditing = ref(false); const isEditLoading = ref(false); const isInit = ref(false); @@ -282,12 +293,14 @@ const toggleEditMode = async () => { githubUser: userInput.value, gistToken: tokenInput.value, defaultUserAgent: uaInput.value, + defaultTimeout: timeoutInput.value, }); setDisplayInfo(); } else { userInput.value = githubUser.value; tokenInput.value = gistToken.value; uaInput.value = defaultUserAgent.value; + timeoutInput.value = defaultTimeout.value; } isEditLoading.value = false; isEditing.value = !isEditing.value; @@ -305,6 +318,7 @@ const setDisplayInfo = () => { ? gistToken.value.slice(0, 6) + "************" : t(`myPage.placeholder.noGistToken`); uaInput.value = defaultUserAgent.value || t(`myPage.placeholder.noDefaultUserAgent`); + timeoutInput.value = defaultTimeout.value || t(`myPage.placeholder.noDefaultTimeout`); }; // 同步 上传