From 2c781164f0228bc59c4475dcf4aca83844d0cad7 Mon Sep 17 00:00:00 2001 From: ice-a Date: Fri, 16 Oct 2026 19:15:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=97=A8=E7=A6=81=E5=A2=9E=E5=BC=BA=20?= =?UTF-8?q?=E2=80=94=20=E8=BE=93=E9=94=995=E6=AC=A1=E9=94=81=E5=AE=9A1h=20?= =?UTF-8?q?+=20=E9=80=80=E5=87=BA=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 1 + app/layouts/default.vue | 6 +++++ app/pages/gate.vue | 50 +++++++++++++++++++++++++++++++++++---- app/types/api.ts | 1 + app/utils/i18n-dict.ts | 8 ++++++- server/api/health.get.ts | 5 ++-- server/api/logout.post.ts | 11 +++++++++ server/api/unlock.post.ts | 25 ++++++++++++++++---- server/middleware/auth.ts | 1 + server/utils/gate.ts | 42 ++++++++++++++++++++++++++++++++ 10 files changed, 137 insertions(+), 13 deletions(-) create mode 100644 server/api/logout.post.ts create mode 100644 server/utils/gate.ts diff --git a/.env.example b/.env.example index 453ab33..965f191 100644 --- a/.env.example +++ b/.env.example @@ -6,6 +6,7 @@ MONGODB_URI=mongodb://127.0.0.1:27017 MONGODB_DB=torrent_console # 站点访问密码(留空则站点完全开放;设置后进入站点需在 /gate 输入此密码,cookie 由服务端校验) +# 同一 IP 输错 5 次锁定 1 小时 WEBPASSWORD= # 访问搜索源时使用的 HTTP 代理(国内网络连不上公开磁力站时配这里) diff --git a/app/layouts/default.vue b/app/layouts/default.vue index a5dfeff..6a7bef5 100644 --- a/app/layouts/default.vue +++ b/app/layouts/default.vue @@ -19,6 +19,11 @@ const mongoPill = computed(() => { ? { cls: 'on', text: 'MONGO' } : { cls: 'off', text: 'MONGO 未连接' } }) + +async function logout() { + await $fetch('/api/logout', { method: 'POST' }).catch(() => {}) + await navigateTo('/gate', { reload: true }) +}