fix: Incorrect desktop user agent and build issues

This commit is contained in:
LukeGus
2025-11-01 00:49:26 -05:00
parent 0d23a3835a
commit 3937529d6b
6 changed files with 40 additions and 32 deletions

View File

@@ -23,6 +23,7 @@ export function ElectronLoginForm({
const iframeRef = useRef<HTMLIFrameElement>(null);
const hasAuthenticatedRef = useRef(false);
const [currentUrl, setCurrentUrl] = useState(serverUrl);
const hasLoadedOnce = useRef(false);
useEffect(() => {
const handleMessage = async (event: MessageEvent) => {
@@ -52,7 +53,7 @@ export function ElectronLoginForm({
throw new Error("Failed to save JWT to localStorage");
}
await new Promise((resolve) => setTimeout(resolve, 200));
await new Promise((resolve) => setTimeout(resolve, 500));
onAuthSuccess();
} catch (err) {
@@ -81,6 +82,8 @@ export function ElectronLoginForm({
const handleLoad = () => {
setLoading(false);
hasLoadedOnce.current = true;
setError(null);
try {
if (iframe.contentWindow) {
@@ -200,7 +203,9 @@ export function ElectronLoginForm({
const handleError = () => {
setLoading(false);
setError(t("errors.failedToLoadServer"));
if (hasLoadedOnce.current) {
setError(t("errors.failedToLoadServer"));
}
};
iframe.addEventListener("load", handleLoad);