From 28e965fdbd3722cbdb9a894365ce41130e194515 Mon Sep 17 00:00:00 2001 From: Stefan Melmuk Date: Wed, 22 Mar 2023 00:37:46 +0100 Subject: [PATCH] update web-vault to v2023.3.0 --- Dockerfile | 4 +- patches/v2023.3.0.patch | 445 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 447 insertions(+), 2 deletions(-) create mode 100644 patches/v2023.3.0.patch diff --git a/Dockerfile b/Dockerfile index fd1cf9a..5a40b81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,8 +28,8 @@ USER node # Can be a tag, release, but prefer a commit hash because it's not changeable # https://github.com/bitwarden/clients/commit/${VAULT_VERSION} # -# Using https://github.com/bitwarden/clients/releases/tag/web-v2023.2.0 -ARG VAULT_VERSION=3f05a1772ea7f321768a13ec42beee1e5e1f9033 +# Using https://github.com/bitwarden/clients/releases/tag/web-v2023.3.0 +ARG VAULT_VERSION=454bc2fe1d12135a2b7550ac80c25b36f1022dd9 WORKDIR /vault RUN git init diff --git a/patches/v2023.3.0.patch b/patches/v2023.3.0.patch new file mode 100644 index 0000000..86fda45 --- /dev/null +++ b/patches/v2023.3.0.patch @@ -0,0 +1,445 @@ +diff --git a/apps/web/src/404.html b/apps/web/src/404.html +index 5a650b3673..275c34f726 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 d3b3e57e8d..6bc8d5dadc 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 1ecd7d3fef..0dd5f049c7 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 aa9041875a..6809363759 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 c8b95538da..67fe582be4 100644 +--- a/apps/web/src/app/core/web-platform-utils.service.ts ++++ b/apps/web/src/app/core/web-platform-utils.service.ts +@@ -195,15 +195,15 @@ export class WebPlatformUtilsService implements PlatformUtilsService { + } + + isDev(): boolean { +- return process.env.NODE_ENV === "development"; ++ return false; + } + + isSelfHost(): boolean { +- return WebPlatformUtilsService.isSelfHost(); ++ return false; + } + + static 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 98836bfd5d..1239167c43 100644 +--- a/apps/web/src/app/layouts/footer.component.html ++++ b/apps/web/src/app/layouts/footer.component.html +@@ -1,6 +1,6 @@ +