Add app customization options for title, icons, and Windows metadata (#16)

This commit is contained in:
Pandipipas
2026-02-10 23:47:30 +01:00
committed by GitHub
parent ba82e627db
commit 3a500a682f
2 changed files with 71 additions and 1 deletions
+18 -1
View File
@@ -3,7 +3,7 @@ import { ChildProcess, spawn } from "node:child_process";
import fs from "node:fs";
import path from "node:path";
const APP_TITLE = "Scoreko";
const APP_TITLE = process.env.SCOREKO_APP_TITLE ?? "Scoreko";
const DEFAULT_NODECG_PORT = process.env.NODECG_PORT ?? "9090";
const DEFAULT_BUNDLE_NAME = process.env.NODECG_BUNDLE_NAME ?? "scoreko-dev";
const DEFAULT_DASHBOARD_ROUTE = process.env.SCOREKO_DASHBOARD_ROUTE ?? "dashboard/example/main.html?standalone=true";
@@ -28,9 +28,12 @@ let stopNodeCGPromise: Promise<void> | null = null;
let isQuitting = false;
function createMainWindow(): BrowserWindow {
const iconPath = resolveAppIconPath();
const win = new BrowserWindow({
show: false,
title: APP_TITLE,
...(iconPath ? { icon: iconPath } : {}),
width: 1280,
height: 800,
minWidth: 800,
@@ -66,10 +69,13 @@ function createMainWindow(): BrowserWindow {
}
function createLoadingWindow(): BrowserWindow {
const iconPath = resolveAppIconPath();
const win = new BrowserWindow({
show: false,
frame: false,
title: APP_TITLE,
...(iconPath ? { icon: iconPath } : {}),
width: 300,
height: 300,
resizable: false,
@@ -90,6 +96,17 @@ function createLoadingWindow(): BrowserWindow {
return win;
}
function resolveAppIconPath(): string | undefined {
const candidates = [
path.join(rootPath, "static", "icons", "icon.ico"),
path.join(rootPath, "static", "icons", "icon.png"),
path.join(rootPath, "static", "icon.ico"),
path.join(rootPath, "static", "icon.png"),
];
return candidates.find((candidate) => fs.existsSync(candidate));
}
function validateNodeCGInstall(): void {
const indexPath = path.join(nodecgPath, "index.js");
const nodecgBootstrapPath = path.join(nodecgPath, "node_modules", "nodecg", "dist", "server", "bootstrap.js");