From 5a77451b59c7047e05e27e73cbd946387478e224 Mon Sep 17 00:00:00 2001 From: BlackDex Date: Wed, 11 Sep 2024 14:01:57 +0200 Subject: [PATCH] Add dynamic CSS support This PR will remove the custom CSS changes from this repo. A PR in the Vaultwarden repo will add these in a different way. To make the dynamic CSS work other changes are done to add a custom stylesheet link tag. Also moved some legacy patch files. --- patches/v2023.1.0.patch | 426 ----------------------- patches/v2023.1.1.patch | 439 ----------------------- patches/v2023.10.0.patch | 616 --------------------------------- patches/v2023.12.0.patch | 614 -------------------------------- patches/v2023.2.0.patch | 445 ------------------------ patches/v2023.3.0.patch | 445 ------------------------ patches/v2023.4.0.patch | 445 ------------------------ patches/v2023.5.0.patch | 472 ------------------------- patches/v2023.5.1.patch | 459 ------------------------ patches/v2023.7.1.patch | 471 ------------------------- patches/v2023.8.2.patch | 515 --------------------------- patches/v2023.9.1.patch | 530 ---------------------------- scripts/generate_patch_file.sh | 5 +- 13 files changed, 4 insertions(+), 5878 deletions(-) delete mode 100644 patches/v2023.1.0.patch delete mode 100644 patches/v2023.1.1.patch delete mode 100644 patches/v2023.10.0.patch delete mode 100644 patches/v2023.12.0.patch delete mode 100644 patches/v2023.2.0.patch delete mode 100644 patches/v2023.3.0.patch delete mode 100644 patches/v2023.4.0.patch delete mode 100644 patches/v2023.5.0.patch delete mode 100644 patches/v2023.5.1.patch delete mode 100644 patches/v2023.7.1.patch delete mode 100644 patches/v2023.8.2.patch delete mode 100644 patches/v2023.9.1.patch diff --git a/patches/v2023.1.0.patch b/patches/v2023.1.0.patch deleted file mode 100644 index d64985a..0000000 --- a/patches/v2023.1.0.patch +++ /dev/null @@ -1,426 +0,0 @@ -diff --git a/apps/web/src/404.html b/apps/web/src/404.html -index 5a650b367..275c34f72 100644 ---- a/apps/web/src/404.html -+++ b/apps/web/src/404.html -@@ -28,7 +28,7 @@ - -@@ -42,11 +42,10 @@ - -

-

-- You can return to the web vault, check our -- status page or -- contact us. -+ You can return to the web vault, or -+ contact us. -

- -- -+ - - -diff --git a/apps/web/src/app/app.component.ts b/apps/web/src/app/app.component.ts -index 12f499a01..68250d53c 100644 ---- a/apps/web/src/app/app.component.ts -+++ b/apps/web/src/app/app.component.ts -@@ -172,6 +172,10 @@ export class AppComponent implements OnDestroy, OnInit { - break; - } - case "showToast": -+ if (typeof message.text === "string" && typeof crypto.subtle === 'undefined') { -+ message.title="This browser requires HTTPS to use the web vault"; -+ message.text="Check the Vaultwarden wiki for details on how to enable it"; -+ } - this.showToast(message); - break; - case "setFullWidth": -diff --git a/apps/web/src/app/core/init.service.ts b/apps/web/src/app/core/init.service.ts -index 8baa7c0dd..8f3b5d464 100644 ---- a/apps/web/src/app/core/init.service.ts -+++ b/apps/web/src/app/core/init.service.ts -@@ -37,11 +37,23 @@ export class InitService { - ) {} - - init() { -+ function getBaseUrl() { -+ // If the base URL is `https://vaultwarden.example.com/base/path/`, -+ // `window.location.href` should have one of the following forms: -+ // -+ // - `https://vaultwarden.example.com/base/path/` -+ // - `https://vaultwarden.example.com/base/path/#/some/route[?queryParam=...]` -+ // -+ // We want to get to just `https://vaultwarden.example.com/base/path`. -+ let baseUrl = window.location.href; -+ baseUrl = baseUrl.replace(/#.*/, ''); // Strip off `#` and everything after. -+ baseUrl = baseUrl.replace(/\/+$/, ''); // Trim any trailing `/` chars. -+ return baseUrl; -+ } - return async () => { - await this.stateService.init(); - -- const urls = process.env.URLS as Urls; -- urls.base ??= this.win.location.origin; -+ const urls = {base: getBaseUrl()}; - this.environmentService.setUrls(urls); - - setTimeout(() => this.notificationsService.init(), 3000); -diff --git a/apps/web/src/app/core/router.service.ts b/apps/web/src/app/core/router.service.ts -index aa9041875..680936375 100644 ---- a/apps/web/src/app/core/router.service.ts -+++ b/apps/web/src/app/core/router.service.ts -@@ -23,7 +23,7 @@ export class RouterService { - .subscribe((event: NavigationEnd) => { - this.currentUrl = event.url; - -- let title = i18nService.t("pageTitle", "Bitwarden"); -+ let title = i18nService.t("pageTitle", "Vaultwarden"); - let child = this.activatedRoute.firstChild; - while (child.firstChild) { - child = child.firstChild; -diff --git a/apps/web/src/app/core/web-platform-utils.service.ts b/apps/web/src/app/core/web-platform-utils.service.ts -index 2d682a35a..e64687b67 100644 ---- a/apps/web/src/app/core/web-platform-utils.service.ts -+++ b/apps/web/src/app/core/web-platform-utils.service.ts -@@ -194,11 +194,11 @@ export class WebPlatformUtilsService implements PlatformUtilsService { - } - - isDev(): boolean { -- return process.env.NODE_ENV === "development"; -+ return false; - } - - isSelfHost(): boolean { -- return process.env.ENV.toString() === "selfhosted"; -+ return false; - } - - copyToClipboard(text: string, options?: any): void | boolean { -diff --git a/apps/web/src/app/layouts/footer.component.html b/apps/web/src/app/layouts/footer.component.html -index 98836bfd5..1239167c4 100644 ---- a/apps/web/src/app/layouts/footer.component.html -+++ b/apps/web/src/app/layouts/footer.component.html -@@ -1,6 +1,6 @@ -