feat(webui): custom CSS + config export/import/reset (phase 6)
A "高级" Settings tab adds: - Custom CSS (appearance.customCss, <=50KB) applied post-auth only, as the last <style> so it overrides everything. It never reaches the login page: the server strips it from /api/ui/public, applyAppearance gates injection on a bearer token (so the localStorage cache can't leak it pre-auth), and the login page clears any lingering <style> on mount. `?safe-mode=1` (sticky for the tab session) disables custom CSS so a broken rule can't lock the operator out. - Export / import the whole UI config as JSON (import is normalized server-side, then reload); reset-all behind a confirm dialog. POST /api/ui and the import file are size-capped (256KB) on top of the per-field caps. Verified across 2 adversarial review rounds — the pre-auth cached-CSS leak/lockout vector found in round 1 is closed across the boot / logout / 401-expiry / re-login paths.
This commit is contained in:
7 files changed
+237
-8
No files matched your search
@@ -19,9 +19,13 @@ import type { AccountConnections, HookProcessInfo, QQInfo, SystemInfo, UpdateInf
|
||||
*/
|
||||
export function AppLayout() {
|
||||
const api = useApi();
|
||||
const { pollInterval } = useTheme();
|
||||
const { pollInterval, reloadAppearance } = useTheme();
|
||||
const session = useSession();
|
||||
|
||||
// Now that we're authed, re-fetch appearance from /api/ui so the
|
||||
// authed-only `customCss` (stripped from the pre-auth public subset) loads.
|
||||
useEffect(() => { void reloadAppearance(); }, [reloadAppearance]);
|
||||
|
||||
const [qqList, setQqList] = useState<QQInfo[]>([]);
|
||||
const [processList, setProcessList] = useState<HookProcessInfo[]>([]);
|
||||
const [systemInfo, setSystemInfo] = useState<SystemInfo | null>(null);
|
||||
|
||||
Reference in new issue
Block a user