feat: 新的登录页 & 修复剪贴板问题

This commit is contained in:
overtrue
2025-04-12 15:34:49 +08:00
parent 730b8a689d
commit a60ddbbc10
30 changed files with 2283 additions and 377 deletions
+5
View File
@@ -17,6 +17,11 @@ export default defineNuxtPlugin({
} catch (error) {
finalConfig = useRuntimeConfig().public
}
if (!finalConfig.api.baseURL) {
throw new Error('API URL is not defined in the configuration.')
}
return {
provide: {
siteConfig: finalConfig
+21
View File
@@ -15,6 +15,7 @@ export default defineNuxtPlugin({
const client = new S3Client({
endpoint: siteConfig.s3.endpoint,
region: siteConfig.s3.region || 'us-east-1',
forcePathStyle: true,
// https://github.com/aws/aws-sdk-js-v3/issues/6834#issuecomment-2611346849
requestChecksumCalculation: "WHEN_REQUIRED",
credentials: {
@@ -24,6 +25,26 @@ export default defineNuxtPlugin({
}
});
// 添加中间件捕捉 401 错误
client.middlewareStack.add(
(next, context) => async (args) => {
try {
return await next(args);
} catch (error: any) {
if (error?.$metadata?.httpStatusCode === 401) {
await useAuth().logoutAndRedirect();
}
// 其他错误处理
console.error('S3Client error:', error);
throw error;
}
},
{
step: "finalizeRequest",
name: "handleUnauthorizedMiddleware",
}
);
return {
provide: {
s3Client: client