fix: the error message for authkey timeout is not displayed

This commit is contained in:
mio 2023-05-03 13:26:51 +08:00
parent 677ab3750d
commit b88b57ae62
3 changed files with 23 additions and 14 deletions

@ -238,7 +238,6 @@ const tryGetUid = async (queryString) => {
try { try {
for (let [key] of defaultTypeMap) { for (let [key] of defaultTypeMap) {
const res = await request(`${url}&gacha_type=${key}&page=1&size=6`) const res = await request(`${url}&gacha_type=${key}&page=1&size=6`)
checkResStatus(res)
if (res.data.list && res.data.list.length) { if (res.data.list && res.data.list.length) {
return res.data.list[0].uid return res.data.list[0].uid
} }
@ -336,10 +335,7 @@ const tryRequest = async (url, retry = false) => {
const gachaTypeUrl = `${apiDomain}/common/gacha_record/api/getGachaLog?${queryString}&page=1&size=5&gacha_type=1&end_id=0` const gachaTypeUrl = `${apiDomain}/common/gacha_record/api/getGachaLog?${queryString}&page=1&size=5&gacha_type=1&end_id=0`
try { try {
const res = await request(gachaTypeUrl) const res = await request(gachaTypeUrl)
if (res.retcode !== 0) { checkResStatus(res)
return false
}
return true
} catch (e) { } catch (e) {
if (e.code === 'ERR_PROXY_CONNECTION_FAILED' && !retry) { if (e.code === 'ERR_PROXY_CONNECTION_FAILED' && !retry) {
await disableProxy() await disableProxy()
@ -354,11 +350,6 @@ const getUrl = async () => {
let url = await readLog() let url = await readLog()
if (!url && config.proxyMode) { if (!url && config.proxyMode) {
url = await useProxy() url = await useProxy()
} else if (url) {
const result = await tryRequest(url)
if (!result && config.proxyMode) {
url = await useProxy()
}
} }
return url return url
} }
@ -375,6 +366,9 @@ const fetchData = async (urlOverride) => {
sendMsg(message) sendMsg(message)
throw new Error(message) throw new Error(message)
} }
await tryRequest(url)
const searchParams = getQuerystring(url) const searchParams = getQuerystring(url)
if (!searchParams) { if (!searchParams) {
const message = text.url.incorrect const message = text.url.incorrect

@ -55,10 +55,12 @@
</template> </template>
</el-dialog> </el-dialog>
<el-dialog :title="ui.button.solution" v-model="state.showCacheCleanDlg" width="90%" custom-class="max-w-md"> <el-dialog :title="ui.button.solution" v-model="state.showCacheCleanDlg" width="90%" custom-class="max-w-md cache-clean-dialog">
<el-button plain icon="folder" type="primary" @click="openCacheFolder">{{ui.button.cacheFolder}}</el-button> <el-button plain icon="folder" type="success" @click="openCacheFolder">{{ui.button.cacheFolder}}</el-button>
<p class="my-4 leading-2 text-gray-600 text-sm whitespace-pre-line">{{ui.extra.cacheClean}}</p> <p class="my-2 flex flex-col text-teal-800 text-[13px]">
<p class="my-2 text-gray-400 text-xs">{{ui.extra.findCacheFolder}}</p> <span class="my-1" v-for="txt of cacheCleanTextList">{{ txt }}</span>
</p>
<p class="my-2 text-gray-500 text-xs">{{ui.extra.findCacheFolder}}</p>
<template #footer> <template #footer>
<div class="dialog-footer text-center"> <div class="dialog-footer text-center">
<el-button type="primary" @click="state.showCacheCleanDlg = false" class="focus:outline-none">{{ui.common.ok}}</el-button> <el-button type="primary" @click="state.showCacheCleanDlg = false" class="focus:outline-none">{{ui.common.ok}}</el-button>
@ -99,6 +101,13 @@ const ui = computed(() => {
} }
}) })
const cacheCleanTextList = computed(() => {
if (ui.value) {
return ui.value.extra?.cacheClean?.split('\n')
}
return []
})
const gachaData = computed(() => { const gachaData = computed(() => {
return state.dataMap.get(state.current) return state.dataMap.get(state.current)
}) })

@ -14,3 +14,9 @@
@apply rounded-full bg-gray-300; @apply rounded-full bg-gray-300;
} }
} }
@layer utilities {
.cache-clean-dialog .el-dialog__body {
padding: 0 20px;
}
}