fix: Authentication is required to access the API documentation #839

This commit is contained in:
fit2cloud-chenyw
2026-02-09 16:47:40 +08:00
committed by fit2cloud-chenyw
parent 05099d4a26
commit 5208b59800
7 changed files with 3220 additions and 3063 deletions
+1 -1
View File
@@ -7,7 +7,6 @@ wlist = [
"/",
"/docs",
"/login/*",
"*.json",
"*.ico",
"*.html",
"*.js",
@@ -22,6 +21,7 @@ wlist = [
"*.ttf",
"*.eot",
"*.otf",
"*.css.map"
"/mcp*",
"/system/license",
"/system/config/key",
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -888,7 +888,8 @@
"redirect_2_auth": "Redirecting to {0} authentication, {1} seconds...",
"redirect_immediately": "Redirecting immediately",
"permission_invalid": "Authentication invalid [Current account has insufficient permissions]",
"scan_qr_login": " Scan QR Code"
"scan_qr_login": " Scan QR Code",
"no_auth_error": "Not authenticated. Redirecting to login page in {0} seconds..."
},
"supplier": {
"alibaba_cloud_bailian": "Alibaba Cloud Bailian",
+2 -1
View File
@@ -888,7 +888,8 @@
"redirect_2_auth": "{0} 인증으로 리디렉션 중입니다, {1}초...",
"redirect_immediately": "지금 이동",
"permission_invalid": "인증 무효 [현재 계정의 권한이 부족합니다]",
"scan_qr_login": " QR 코드 스캔"
"scan_qr_login": " QR 코드 스캔",
"no_auth_error": "인증되지 않았습니다. {0}초 후 로그인 페이지로 이동합니다..."
},
"supplier": {
"alibaba_cloud_bailian": "알리바바 클라우드 바이리엔",
+2 -1
View File
@@ -888,7 +888,8 @@
"redirect_2_auth": "正在跳转至 {0} 认证,{1} 秒...",
"redirect_immediately": "立即跳转",
"permission_invalid": "认证无效【当前账号权限不够】",
"scan_qr_login": "扫码登录"
"scan_qr_login": "扫码登录",
"no_auth_error": "未认证,即将跳转登录页面,{0} 秒..."
},
"supplier": {
"alibaba_cloud_bailian": "阿里云百炼",
+4
View File
@@ -48,6 +48,10 @@ export const watchRouter = (router: Router) => {
}
}
}
if (to.path === '/docs') {
location.href = to.fullPath
return
}
if (to.path === '/' || accessCrossPermission(to)) {
next('/chat')
return
+39 -3
View File
@@ -1,7 +1,9 @@
<template>
<div class="page-not-found">
<Icon name="401"><Four class="svg-icon login-logo-icon" /></Icon>
<span class="span-403">{{ title || routerTitle || '' }}</span>
<span v-if="showTimer" class="span-403">{{ unauthorizedTitle }}</span>
<span v-else class="span-403">{{ title || routerTitle || '' }}</span>
</div>
</template>
@@ -9,13 +11,47 @@
import Four from '@/assets/svg/401.svg'
import { Icon } from '@/components/icon-custom'
import { propTypes } from '@/utils/propTypes'
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import { computed, onMounted, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { toLoginPage } from '@/utils/utils'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const route = useRoute()
const router = useRouter()
defineProps({
title: propTypes.string,
})
const routerTitle = computed(() => route.query?.title || '')
const target = computed(() => route.query?.target || '')
const showTimer = computed(() => routerTitle.value && routerTitle.value === 'unauthorized')
const target_full_path = ref('')
const unauthorizedTitle = ref(t('login.no_auth_error', [3]))
onMounted(() => {
if (target.value) {
target_full_path.value = target.value as string
if (!target_full_path.value.startsWith('/')) {
target_full_path.value = '/' + target_full_path.value
}
/* setTimeout(() => {
router.push(toLoginPage(target_full_path))
}, 2000) */
}
if (showTimer.value) {
let timer = 3
const timerHander = setInterval(() => {
if (timer-- <= 0) {
clearInterval(timerHander)
router.push(toLoginPage(target_full_path.value))
return
}
unauthorizedTitle.value = t('login.no_auth_error', [timer])
}, 1000)
}
})
</script>
<style lang="less">
.page-not-found {