From 50ad005e43eced970ddbe1cb2f794a376af011a0 Mon Sep 17 00:00:00 2001 From: Vinicius Fortuna Date: Thu, 16 Nov 2023 17:39:07 -0500 Subject: [PATCH] feat(manager): enable servers with valid domains (#1448) --- src/server_manager/electron_app/index.ts | 2 ++ src/server_manager/model/server.ts | 4 ++-- src/server_manager/web_app/management_urls.ts | 3 --- src/server_manager/web_app/manual_server.ts | 2 +- src/server_manager/web_app/ui_components/app-root.ts | 2 -- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/server_manager/electron_app/index.ts b/src/server_manager/electron_app/index.ts index 6559bf207..1d4018c0b 100644 --- a/src/server_manager/electron_app/index.ts +++ b/src/server_manager/electron_app/index.ts @@ -193,6 +193,8 @@ function main() { // prevent window being garbage collected let mainWindow: Electron.BrowserWindow; + app.userAgentFallback = `OutlineManager/${electron.app.getVersion()} ${app.userAgentFallback}`; + // Mark secure to avoid mixed content warnings when loading DigitalOcean pages via https://. electron.protocol.registerSchemesAsPrivileged([ {scheme: 'outline', privileges: {standard: true, secure: true}}, diff --git a/src/server_manager/model/server.ts b/src/server_manager/model/server.ts index 889943959..2b36bc4df 100644 --- a/src/server_manager/model/server.ts +++ b/src/server_manager/model/server.ts @@ -103,7 +103,7 @@ export interface Server { // Manual servers are servers which the user has independently setup to run // shadowbox, and can be on any cloud provider. export interface ManualServer extends Server { - getCertificateFingerprint(): string; + getCertificateFingerprint(): string | undefined; forget(): void; } @@ -159,7 +159,7 @@ export class MonetaryCost { // shadowbox. export interface ManualServerConfig { apiUrl: string; - certSha256: string; + certSha256?: string; } // Repository of ManualServer objects. These are servers the user has setup diff --git a/src/server_manager/web_app/management_urls.ts b/src/server_manager/web_app/management_urls.ts index fb0888cec..0744b70a0 100644 --- a/src/server_manager/web_app/management_urls.ts +++ b/src/server_manager/web_app/management_urls.ts @@ -38,9 +38,6 @@ export function parseManualServerConfig(userInput: string): ManualServerConfig { if (!config.apiUrl) { throw new Error('no apiUrl field'); } - if (!config.certSha256) { - throw new Error('no certSha256 field'); - } return config; } diff --git a/src/server_manager/web_app/manual_server.ts b/src/server_manager/web_app/manual_server.ts index 65b206427..f7674227b 100644 --- a/src/server_manager/web_app/manual_server.ts +++ b/src/server_manager/web_app/manual_server.ts @@ -25,7 +25,7 @@ class ManualServer extends ShadowboxServer implements server.ManualServer { private forgetCallback: Function ) { super(id); - const fingerprint = hexToString(manualServerConfig.certSha256); + const fingerprint = hexToString(manualServerConfig.certSha256 ?? ''); this.setManagementApi(makePathApiClient(manualServerConfig.apiUrl, fingerprint)); } diff --git a/src/server_manager/web_app/ui_components/app-root.ts b/src/server_manager/web_app/ui_components/app-root.ts index efd14b3f0..5b1934682 100644 --- a/src/server_manager/web_app/ui_components/app-root.ts +++ b/src/server_manager/web_app/ui_components/app-root.ts @@ -927,8 +927,6 @@ export class AppRoot extends polymerElementWithLocalize { const manualEntry = this.$.manualEntry as OutlineManualServerEntry; if (clickedButtonIndex === 1) { manualEntry.retryTapped(); - } else { - manualEntry.cancelTapped(); } }); }