Refactor configuration handling and update README. Moved server-related constants to a shared config module for better maintainability. Updated TypeScript configuration to include shared directory. Enhanced README with additional context.
This commit is contained in:
parent
944c77f146
commit
4b28133a1a
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<Screen>("serverCheck");
|
||||
|
|
|
|||
|
|
@ -92,3 +92,4 @@ interface Window {
|
|||
}>;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
@ -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/**/*"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@
|
|||
"rootDir": "src",
|
||||
"noEmit": false
|
||||
},
|
||||
"include": ["src/main/**/*", "src/preload/**/*"]
|
||||
"include": ["src/main/**/*", "src/preload/**/*", "src/shared/**/*"]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue