@jeffusion/bungee-core 6.0.4 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -273,14 +273,12 @@
|
|
|
273
273
|
"session.failed": "会话设置读取或保存失败。",
|
|
274
274
|
"session.reload": "重新读取",
|
|
275
275
|
"setup.title": "初始化认证",
|
|
276
|
-
"setup.description": "
|
|
277
|
-
"setup.code": "一次性初始化码",
|
|
276
|
+
"setup.description": "创建首个管理员账号,完成后前往登录。",
|
|
278
277
|
"setup.password": "密码(5–32 个字符)",
|
|
279
278
|
"setup.confirmation": "确认密码",
|
|
280
279
|
"setup.submit": "初始化账号",
|
|
281
280
|
"setup.busy": "正在初始化…",
|
|
282
281
|
"setup.failed": "未能确认初始化结果。请检查连接后重试。",
|
|
283
|
-
"setup.invalid_setup_code": "初始化码无效或已过期,请在部署服务器重新签发。",
|
|
284
282
|
"setup.password_confirmation": "两次输入的密码不一致。",
|
|
285
283
|
"setup.invalid_password": "密码须为 5–32 个字符。",
|
|
286
284
|
"setup.already_initialized": "认证已初始化,请前往登录。",
|
|
@@ -532,14 +530,12 @@
|
|
|
532
530
|
"session.failed": "Could not read or save session settings.",
|
|
533
531
|
"session.reload": "Reload settings",
|
|
534
532
|
"setup.title": "Initialize authentication",
|
|
535
|
-
"setup.description": "
|
|
536
|
-
"setup.code": "One-time setup code",
|
|
533
|
+
"setup.description": "Create the first administrator account, then sign in.",
|
|
537
534
|
"setup.password": "Password (5–32 characters)",
|
|
538
535
|
"setup.confirmation": "Confirm password",
|
|
539
536
|
"setup.submit": "Initialize account",
|
|
540
537
|
"setup.busy": "Initializing…",
|
|
541
538
|
"setup.failed": "Could not confirm initialization. Check your connection and try again.",
|
|
542
|
-
"setup.invalid_setup_code": "The code is invalid or expired. Issue another code on the deployment server.",
|
|
543
539
|
"setup.password_confirmation": "Passwords do not match.",
|
|
544
540
|
"setup.invalid_password": "Use 5–32 characters.",
|
|
545
541
|
"setup.already_initialized": "Authentication is already initialized. Sign in.",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import type { ManagementSetupContext } from '@bungee/plugin-sdk';
|
|
6
6
|
let { context }: { context: ManagementSetupContext } = $props();
|
|
7
7
|
const t = (key: string) => $isLoading ? '' : $_(`plugins.user-auth.${key}`);
|
|
8
|
-
let
|
|
8
|
+
let username = $state(''), password = $state(''), passwordConfirmation = $state('');
|
|
9
9
|
let busy = $state(false), error = $state(''), detail = $state('');
|
|
10
10
|
let destroyed = false;
|
|
11
11
|
onDestroy(() => { destroyed = true; });
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
if (password !== passwordConfirmation) { error = 'setup.password_confirmation'; return; }
|
|
16
16
|
if ([...password].length < 5 || [...password].length > 32) { error = 'setup.invalid_password'; return; }
|
|
17
17
|
busy = true;
|
|
18
|
-
try { await active.initialize({
|
|
18
|
+
try { await active.initialize({username, password, passwordConfirmation}); }
|
|
19
19
|
catch (cause) {
|
|
20
20
|
if (destroyed || context !== active) return;
|
|
21
21
|
detail = cause instanceof Error ? cause.message : String(cause);
|
|
22
|
-
error = ['
|
|
22
|
+
error = ['password_confirmation', 'invalid_password', 'already_initialized'].includes(detail) ? `setup.${detail}` : 'setup.failed';
|
|
23
23
|
} finally {
|
|
24
|
-
password = ''; passwordConfirmation = '';
|
|
24
|
+
password = ''; passwordConfirmation = '';
|
|
25
25
|
if (!destroyed && context === active) busy = false;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
|
|
30
30
|
<form onsubmit={initialize} aria-label={t('setup.title')} aria-busy={busy} class="space-y-4">
|
|
31
31
|
<p class="text-sm text-zinc-400">{t('setup.description')}</p>
|
|
32
|
-
<label class="grid gap-1"><span class="nx-field-label">{t('setup.code')}</span><input class="nx-input font-mono" bind:value={setupCode} autocomplete="off" required disabled={busy} /></label>
|
|
33
32
|
<label class="grid gap-1"><span class="nx-field-label">{t('login.username')}</span><input class="nx-input" bind:value={username} autocomplete="username" required maxlength="64" disabled={busy} /></label>
|
|
34
33
|
<label class="grid gap-1"><span class="nx-field-label">{t('setup.password')}</span><input class="nx-input" type="password" bind:value={password} autocomplete="new-password" required disabled={busy} /></label>
|
|
35
34
|
<label class="grid gap-1"><span class="nx-field-label">{t('setup.confirmation')}</span><input class="nx-input" type="password" bind:value={passwordConfirmation} autocomplete="new-password" required disabled={busy} /></label>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeffusion/bungee-core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"description": "Bungee reverse proxy core engine",
|
|
5
5
|
"main": "./dist/main.js",
|
|
6
6
|
"types": "./dist/main.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@iconify-json/lucide": "^1.2.145",
|
|
17
17
|
"@iconify-json/tabler": "^1.2.42",
|
|
18
18
|
"@iconify/utils": "^3.1.7",
|
|
19
|
-
"@jeffusion/bungee-types": "^6.
|
|
19
|
+
"@jeffusion/bungee-types": "^6.1.1",
|
|
20
20
|
"@types/lodash-es": "^4.17.12",
|
|
21
21
|
"@types/ws": "^8.18.1",
|
|
22
22
|
"acorn": "^8.15.0",
|