- Fix Readme

- Fix co-op so it actually works
This commit is contained in:
tyuXX 2026-11-15 23:01:45 +03:00
parent d2645e6a26
commit 2642552891
45 changed files with 5069 additions and 1225 deletions

View file

@ -1,5 +1,11 @@
// Literally everything (pls help me my autocorrect is trying to insult me how does this even work)
import { api, getSettings, saveSettings, setServerJoinOk } from "./api.js";
import {
api,
clearTabToken,
getSettings,
saveSettings,
setServerJoinOk,
} from "./api.js";
import { navigate, registerScreenRenderers } from "./router.js";
import {
loadCatalogs,
@ -15,6 +21,7 @@ import {
state,
type WikiScreenParams,
} from "./state.js";
import { normalizeJoinCode } from "../shared/coop.js";
import { applyVisualPreferences } from "./theme.js";
import { initNotificationDrawer, initTooltipController, toast } from "./ui.js";
import { renderAuth } from "./screens/auth.js";
@ -118,11 +125,16 @@ async function boot(): Promise<void> {
} catch (err) {
toast(`Failed to load mission catalogs: ${(err as Error).message}`, "err");
}
const passParam = new URLSearchParams(window.location.search).get("pass");
if (passParam) {
const urlParams = new URLSearchParams(window.location.search);
const passParam = urlParams.get("pass");
const joinParam = urlParams.get("join");
if (passParam || joinParam) {
const url = new URL(window.location.href);
url.searchParams.delete("pass");
url.searchParams.delete("join");
window.history.replaceState(null, "", url.toString());
}
if (passParam) {
if (state.serverInfo?.serverPasswordRequired) {
try {
await api.post("/api/join", { password: passParam }, false);
@ -133,6 +145,13 @@ async function boot(): Promise<void> {
}
}
}
if (joinParam) {
state.pendingJoinCode = normalizeJoinCode(joinParam);
clearTabToken();
await readyPromise;
navigate("auth");
return;
}
await refreshMe();
if (state.agency) {
await refreshWorld();