mirror of
https://github.com/jackhh66/ChatGPT_Web_accessToken.git
synced 2026-12-03 21:09:32 +00:00
chore: version 2.10.0
* feat: 权限验证功能 * chore: v2.10.0 * feat: 500 服务异常页面 * feat: 只有结束才会滚动到底部 * chore: 修改 CHANGELOG * chore: 不存在时输出默认报错
This commit is contained in:
1 parent
a2ffa3cb3a
commit
ffd4da91cf
30 files changed
+376
-60
No files matched your search
@@ -33,3 +33,16 @@ export function fetchChatAPIProcess<T = any>(
|
||||
onDownloadProgress: params.onDownloadProgress,
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchSession<T>() {
|
||||
return post<T>({
|
||||
url: '/session',
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchVerify<T>(token: string) {
|
||||
return post<T>({
|
||||
url: '/verify',
|
||||
data: { token },
|
||||
})
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
<svg viewBox="0 0 400 300" fill="none" xmlns="http://www.w3.org/2000/svg"><mask id="a" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="31" y="31" width="338" height="238"><path d="M368.9 31H31v238h337.9V31Z" fill="#fff" /></mask><g mask="url(#a)" fill-rule="evenodd" clip-rule="evenodd"><path d="m357.4 219.2 3.4-39.3-58.7-5.1-3.4 39.3 58.7 5.1Z" fill="#fff" /><path d="M299.4 213.9h-.4v-.4l-.5-.1v.9l.8.1.1-.5ZM355.5 218.8l-1.3-.1v.5l1.3.1v-.5ZM353 218.5l-1.3-.1v.5l1.3.1v-.5ZM350.4 218.3l-1.3-.1v.5l1.3.1v-.5ZM347.9 218.1l-1.3-.1v.5l1.3.1v-.5ZM345.4 217.9l-1.3-.1v.5l1.3.1v-.5ZM342.8 217.6l-1.3-.1v.5l1.3.1v-.5ZM340.3 217.4l-1.3-.1v.5l1.3.1v-.5ZM337.7 217.2l-1.3-.1v.5l1.3.1v-.5ZM335.2 217l-1.3-.1v.5l1.3.1v-.5ZM332.7 216.8l-1.3-.1v.5l1.3.1v-.5ZM330.1 216.5l-1.3-.1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ZM302.1 176.7h-.5l-.1 1.2h.5l.1-1.2Z" fill="#DBDBDB" /><path d="m355.2 216.5 2.9-34.4-53.8-4.6-2.9 34.4 53.8 4.6Z" fill="#EBEBEB" /><path d="M333.895 197.096c.2-2.5-1.7-4.7-4.2-4.9-2.5-.2-4.7 1.7-4.9 4.2-.2 2.5 1.7 4.7 4.2 4.9 2.5.2 4.7-1.7 4.9-4.2Zm-7.79-.491c-.1 1.8 1.3 3.4 3.1 3.5 1.8.1 3.4-1.2 3.5-3 .1-1.9-1.3-3.5-3.1-3.6-1.8-.1-3.4 1.3-3.5 3.1Z" fill="#DBDBDB" /><path d="m316.8 195.802.4.5c3.6 4.2 7.5 6.5 11.7 6.8l.7.1c6.8.1 11.6-4.9 11.8-5.1l.4-.4-.3-.4c-.2-.2-4.2-5.9-10.9-6.8-4.4-.6-8.9 1.1-13.3 4.9l-.5.4Zm12.8 5.999c5.2.1 9.2-3.1 10.4-4.3-1.1-1.3-4.6-5.2-9.7-5.8-3.7-.5-7.7.9-11.7 4.2 3.4 3.8 7.1 5.8 11 5.9Z" fill="#DBDBDB" /><path d="m320.004 205.586 19.368-16.587-.846-.988-19.367 16.588.845.987Z" fill="#DBDBDB" /><path d="m368.8 128.1-7.5-15.8-34-13.2-22.9 58.9 45.9 17.7 18.5-47.6Z" fill="#fff" /><path d="m350.4 175.6-1.2-.5-.2.4 1.2.5.2-.4ZM351.3 174l-.4-.2-.5 1.2.4.2.5-1.2ZM348.1 174.6l-1.2-.5-.2.4 1.2.5.2-.4ZM345.7 173.8l-1.2-.5-.2.4 1.2.5.2-.4ZM343.4 172.8l-1.2-.5-.2.4 1.2.5.2-.4ZM352.2 171.7l-.4-.2-.5 1.2.4.2.5-1.2ZM341 171.9l-1.2-.5-.2.4 1.2.5.2-.4ZM338.6 171l-1.2-.5-.2.4 1.2.5.2-.4ZM353.1 169.3l-.4-.2-.5 1.2.4.2.5-1.2ZM336.2 170.1l-1.2-.5-.2.4 1.2.5.2-.4ZM333.9 169.1l-1.2-.5-.2.4 1.2.5.2-.4ZM331.5 168.2l-1.2-.5-.2.4 1.2.5.2-.4ZM354 167l-.4-.2-.5 1.2.4.2.5-1.2ZM329.1 167.3l-1.2-.5-.2.4 1.2.5.2-.4ZM326.8 166.4l-1.2-.5-.2.4 1.2.5.2-.4ZM324.4 165.5l-1.2-.5-.2.4 1.2.5.2-.4ZM354.9 164.6l-.4-.2-.5 1.2.4.2.5-1.2ZM322.1 164.6l-1.2-.5-.2.4 1.2.5.2-.4ZM319.7 163.6l-1.2-.5-.2.4 1.2.5.2-.4ZM355.8 162.2l-.4-.2-.5 1.2.4.2.5-1.2ZM317.3 162.7l-1.2-.5-.2.4 1.2.5.2-.4ZM315 161.8l-1.2-.5-.2.4 1.2.5.2-.4ZM312.6 160.9l-1.2-.5-.2.4 1.2.5.2-.4ZM356.8 159.8l-.4-.2-.5 1.2.4.2.5-1.2ZM310.2 160l-1.2-.5-.2.4 1.2.5.2-.4ZM307.9 159.1l-1.2-.5-.2.4 1.2.5.2-.4ZM357.7 157.5l-.4-.2-.5 1.2.4.2.5-1.2ZM305.4 158l-.7-.3-.4-.2-.2.5 1.2.5.1-.5ZM305.7 155.4l-.4-.2-.5 1.2.4.2.5-1.2ZM358.6 155.1l-.4-.2-.5 1.2.4.2.5-1.2ZM306.6 153.1l-.4-.2-.5 1.2.4.2.5-1.2ZM359.5 152.8l-.4-.2-.5Line truncated
|
||||
|
Before Width: | Height: | Size: 19 KiB |
@@ -0,0 +1,5 @@
|
||||
<template>
|
||||
<div class="text-[#142D6E] dark:text-[#3a71ff]">
|
||||
<svg viewBox="0 0 400 300" fill="none" xmlns="http://www.w3.org/2000/svg"><mask id="a" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="31" y="31" width="338" height="238"><path d="M368.9 31H31v238h337.9V31Z" fill="#fff" /></mask><g mask="url(#a)" fill-rule="evenodd" clip-rule="evenodd"><path d="m357.4 219.2 3.4-39.3-58.7-5.1-3.4 39.3 58.7 5.1Z" fill="#fff" /><path d="M299.4 213.9h-.4v-.4l-.5-.1v.9l.8.1.1-.5ZM355.5 218.8l-1.3-.1v.5l1.3.1v-.5ZM353 218.5l-1.3-.1v.5l1.3.1v-.5ZM350.4 218.3l-1.3-.1v.5l1.3.1v-.5ZM347.9 218.1l-1.3-.1v.5l1.3.1v-.5ZM345.4 217.9l-1.3-.1v.5l1.3.1v-.5ZM342.8 217.6l-1.3-.1v.5l1.3.1v-.5ZM340.3 217.4l-1.3-.1v.5l1.3.1v-.5ZM337.7 217.2l-1.3-.1v.5l1.3.1v-.5ZM335.2 217l-1.3-.1v.5l1.3.1v-.5ZM332.7 216.8l-1.3-.1v.5l1.3.1v-.5ZM330.1 216.5l-1.3-.1v.5l1.3.1v-.5ZM327.6 216.3l-1.3-.1v.5l1.3.1v-.5ZM325.1 216.1l-1.3-.1v.5l1.3.1v-.5ZM322.5 215.9l-1.3-.1v.5l1.3.1v-.5ZM320 215.7l-1.3-.1v.5l1.3.1v-.5ZM317.5 215.4l-1.3-.1v.5l1.3.1v-.5ZM314.9 215.2l-1.3-.1v.5l1.3.1v-.5ZM312.4 215l-1.3-.1v.5l1.3.1v-.5ZM309.8 214.8l-1.3-.1v.5l1.3.1v-.5ZM307.3 214.6l-1.3-.1v.5l1.3.1v-.5ZM304.8 214.3l-1.3-.1v.5l1.3.1v-.5ZM302.2 214.1l-1.3-.1v.5l1.3.1v-.5ZM357.7 218.6l-.4-.1-.1.4h-.4v.5h.9v-.8ZM357.9 216h-.5l-.1 1.2.5.1.1-1.3ZM358.1 213.7h-.5l-.1 1.2h.5l.1-1.2ZM358.3 211.2h-.5l-.1 1.2h.5l.1-1.2ZM358.6 208.8h-.5l-.1 1.2h.5l.1-1.2ZM358.8 206.3h-.5l-.1 1.2h.5l.1-1.2ZM359 203.9h-.5l-.1 1.2h.5l.1-1.2ZM359.2 201.4h-.5l-.1 1.2h.5l.1-1.2ZM359.4 199h-.5l-.1 1.2h.5l.1-1.2ZM359.6 196.5h-.5l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206.2h-.5l-.1 1.2h.5l.1-1.2ZM299.8 203.7h-.5l-.1 1.2h.5l.1-1.2ZM300 201.3h-.5l-.1 1.2h.5l.1-1.2ZM300.3 198.8h-.5l-.1 1.2h.5l.1-1.2ZM300.5 196.3h-.5l-.1 1.2h.5l.1-1.2ZM300.7 193.9h-.5l-.1 1.2h.5l.1-1.2ZM300.9 191.4h-.5l-.1 1.2h.5l.1-1.2ZM301.1 189h-.5l-.1 1.2h.5l.1-1.2ZM301.3 186.5h-.5l-.1 1.2h.5l.1-1.2ZM301.5 184.1h-.5l-.1 1.2h.5l.1-1.2ZM301.7 181.6h-.5l-.1 1.2h.5l.1-1.2ZM301.9 179.2h-.5l-.1 1.2h.5l.1-1.2ZM302.1 176.7h-.5l-.1 1.2h.5l.1-1.2Z" fill="#DBDBDB" /><path d="m355.2 216.5 2.9-34.4-53.8-4.6-2.9 34.4 53.8 4.6Z" fill="#EBEBEB" /><path d="M333.895 197.096c.2-2.5-1.7-4.7-4.2-4.9-2.5-.2-4.7 1.7-4.9 4.2-.2 2.5 1.7 4.7 4.2 4.9 2.5.2 4.7-1.7 4.9-4.2Zm-7.79-.491c-.1 1.8 1.3 3.4 3.1 3.5 1.8.1 3.4-1.2 3.5-3 .1-1.9-1.3-3.5-3.1-3.6-1.8-.1-3.4 1.3-3.5 3.1Z" fill="#DBDBDB" /><path d="m316.8 195.802.4.5c3.6 4.2 7.5 6.5 11.7 6.8l.7.1c6.8.1 11.6-4.9 11.8-5.1l.4-.4-.3-.4c-.2-.2-4.2-5.9-10.9-6.8-4.4-.6-8.9 1.1-13.3 4.9l-.5.4Zm12.8 5.999c5.2.1 9.2-3.1 10.4-4.3-1.1-1.3-4.6-5.2-9.7-5.8-3.7-.5-7.7.9-11.7 4.2 3.4 3.8 7.1 5.8 11 5.9Z" fill="#DBDBDB" /><path d="m320.004 205.586 19.368-16.587-.846-.988-19.367 16.588.845.987Z" fill="#DBDBDB" /><path d="m368.8 128.1-7.5-15.8-34-13.2-22.9 58.9 45.9 17.7 18.5-47.6Z" fill="#fff" /><path d="m350.4 175.6-1.2-.5-.2.4 1.2.5.2-.4ZM351.3 174l-.4-.2-.5 1.2.4.2.5-1.2ZM348.1 174.6l-1.2-.5-.2.4 1.2.5.2-.4ZM345.7 173.8l-1.2-.5-.2.4 1.2.5.2-.4ZM343.4 172.8l-1.2-.5-.2.4 1.2.5.2-.4ZM352.2 171.7l-.4-.2-.5 1.2.4.2.5-1.2ZM341 171.9l-1.2-.5-.2.4 1.2.5.2-.4ZM338.6 171l-1.2-.5-.2.4 1.2.5.2-.4ZM353.1 169.3l-.4-.2-.5 1.2.4.2.5-1.2ZM336.2 170.1l-1.2-.5-.2.4 1.2.5.2-.4ZM333.9 169.1l-1.2-.5-.2.4 1.2.5.2-.4ZM331.5 168.2l-1.2-.5-.2.4 1.2.5.2-.4ZM354 167l-.4-.2-.5 1.2.4.2.5-1.2ZM329.1 167.3l-1.2-.5-.2.4 1.2.5.2-.4ZM326.8 166.4l-1.2-.5-.2.4 1.2.5.2-.4ZM324.4 165.5l-1.2-.5-.2.4 1.2.5.2-.4ZM354.9 164.6l-.4-.2-.5 1.2.4.2.5-1.2ZM322.1 164.6l-1.2-.5-.2.4 1.2.5.2-.4ZM319.7 163.6l-1.2-.5-.2.4 1.2.5.2-.4ZM355.8 162.2l-.4-.2-.5 1.2.4.2.5-1.2ZM317.3 162.7l-1.2-.5-.2.4 1.2.5.2-.4ZM315 161.8l-1.2-.5-.2.4 1.2.5.2-.4ZM312.6 160.9l-1.2-.5-.2.4 1.2.5.2-.4ZM356.8 159.8l-.4-.2-.5 1.2.4.2.5-1.2ZM310.2 160l-1.2-.5-.2.4 1.2.5.2-.4ZM307.9 159.1l-1.2-.5-.2.4 1.2.5.2-.4ZM357.7 157.5l-.4-.2-.5 1.2.4.2.5-1.2ZM305.4 158l-.7-.3-.4-.2-.2.5 1.2.5.1-.5ZM305.7 155.4l-.4-.2-.5 1.2.4.2.5-1.2ZM358.6 155.1l-.4-.2-.5 1.2.4.2.5-1.2ZM306.6 153.1l-.4-.2-.5 1.2.4.2.5-1.2ZM359.5 152.8l-.4-.Line truncated
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,5 @@
|
||||
<template>
|
||||
<div class="text-[currentColor] dark:text-[#3a71ff]">
|
||||
<svg viewBox="0 0 400 300" fill="none" xmlns="http://www.w3.org/2000/svg"><mask id="a" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="31" y="32" width="338" height="237"><path d="M368.4 32H31v236.9h337.4V32Z" fill="#fff" /></mask><g mask="url(#a)" fill-rule="evenodd" clip-rule="evenodd"><path d="M79.498 122.599c-3.3-7.4-5.2-17.8-7.9-29.5-2.4-12.9-20.8-28.3-34.1-17.6-6.2 5.1-8 17.7-5.4 28.5 2.3 11 9 20.1 14 23.2 10.5 6.3 26.2.8 29.9 4.4 7.6 6.9 11.2 12.8 11.2 13 .2-.2-2.4-10.3-7.7-22Z" fill="#EBEBEB" /><path d="M64.9 112.503c.8-.1 1.1-1.4.6-2.9-.5-1.5-1.5-2.6-2.4-2.5-.9.1-1.2 1.5-.7 3s1.6 2.6 2.5 2.4ZM56.103 110.604c.8-.2 1.2-1.5.7-3.1s-1.6-2.8-2.5-2.7c-.9.1-1.1 1.6-.7 3.2.5 1.6 1.7 2.8 2.5 2.6ZM47.202 108.504c.9-.2 1.2-1.6.7-3.2s-1.6-2.9-2.6-2.8c-1 .1-1.3 1.7-.8 3.3.5 1.7 1.7 2.9 2.7 2.7Z" fill="#fff" /><path d="M76.002 69.395c1.3-7.3 11.4-9.2 14.7-15.1 3.2-5.9 4.5-20.4-.5-22.1-5.1-1.7-17 7-18.3 14.9-1.3 6.9-1.1 16.4-.3 21.8 1.3 8.7 5.1 14.1 5.1 14.1s-1.9-7.1-.7-13.6Z" fill="#EBEBEB" /><path d="M88.099 47.302c.7-.9 1-2 .9-3.2-.1-1.1-.8-1.5-1.4-.8-.7 1-1.1 2.1-.9 3.2.1 1.1.8 1.5 1.4.8ZM82.399 50.702c.7-.9 1-2.1.8-3.2-.1-1.1-.8-1.5-1.4-.8-.7 1-1 2.1-.8 3.2.2 1.1.8 1.5 1.4.8ZM76.796 54.202c.7-.9.9-2.1.8-3.2-.2-1.1-.8-1.5-1.4-.8-.7.9-.9 2.1-.8 3.2.2 1.1.8 1.5 1.4.8Z" fill="#fff" /><path d="M159.502 190.201c69.4-1.4 71.8-64.6 71.6-77.3-.2-12.8-8-39.3-27.7-56.5-15.6-13.6-35.6-18.9-59.5-16-35.4 4.4-50.8 26.1-57.5 43.6-4.4 11.9-6.5 24.5-6.1 37.1.1 4.9 3.2 22.4 14.9 38.8 9.9 13.9 28.6 30.3 62.1 30.3h2.2Zm-.002-.901c68.601-1.4 71.001-64 70.801-76.5-.2-12.5-7.9-38.8-27.4-55.8-12.7-11-28.301-16.5-46.601-16.5-4.1 0-8.2.3-12.2.8-35 4.3-50.2 25.8-56.8 43-4.4 11.8-6.4 24.3-6.1 36.8.2 6 4.1 23.2 14.8 38.3 9.8 13.8 28.3 29.9 61.4 29.9h2.1Z" fill="#EBEBEB" /><path d="M101.804 66.303c-44.2 46-9.1 89 3.9 101.6 12.7 12.2 67.9 42.4 108.8-10.1 40.9-52.5-11.7-98.5-11.7-98.5-7-6.6-56.8-39-101 7Z" fill="#EBEBEB" /><path d="M159.499 191.898c22.1-.1 39.7-7 52.2-20.6 22.3-24.2 20.9-60.8 20.9-61.1-.1-1.7-3.2-42-30.7-62.5-15.2-11.2-34.8-14.2-58.3-8.9-24.6 5.6-42.3 17.2-52.5 34.4-17 28.8-7.2 63.9-7 64.5 3.3 9.9 8.4 19.1 15.1 27.1 10.3 12.4 29.1 27 60.1 27l.2.1ZM165.098 37.1c-7.1.1-14.3.9-21.2 2.6-24.4 5.5-41.9 17-52 34.1-16.9 28.6-7 63.4-6.9 63.8 3.2 9.8 8.3 18.9 15 26.8 10 12.1 28.6 26.6 59.3 26.6h.3c21.4-.1 38.5-6.6 50.8-19.5 22.7-23.7 21.4-60.9 21.4-61.2-.1-1.7-3.2-41.6-30.4-61.9-10.1-7.6-22.3-11.3-36.3-11.3Z" fill="#EBEBEB" /><path d="M232.696 107.798c.7-24.8-8.4-43.4-27.1-55.3-25.9-16.5-60-13.8-60.1-13.7l-.5.1c-9.3 1.5-41 8.2-57.2 33.5-11 17.1-12.8 39.2-5.4 65.7 6.5 23.4 18.7 39.3 36.2 47.2 9.3 4.3 19.4 5.8 29.1 5.8 25.6 0 48.5-10.8 49.1-11 .4-.2 8.9-4 17.4-14.5 8-9.9 17.6-27.9 18.5-57.8Zm-19.094 57.101c7.9-9.8 17.5-27.6 18.3-57.2.6-21.2-6.1-37.9-19.9-49.6-25.5-21.4-65.301-18.6-66.201-18.5-.2.1-.4.1-.6.1-9.2 1.5-40.6 8.2-56.7 33.1-10.8 16.9-12.6 38.8-5.3 65.1 6.4 23.1 18.5 38.8 35.7 46.6 9.3 4.2 19.2 5.7 28.8 5.7 25.5 0 48.501-10.8 48.801-11 .1 0 8.6-3.7 17.1-14.3Z" fill="#EBEBEB" /><path d="M157.198 192.605c3.4 0 6.8-.2 10.2-.6 53.4-6.6 60.1-50.4 65.1-82.3l.3-1.8c2.5-16.3-8.2-38.1-26.2-52.9-13-10.7-40.6-26.6-79-12.7-33 11.9-43.2 36.7-46 55.4-1.8 12.7-1.1 25.6 1.9 38l.9-.2c-3-12.3-3.7-25.1-1.9-37.7 2.7-18.5 12.8-42.9 45.4-54.7 38-13.8 65.3 1.9 78.1 12.5 17.8 14.7 28.4 36.1 25.9 52.2l-.3 1.8c-4.9 31.7-11.7 75.1-64.4 81.6-27.4 3.4-47-7.6-58.6-17.4-15-12.8-23.4-29.2-23.7-36.1h-.9c.4 7.1 8.9 23.8 24.1 36.7 13.7 11.7 31.1 18.2 49.1 18.2Z" fill="#EBEBEB" /><path d="M203.097 123.1c.6-.3.4-1-.1-.8-5.9 2.1-13.2 2.4-18.4-1.6-4.3-3.3-5.9-9.1-5.1-14.3.4-2.7 1.4-5.4 2.9-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.2 0 .4-.7 0-.9-6.7-2.1-12.9 2.7-17.4 7-4.5 4.3-9.4 9.4-16.1 9.1-3.1-.1-5.9-1.5-7.7-4-1.7-2.5-2-5.7-1.8-8.7.4-6.5 3.7-13.4 1.1-19.8-1.3-2.8-3.5-5.1-6.3-6.4ZM91.7 156c.2-.5.4-1 .5-1.5.4-1.3.4-2.7 0-4-.2-.7-.6-1.2-1.1-1.6-.6-.4-1.3-.3-1.7.3-.8 1.2-.1 3.1.5 4.3.5.9 1.1 1.7 1.8 2.5Zm1.004.804c-.2-.1-.3-.3-.5-.4.3-.6.5-1.2.7-1.9.4-1.4.4-2.9 0-Line truncated
|
||||
</div>
|
||||
</template>
|
||||
@@ -12,6 +12,8 @@ export default {
|
||||
wrong: 'Something went wrong, please try again later.',
|
||||
success: 'Success',
|
||||
failed: 'Failed',
|
||||
verify: 'Verify',
|
||||
unauthorizedTips: 'Unauthorized, please verify first.',
|
||||
},
|
||||
chat: {
|
||||
placeholder: 'Ask me anything...(Shift + Enter = line break)',
|
||||
|
||||
@@ -12,6 +12,8 @@ export default {
|
||||
wrong: '好像出错了,请稍后再试。',
|
||||
success: '操作成功',
|
||||
failed: '操作失败',
|
||||
verify: '验证',
|
||||
unauthorizedTips: '未经授权,请先进行验证。',
|
||||
},
|
||||
chat: {
|
||||
placeholder: '来说点什么...(Shift + Enter = 换行)',
|
||||
|
||||
@@ -12,6 +12,8 @@ export default {
|
||||
wrong: '好像出錯了,請稍後再試。',
|
||||
success: '操作成功',
|
||||
failed: '操作失敗',
|
||||
verify: '驗證',
|
||||
unauthorizedTips: '未經授權,請先進行驗證。',
|
||||
},
|
||||
chat: {
|
||||
placeholder: '來講點什麼...(Shift + Enter = 換行)',
|
||||
|
||||
+9
-6
@@ -1,6 +1,7 @@
|
||||
import type { App } from 'vue'
|
||||
import type { RouteRecordRaw } from 'vue-router'
|
||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
import { setupPageGuard } from './permission'
|
||||
import { ChatLayout } from '@/views/chat/layout'
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
@@ -18,18 +19,18 @@ const routes: RouteRecordRaw[] = [
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
path: '/403',
|
||||
name: '403',
|
||||
component: () => import('@/views/exception/403/index.vue'),
|
||||
},
|
||||
|
||||
{
|
||||
path: '/404',
|
||||
name: '404',
|
||||
component: () => import('@/views/exception/404/index.vue'),
|
||||
},
|
||||
|
||||
{
|
||||
path: '/500',
|
||||
name: '500',
|
||||
component: () => import('@/views/exception/500/index.vue'),
|
||||
},
|
||||
|
||||
{
|
||||
path: '/:pathMatch(.*)*',
|
||||
name: 'notFound',
|
||||
@@ -43,6 +44,8 @@ export const router = createRouter({
|
||||
scrollBehavior: () => ({ left: 0, top: 0 }),
|
||||
})
|
||||
|
||||
setupPageGuard(router)
|
||||
|
||||
export async function setupRouter(app: App) {
|
||||
app.use(router)
|
||||
await router.isReady()
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import type { Router } from 'vue-router'
|
||||
import { useAuthStoreWithout } from '@/store/modules/auth'
|
||||
|
||||
export function setupPageGuard(router: Router) {
|
||||
router.beforeEach(async (from, to, next) => {
|
||||
const authStore = useAuthStoreWithout()
|
||||
if (!authStore.session) {
|
||||
try {
|
||||
const data = await authStore.getSession()
|
||||
if (String(data.auth) === 'false' && authStore.token)
|
||||
authStore.removeToken()
|
||||
next()
|
||||
}
|
||||
catch (error) {
|
||||
if (from.path !== '/500')
|
||||
next({ name: '500' })
|
||||
else
|
||||
next()
|
||||
}
|
||||
}
|
||||
else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { ss } from '@/utils/storage'
|
||||
|
||||
const LOCAL_NAME = 'SECRET_TOKEN'
|
||||
|
||||
export function getToken() {
|
||||
return ss.get(LOCAL_NAME)
|
||||
}
|
||||
|
||||
export function setToken(token: string) {
|
||||
return ss.set(LOCAL_NAME, token)
|
||||
}
|
||||
|
||||
export function removeToken() {
|
||||
return ss.remove(LOCAL_NAME)
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { getToken, removeToken, setToken } from './helper'
|
||||
import { store } from '@/store'
|
||||
import { fetchSession } from '@/api'
|
||||
|
||||
export interface AuthState {
|
||||
token: string | undefined
|
||||
session: { auth: boolean } | null
|
||||
}
|
||||
|
||||
export const useAuthStore = defineStore('auth-store', {
|
||||
state: (): AuthState => ({
|
||||
token: getToken(),
|
||||
session: null,
|
||||
}),
|
||||
|
||||
actions: {
|
||||
async getSession() {
|
||||
try {
|
||||
const { data } = await fetchSession<{ auth: boolean }>()
|
||||
this.session = { ...data }
|
||||
return Promise.resolve(data)
|
||||
}
|
||||
catch (error) {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
},
|
||||
|
||||
setToken(token: string) {
|
||||
this.token = token
|
||||
setToken(token)
|
||||
},
|
||||
|
||||
removeToken() {
|
||||
this.token = undefined
|
||||
removeToken()
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
export function useAuthStoreWithout() {
|
||||
return useAuthStore(store)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './app'
|
||||
export * from './chat'
|
||||
export * from './user'
|
||||
export * from './auth'
|
||||
@@ -1,4 +1,5 @@
|
||||
import axios, { type AxiosResponse } from 'axios'
|
||||
import { useAuthStore } from '@/store'
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: import.meta.env.VITE_GLOB_API_URL,
|
||||
@@ -6,6 +7,9 @@ const service = axios.create({
|
||||
|
||||
service.interceptors.request.use(
|
||||
(config) => {
|
||||
const token = useAuthStore().token
|
||||
if (token)
|
||||
config.headers.Authorization = `Bearer ${token}`
|
||||
return config
|
||||
},
|
||||
(error) => {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { AxiosProgressEvent, AxiosResponse, GenericAbortSignal } from 'axios'
|
||||
import request from './axios'
|
||||
import { useAuthStore } from '@/store'
|
||||
|
||||
export interface HttpOption {
|
||||
url: string
|
||||
@@ -22,9 +23,16 @@ function http<T = any>(
|
||||
{ url, data, method, headers, onDownloadProgress, signal, beforeRequest, afterRequest }: HttpOption,
|
||||
) {
|
||||
const successHandler = (res: AxiosResponse<Response<T>>) => {
|
||||
const authStore = useAuthStore()
|
||||
|
||||
if (res.data.status === 'Success' || typeof res.data === 'string')
|
||||
return res.data
|
||||
|
||||
if (res.data.status === 'Unauthorized') {
|
||||
authStore.removeToken()
|
||||
window.location.reload()
|
||||
}
|
||||
|
||||
return Promise.reject(res.data)
|
||||
}
|
||||
|
||||
|
||||
@@ -113,13 +113,13 @@ async function onConversation() {
|
||||
requestOptions: { prompt: message, options: { ...options } },
|
||||
},
|
||||
)
|
||||
scrollToBottom()
|
||||
}
|
||||
catch (error) {
|
||||
//
|
||||
}
|
||||
},
|
||||
})
|
||||
scrollToBottom()
|
||||
}
|
||||
catch (error: any) {
|
||||
const errorMessage = error?.message ?? t('common.wrong')
|
||||
|
||||
@@ -4,12 +4,14 @@ import { NLayout, NLayoutContent } from 'naive-ui'
|
||||
import { useRouter } from 'vue-router'
|
||||
import Sider from './sider/index.vue'
|
||||
import Header from './header/index.vue'
|
||||
import Permission from './Permission.vue'
|
||||
import { useBasicLayout } from '@/hooks/useBasicLayout'
|
||||
import { useAppStore, useChatStore } from '@/store'
|
||||
import { useAppStore, useAuthStore, useChatStore } from '@/store'
|
||||
|
||||
const router = useRouter()
|
||||
const appStore = useAppStore()
|
||||
const chatStore = useChatStore()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
router.replace({ name: 'Chat', params: { uuid: chatStore.active } })
|
||||
|
||||
@@ -17,6 +19,8 @@ const { isMobile } = useBasicLayout()
|
||||
|
||||
const collapsed = computed(() => appStore.siderCollapsed)
|
||||
|
||||
const needPermission = computed(() => !!authStore.session?.auth && !authStore.token)
|
||||
|
||||
const getMobileClass = computed(() => {
|
||||
if (isMobile.value)
|
||||
return ['rounded-none', 'shadow-none']
|
||||
@@ -44,5 +48,6 @@ const getContainerClass = computed(() => {
|
||||
</NLayoutContent>
|
||||
</NLayout>
|
||||
</div>
|
||||
<Permission :visible="needPermission" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,81 @@
|
||||
<script setup lang='ts'>
|
||||
import { computed, ref } from 'vue'
|
||||
import { NButton, NInput, NModal, useMessage } from 'naive-ui'
|
||||
import { fetchVerify } from '@/api'
|
||||
import { useAuthStore } from '@/store'
|
||||
import Icon403 from '@/icons/403.vue'
|
||||
|
||||
interface Props {
|
||||
visible: boolean
|
||||
}
|
||||
|
||||
defineProps<Props>()
|
||||
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const ms = useMessage()
|
||||
|
||||
const loading = ref(false)
|
||||
const token = ref('')
|
||||
|
||||
const disabled = computed(() => !token.value.trim() || loading.value)
|
||||
|
||||
async function handleVerify() {
|
||||
const secretKey = token.value.trim()
|
||||
|
||||
if (!secretKey)
|
||||
return
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
await fetchVerify(secretKey)
|
||||
authStore.setToken(secretKey)
|
||||
ms.success('success')
|
||||
window.location.reload()
|
||||
}
|
||||
catch (error: any) {
|
||||
ms.error(error.message ?? 'error')
|
||||
authStore.removeToken()
|
||||
token.value = ''
|
||||
}
|
||||
finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handlePress(event: KeyboardEvent) {
|
||||
if (event.key === 'Enter' && !event.shiftKey) {
|
||||
event.preventDefault()
|
||||
handleVerify()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NModal :show="visible" style="width: 90%; max-width: 640px">
|
||||
<div class="p-10 bg-white rounded dark:bg-slate-800">
|
||||
<div class="space-y-4">
|
||||
<header class="space-y-2">
|
||||
<h2 class="text-2xl font-bold text-center text-slate-800 dark:text-neutral-200">
|
||||
403
|
||||
</h2>
|
||||
<p class="text-base text-center text-slate-500 dark:text-slate-500">
|
||||
{{ $t('common.unauthorizedTips') }}
|
||||
</p>
|
||||
<Icon403 class="w-[200px] m-auto" />
|
||||
</header>
|
||||
<NInput v-model:value="token" type="text" placeholder="" @keypress="handlePress" />
|
||||
|
||||
<NButton
|
||||
block
|
||||
type="primary"
|
||||
:disabled="disabled"
|
||||
:loading="loading"
|
||||
@click="handleVerify"
|
||||
>
|
||||
{{ $t('common.verify') }}
|
||||
</NButton>
|
||||
</div>
|
||||
</div>
|
||||
</NModal>
|
||||
</template>
|
||||
@@ -1,34 +0,0 @@
|
||||
<script lang="ts" setup>
|
||||
import { NButton } from 'naive-ui'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
function goHome() {
|
||||
router.push('/')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex h-full">
|
||||
<div class="px-4 m-auto space-y-4 text-center max-[400px]">
|
||||
<h1 class="text-4xl text-slate-800 dark:text-neutral-200">
|
||||
No permission
|
||||
</h1>
|
||||
<p class="text-base text-slate-500 dark:text-neutral-400">
|
||||
The page you're trying access has restricted access.
|
||||
Please refer to your system administrator
|
||||
</p>
|
||||
<div class="flex items-center justify-center text-center">
|
||||
<div class="w-[300px]">
|
||||
<div class="w-[300px]">
|
||||
<img src="../../../icons/403.svg" alt="404">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<NButton type="primary" @click="goHome">
|
||||
Go to Home
|
||||
</NButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,32 @@
|
||||
<script lang="ts" setup>
|
||||
import { NButton } from 'naive-ui'
|
||||
import { useRouter } from 'vue-router'
|
||||
import Icon500 from '@/icons/500.vue'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
function goHome() {
|
||||
router.push('/')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex h-full dark:bg-neutral-800">
|
||||
<div class="px-4 m-auto space-y-4 text-center max-[400px]">
|
||||
<header class="space-y-2">
|
||||
<h2 class="text-2xl font-bold text-center text-slate-800 dark:text-neutral-200">
|
||||
500
|
||||
</h2>
|
||||
<p class="text-base text-center text-slate-500 dark:text-slate-500">
|
||||
Server error
|
||||
</p>
|
||||
<div class="flex items-center justify-center text-center">
|
||||
<Icon500 class="w-[300px]" />
|
||||
</div>
|
||||
</header>
|
||||
<NButton type="primary" @click="goHome">
|
||||
Go to Home
|
||||
</NButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user