From ae09c333370a53cec6876ed71f2b2b9bc65a0078 Mon Sep 17 00:00:00 2001 From: Exitium <146968249+Exitium-DEV@users.noreply.github.com> Date: Mon, 8 Apr 2024 14:26:28 +0100 Subject: [PATCH 1/2] Refactor: Edit build command to match angular.json The current advised build command does not export the correct environment, resulting in a developer environment being exported, even at production-level. This causes an issue when we start accessing the web server from a hostname that is not localhost, where the websocket cannot establish a connection to 127.0.0.1 instead of window.location.host --- desktop/angular/src/environments/environment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/angular/src/environments/environment.ts b/desktop/angular/src/environments/environment.ts index 5ef6df251..f3cd6ad6d 100644 --- a/desktop/angular/src/environments/environment.ts +++ b/desktop/angular/src/environments/environment.ts @@ -1,5 +1,5 @@ // This file can be replaced during build by using the `fileReplacements` array. -// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. +// `ng build --configuration=production` replaces `environment.ts` with `environment.prod.ts`. // The list of file replacements can be found in `angular.json`. export const environment = { From 1e2dffb5e5997a2765d325376957bec0690ff6f2 Mon Sep 17 00:00:00 2001 From: Exitium <146968249+Exitium-DEV@users.noreply.github.com> Date: Tue, 9 Apr 2024 00:30:13 +0100 Subject: [PATCH 2/2] Fix: Change build scripts to correctly set environment configuration --- desktop/angular/package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/desktop/angular/package.json b/desktop/angular/package.json index c1c058c87..117a6ca0d 100644 --- a/desktop/angular/package.json +++ b/desktop/angular/package.json @@ -4,18 +4,18 @@ "scripts": { "ng": "ng", "start": "npm install && npm run build-libs:dev && ng serve --proxy-config ./proxy.json", - "build-libs": "NODE_ENV=production ng build --configuration production @safing/ui && NODE_ENV=production ng build --configuration production @safing/portmaster-api", - "build-libs:dev": "ng build --configuration development @safing/ui && ng build --configuration development @safing/portmaster-api", + "build-libs": "NODE_ENV=production ng build --configuration=production @safing/ui && NODE_ENV=production ng build --configuration=production @safing/portmaster-api", + "build-libs:dev": "ng build --configuration=development @safing/ui && ng build --configuration=development @safing/portmaster-api", "serve": "npm run build-libs:dev && ng serve --proxy-config ./proxy.json", "build:dev": "npm run build-libs:dev && ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", "zip-dist": "node pack.js", - "chrome-extension": "NODE_ENV=production ng build --configuration production portmaster-chrome-extension", - "chrome-extension:dev": "ng build --configuration development portmaster-chrome-extension --watch", - "build": "npm run build-libs && NODE_ENV=production ng build --configuration production --base-href /ui/modules/portmaster/", - "build-tauri": "npm run build-libs && NODE_ENV=production ng build --configuration production tauri-builtin", + "chrome-extension": "NODE_ENV=production ng build --configuration=production portmaster-chrome-extension", + "chrome-extension:dev": "ng build --configuration=development portmaster-chrome-extension --watch", + "build": "npm run build-libs && NODE_ENV=production ng build --configuration=production --base-href /ui/modules/portmaster/", + "build-tauri": "npm run build-libs && NODE_ENV=production ng build --configuration=production tauri-builtin", "serve-tauri-builtin": "ng serve tauri-builtin --port 4100", "serve-app": "ng serve --port 4200 --proxy-config ./proxy.json", "tauri-dev": "npm install && run-s build-libs:dev && run-p serve-app serve-tauri-builtin"