diff --git a/README.md b/README.md index 400a4fb..ca076ed 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # spt-launcher -모드동기화용 런쳐 \ No newline at end of file +모드동기화용 런쳐 diff --git a/src/main/main.ts b/src/main/main.ts index d46df2b..cea776f 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -2,6 +2,7 @@ import { app, BrowserWindow, ipcMain, net, session } from "electron"; import { execFile } from "node:child_process"; import * as fs from "node:fs/promises"; import * as path from "node:path"; +import { APP_CONFIG } from "../shared/config"; const isDev = Boolean(process.env.VITE_DEV_SERVER_URL); @@ -15,12 +16,12 @@ type ServerHealthResult = { // SPT 서버는 기본적으로 self-signed TLS(자체서명 인증서)를 쓰는 경우가 많아서 // 런처에서는 HTTPS + 인증서 예외 처리(certificate exception)를 고려합니다. -const SERVER_BASE_URL = "https://pandoli365.com:5069/"; -const SERVER_HEALTHCHECK_PATH = "/launcher/ping"; -const SERVER_HEALTHCHECK_TIMEOUT_MS = 2000; -const SERVER_REQUEST_TIMEOUT_MS = 4000; -const COMMAND_TIMEOUT_MS = 4000; -const INSTALL_TIMEOUT_MS = 10 * 60 * 1000; +const SERVER_BASE_URL = APP_CONFIG.serverBaseUrl; +const SERVER_HEALTHCHECK_PATH = APP_CONFIG.serverHealthcheckPath; +const SERVER_HEALTHCHECK_TIMEOUT_MS = APP_CONFIG.serverHealthcheckTimeoutMs; +const SERVER_REQUEST_TIMEOUT_MS = APP_CONFIG.serverRequestTimeoutMs; +const COMMAND_TIMEOUT_MS = APP_CONFIG.commandTimeoutMs; +const INSTALL_TIMEOUT_MS = APP_CONFIG.installTimeoutMs; type CommandCheckResult = { ok: boolean; diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx index 5173185..978f917 100644 --- a/src/renderer/App.tsx +++ b/src/renderer/App.tsx @@ -1,4 +1,5 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import { APP_CONFIG, SERVER_HEALTHCHECK_URL } from "../shared/config"; type Screen = "serverCheck" | "login" | "signup" | "resetPassword" | "main"; type CommandCheck = { @@ -24,8 +25,8 @@ type GitPathsCheck = { checkedAt: number; }; -const HEALTHCHECK_INTERVAL_MS = 10000; -const HEALTHCHECK_ENDPOINT_FALLBACK = "https://pandoli365.com:5069/launcher/ping"; +const HEALTHCHECK_INTERVAL_MS = APP_CONFIG.healthcheckIntervalMs; +const HEALTHCHECK_ENDPOINT_FALLBACK = SERVER_HEALTHCHECK_URL; const App = () => { const [screen, setScreen] = useState("serverCheck"); diff --git a/src/renderer/vite-env.d.ts b/src/renderer/vite-env.d.ts index 2e3d5a1..ab11615 100644 --- a/src/renderer/vite-env.d.ts +++ b/src/renderer/vite-env.d.ts @@ -92,3 +92,4 @@ interface Window { }>; }; } + diff --git a/src/shared/config.ts b/src/shared/config.ts new file mode 100644 index 0000000..1c96627 --- /dev/null +++ b/src/shared/config.ts @@ -0,0 +1,14 @@ +export const APP_CONFIG = { + serverBaseUrl: "https://pandoli365.com:5069/", + serverHealthcheckPath: "/launcher/ping", + serverHealthcheckTimeoutMs: 2000, + serverRequestTimeoutMs: 4000, + commandTimeoutMs: 4000, + installTimeoutMs: 10 * 60 * 1000, + healthcheckIntervalMs: 10000 +} as const; + +export const SERVER_HEALTHCHECK_URL = new URL( + APP_CONFIG.serverHealthcheckPath, + APP_CONFIG.serverBaseUrl +).toString(); diff --git a/tsconfig.json b/tsconfig.json index 497cce9..d8abccd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,5 +10,5 @@ "noEmit": true, "types": ["vite/client"] }, - "include": ["src/renderer/**/*", "src/renderer/vite-env.d.ts"] + "include": ["src/renderer/**/*", "src/renderer/vite-env.d.ts", "src/shared/**/*"] } diff --git a/tsconfig.main.json b/tsconfig.main.json index a2903c6..9d9e4b2 100644 --- a/tsconfig.main.json +++ b/tsconfig.main.json @@ -9,5 +9,5 @@ "rootDir": "src", "noEmit": false }, - "include": ["src/main/**/*", "src/preload/**/*"] + "include": ["src/main/**/*", "src/preload/**/*", "src/shared/**/*"] }