diff --git a/src/handbook/index.html b/src/handbook/index.html index a65597435..b2fc29c98 100644 --- a/src/handbook/index.html +++ b/src/handbook/index.html @@ -7,6 +7,11 @@ diff --git a/src/handbook/src/backend/server.ts b/src/handbook/src/backend/server.ts index aefc4efd8..d35c5ab17 100644 --- a/src/handbook/src/backend/server.ts +++ b/src/handbook/src/backend/server.ts @@ -1,12 +1,14 @@ import type { CommandResponse } from "@backend/types"; import emitter from "@backend/events"; +import { getWindowDetails } from "@app/utils"; + let playerToken: string | null = null; // The session token for the player. export let targetPlayer = 0; // The UID of the target player. // The server's address and port. -export let address: string = "127.0.0.1", - port: string = "443"; +export let address: string = getWindowDetails().address, + port: string = getWindowDetails().port.toString(); export let encrypted: boolean = true; export let lockedPlayer = false; // Whether the UID field is locked. @@ -16,6 +18,9 @@ export let connected = false; // Whether the server is connected. * Loads the server details from local storage. */ export function setup(): void { + // Check if the server is disabled. + if (getWindowDetails().disable) return; + // Load the server details from local storage. const storedAddress = localStorage.getItem("address"); const storedPort = localStorage.getItem("port"); diff --git a/src/handbook/src/backend/types.ts b/src/handbook/src/backend/types.ts index b65b9c2c9..df08d4e73 100644 --- a/src/handbook/src/backend/types.ts +++ b/src/handbook/src/backend/types.ts @@ -135,6 +135,12 @@ export type CommandResponse = { message: string; }; +export type WindowDetails = { + address: string, + port: number, + disable: boolean +}; + /** * Checks if a string is a page. * diff --git a/src/handbook/src/ui/widgets/ServerSettings.tsx b/src/handbook/src/ui/widgets/ServerSettings.tsx index dd74f64b9..86aa4f71b 100644 --- a/src/handbook/src/ui/widgets/ServerSettings.tsx +++ b/src/handbook/src/ui/widgets/ServerSettings.tsx @@ -4,6 +4,7 @@ import emitter from "@backend/events"; import { targetPlayer, address, port, setServerDetails, url, setTargetPlayer } from "@backend/server"; import "@css/widgets/ServerSettings.scss"; +import { getWindowDetails } from "@app/utils"; interface IState { webview: boolean; @@ -97,6 +98,8 @@ class ServerSettings extends React.Component<{}, IState> { } render() { + const { disable } = getWindowDetails(); + return (
Address:
{ this.setState({ address: value }); }} + disabled={disable} + style={{ + cursor: disable ? "not-allowed" : "text" + }} />