chore: Update dev run
All checks were successful
Queue Release Build / prepare (push) Successful in 20s
Deploy Web Apps / deploy (push) Successful in 9m11s
Queue Release Build / build-windows (push) Successful in 28m8s
Queue Release Build / build-linux (push) Successful in 46m49s
Queue Release Build / build-android (push) Successful in 20m54s
Queue Release Build / finalize (push) Successful in 2m15s

This commit is contained in:
2026-06-11 12:32:15 +02:00
parent 31962aeb1a
commit 9981aee602
5 changed files with 42 additions and 10 deletions

9
dev.sh
View File

@@ -21,13 +21,14 @@ if [ "$SSL" = "true" ]; then
fi fi
NG_SERVE="cd toju-app && npx ng serve --host=0.0.0.0 --ssl --ssl-cert=../.certs/localhost.crt --ssl-key=../.certs/localhost.key" NG_SERVE="cd toju-app && npx ng serve --host=0.0.0.0 --ssl --ssl-cert=../.certs/localhost.crt --ssl-key=../.certs/localhost.key"
WAIT_URL="https://localhost:4200" # Use 127.0.0.1 so wait-on does not hit a stale HTTP listener on localhost (::1).
HEALTH_URL="https://localhost:3001/api/health" WAIT_URL="https://127.0.0.1:4200"
HEALTH_URL="https://127.0.0.1:3001/api/health"
export NODE_TLS_REJECT_UNAUTHORIZED=0 export NODE_TLS_REJECT_UNAUTHORIZED=0
else else
NG_SERVE="cd toju-app && npx ng serve --host=0.0.0.0" NG_SERVE="cd toju-app && npx ng serve --host=0.0.0.0"
WAIT_URL="http://localhost:4200" WAIT_URL="http://127.0.0.1:4200"
HEALTH_URL="http://localhost:3001/api/health" HEALTH_URL="http://127.0.0.1:3001/api/health"
fi fi
exec npx concurrently --kill-others \ exec npx concurrently --kill-others \

View File

@@ -11,6 +11,7 @@ import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
import { DESKTOP_APP_DISPLAY_NAME } from '../app/desktop-branding.rules'; import { DESKTOP_APP_DISPLAY_NAME } from '../app/desktop-branding.rules';
import { readDesktopSettings } from '../desktop-settings'; import { readDesktopSettings } from '../desktop-settings';
import { resolveDevelopmentClientUrl } from './dev-client-url.rules';
let mainWindow: BrowserWindow | null = null; let mainWindow: BrowserWindow | null = null;
let tray: Tray | null = null; let tray: Tray | null = null;
@@ -277,11 +278,7 @@ export async function createWindow(): Promise<void> {
} }
if (process.env['NODE_ENV'] === 'development') { if (process.env['NODE_ENV'] === 'development') {
const devUrl = process.env['SSL'] === 'true' await mainWindow.loadURL(resolveDevelopmentClientUrl(process.env['SSL'] === 'true'));
? 'https://localhost:4200'
: 'http://localhost:4200';
await mainWindow.loadURL(devUrl);
if (process.env['DEBUG_DEVTOOLS'] === '1') { if (process.env['DEBUG_DEVTOOLS'] === '1') {
mainWindow.webContents.openDevTools(); mainWindow.webContents.openDevTools();

View File

@@ -0,0 +1,26 @@
import {
describe,
expect,
it
} from 'vitest';
import {
DEV_CLIENT_HOST,
DEV_CLIENT_PORT,
resolveDevelopmentClientUrl
} from './dev-client-url.rules';
describe('dev-client-url.rules', () => {
it('targets loopback IPv4 so dev wait-on avoids stale localhost IPv6 listeners', () => {
expect(DEV_CLIENT_HOST).toBe('127.0.0.1');
expect(DEV_CLIENT_PORT).toBe(4200);
});
it('builds the HTTP dev client URL', () => {
expect(resolveDevelopmentClientUrl(false)).toBe('http://127.0.0.1:4200');
});
it('builds the HTTPS dev client URL', () => {
expect(resolveDevelopmentClientUrl(true)).toBe('https://127.0.0.1:4200');
});
});

View File

@@ -0,0 +1,8 @@
export const DEV_CLIENT_HOST = '127.0.0.1';
export const DEV_CLIENT_PORT = 4200;
export function resolveDevelopmentClientUrl(sslEnabled: boolean): string {
const scheme = sslEnabled ? 'https' : 'http';
return `${scheme}://${DEV_CLIENT_HOST}:${DEV_CLIENT_PORT}`;
}

View File

@@ -23,7 +23,7 @@
"server:start": "cd server && npm start", "server:start": "cd server && npm start",
"server:dev": "cd server && npm run dev", "server:dev": "cd server && npm run dev",
"electron": "npm run build && npm run build:electron && node tools/launch-electron.js . --no-sandbox --disable-dev-shm-usage", "electron": "npm run build && npm run build:electron && node tools/launch-electron.js . --no-sandbox --disable-dev-shm-usage",
"electron:dev": "concurrently \"npm run start\" \"wait-on http://localhost:4200 && npm run build:electron && cross-env NODE_ENV=development node tools/launch-electron.js . --no-sandbox --disable-dev-shm-usage\"", "electron:dev": "concurrently \"npm run start\" \"wait-on http://127.0.0.1:4200 && npm run build:electron && cross-env NODE_ENV=development node tools/launch-electron.js . --no-sandbox --disable-dev-shm-usage\"",
"electron:full": "./dev.sh", "electron:full": "./dev.sh",
"electron:full:build": "npm run build:all && concurrently --kill-others \"cd server && npm start\" \"cross-env NODE_ENV=production node tools/launch-electron.js . --no-sandbox --disable-dev-shm-usage\"", "electron:full:build": "npm run build:all && concurrently --kill-others \"cd server && npm start\" \"cross-env NODE_ENV=production node tools/launch-electron.js . --no-sandbox --disable-dev-shm-usage\"",
"migration:generate": "typeorm migration:generate electron/migrations/Auto -d dist/electron/data-source.js", "migration:generate": "typeorm migration:generate electron/migrations/Auto -d dist/electron/data-source.js",