feat(auth): add optional HTTP Basic Auth access gate

This commit is contained in:
ji ruo committed 2026-10-09 10:12:27 +08:00
1 parent 979e1fe4eb
commit 04c8c54ff8
14 files changed
+809 -23

No files matched your search

+2 -2
View File
@@ -4,7 +4,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
import { toast } from "sonner";
import { sseUrl } from "@/lib/api";
import { openSSE } from "@/lib/api";
import { isBtwCommand, type SideExchange, type SideHistory, sideAPI } from "@/lib/side-questions";
// crypto.randomUUID 仅在安全上下文可用(https/localhost);经 IP+http 访问时降级。
@@ -128,7 +128,7 @@ export function useSideQuestions(parent: string | null) {
useEffect(() => {
if (!runningID) return;
const version = epoch.current;
const stream = new EventSource(sseUrl(`/api/side-questions/${runningID}/events`));
const stream = openSSE(`/api/side-questions/${runningID}/events`);
stream.addEventListener("snapshot", (event) => {
if (version !== epoch.current) return;
try {