From be8f4f8512dfb2952a09de658fe22c3395b13343 Mon Sep 17 00:00:00 2001 From: npmrun <1549469775@qq.com> Date: Fri, 17 Apr 2026 01:13:49 +0800 Subject: [PATCH] feat: add global configuration management and error handling component Introduce a new error handling component to display user-friendly error messages based on HTTP status codes. Implement global configuration management to control registration availability across the application. Update various components and pages to utilize the new configuration, ensuring consistent behavior for registration links and error handling. Enhance middleware to bypass authentication for specific paths and improve overall user experience. --- app/components/AppShell.vue | 4 +- app/composables/useGlobalConfig.ts | 36 ++++++++++ app/error.vue | 126 +++++++++++++++++++++++++++++++++ app/middleware/auth.global.ts | 9 +++ app/pages/index/index.vue | 3 +- app/pages/login/index.vue | 3 +- app/pages/register/index.vue | 9 +++ server/api/auth/register.post.ts | 8 +++ server/api/config/global.get.ts | 4 +- server/plugins/00.global.ts | 45 ------------ server/plugins/00.req-time.ts | 36 ++++++++++ server/plugins/01.context.ts | 45 ++++++++++++ server/plugins/01.req-time.ts | 36 ---------- server/plugins/02.well-known-ignore.ts | 2 +- 14 files changed, 279 insertions(+), 87 deletions(-) create mode 100644 app/composables/useGlobalConfig.ts create mode 100644 app/error.vue delete mode 100644 server/plugins/00.global.ts create mode 100644 server/plugins/00.req-time.ts create mode 100644 server/plugins/01.context.ts delete mode 100644 server/plugins/01.req-time.ts diff --git a/app/components/AppShell.vue b/app/components/AppShell.vue index b3d778c..08cf7b2 100644 --- a/app/components/AppShell.vue +++ b/app/components/AppShell.vue @@ -44,6 +44,8 @@ const menuItems = [ }, ], ] + +const { allowRegister } = useGlobalConfig()