Extract memind_adm admin server, add local dev tooling, and remove image-generation.

Split platform admin and ops APIs into standalone admin-server.mjs with network guards; simplify billing to RMB token pricing, refactor user auth, and add rsync deploy plus local-test scripts and docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Your Name
2026-06-17 16:39:39 -07:00
parent ab0718938e
commit b0f5d6a51c
98 changed files with 5394 additions and 3010 deletions
+30
View File
@@ -0,0 +1,30 @@
import { createContext, useContext, useEffect, useState } from 'react';
export type AuthUser = {
id: string;
username: string;
displayName: string;
role: string;
status?: string;
};
type AuthState = { loading: boolean; user: AuthUser | null };
const AuthContext = createContext<AuthState>({ loading: true, user: null });
export function AuthProvider({ children }: { children: React.ReactNode }) {
const [state, setState] = useState<AuthState>({ loading: true, user: null });
useEffect(() => {
void fetch('/auth/status', { credentials: 'include' })
.then((r) => r.json())
.then((auth: { authenticated: boolean; user?: AuthUser }) => {
setState({ loading: false, user: auth.authenticated ? (auth.user ?? null) : null });
})
.catch(() => setState({ loading: false, user: null }));
}, []);
return <AuthContext.Provider value={state}>{children}</AuthContext.Provider>;
}
export const useAuth = () => useContext(AuthContext);