From f8fbd290c7d363090f6a6e88a1d5d147b5c73078 Mon Sep 17 00:00:00 2001 From: Cuishibing <643237029@qq.com> Date: Sun, 26 Apr 2026 12:55:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=86=E7=A0=81=E8=BE=93=E5=85=A5=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/public/index.html b/public/index.html index 785ff15..59e181a 100644 --- a/public/index.html +++ b/public/index.html @@ -100,7 +100,6 @@ } async function setup() { - // 检查是否已有 key const savedKey = localStorage.getItem('myoss_api_key'); if (savedKey) { apiKey = savedKey; @@ -108,20 +107,19 @@ return; } - const name = document.getElementById('setup-name').value; + // 检查是否已有 key + const password = prompt('请输入管理员密码:'); + if (!password) return; + + const name = document.getElementById('setup-name').value || 'root'; const res = await fetch('/api/keys/bootstrap', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ name }) + body: JSON.stringify({ password, name }) }); const data = await res.json(); if (data.error) { - // 已初始化过,提示用户输入已有 key - const key = prompt('服务已初始化,请输入已有的 API Key:'); - if (key) { - localStorage.setItem('myoss_api_key', key); - location.reload(); - } + alert(data.error); return; } apiKey = data.key;