refactor: Remove init_token handling from admin initialization logic and related tests

This commit is contained in:
foreleven
2026-04-12 12:05:38 +08:00
committed by JeffJiang
parent 44d9953e2e
commit 00a90bbd3d
8 changed files with 13 additions and 144 deletions
-21
View File
@@ -26,9 +26,6 @@ export default function SetupPage() {
const [error, setError] = useState("");
const [loading, setLoading] = useState(false);
// --- Init-admin mode only ---
const [initToken, setInitToken] = useState("");
// --- Change-password mode only ---
const [currentPassword, setCurrentPassword] = useState("");
@@ -82,7 +79,6 @@ export default function SetupPage() {
body: JSON.stringify({
email,
password: newPassword,
init_token: initToken,
}),
});
@@ -190,23 +186,6 @@ export default function SetupPage() {
required
/>
</div>
<div className="flex flex-col space-y-1">
<label htmlFor="initToken" className="text-sm font-medium">
Initialization Token
</label>
<Input
id="initToken"
type="text"
placeholder="Copy from server startup logs"
value={initToken}
onChange={(e) => setInitToken(e.target.value)}
required
autoComplete="off"
/>
<p className="text-muted-foreground text-xs">
Find the <code>INIT TOKEN</code> printed in the server startup logs.
</p>
</div>
<div className="flex flex-col space-y-1">
<label htmlFor="password" className="text-sm font-medium">
Password
-1
View File
@@ -40,7 +40,6 @@ const AUTH_ERROR_CODES = [
"provider_not_found",
"not_authenticated",
"system_already_initialized",
"invalid_init_token",
] as const;
export type AuthErrorCode = (typeof AUTH_ERROR_CODES)[number];
+1 -1
View File
@@ -322,7 +322,7 @@ export function useThreadStream({
useEffect(() => {
if (
optimisticMessages.length > 0 &&
thread.messages.length > prevMsgCountRef.current
thread.messages.length > prevMsgCountRef.current + 1
) {
setOptimisticMessages([]);
}