From 87f3999a0b388f418caa2bdc38fc348722627c01 Mon Sep 17 00:00:00 2001 From: BlackDex Date: Wed, 30 Nov 2022 17:52:03 +0100 Subject: [PATCH] Update to web-vault v2022.11.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR updates the web-vault to v2022.11.1 It also replaces the main logo and top left icon to indicate it is Vaultwarden. And the footer text has been change to `Vaultwarden (unofficial Bitwarden® server)` This hopefully helps causing less confusion. --- .dockerignore | 1 + Dockerfile | 5 +- patches/v2022.11.1.patch | 347 +++++++++++++++++++++++++++++++++ resources/icon-dark.png | Bin 0 -> 734 bytes resources/icon-white.png | Bin 0 -> 734 bytes resources/logo-dark@2x.png | Bin 0 -> 5473 bytes resources/logo-white@2x.png | Bin 0 -> 4187 bytes scripts/apply_patches.sh | 6 + scripts/generate_patch_file.sh | 7 +- 9 files changed, 363 insertions(+), 3 deletions(-) create mode 100644 patches/v2022.11.1.patch create mode 100644 resources/icon-dark.png create mode 100644 resources/icon-white.png create mode 100644 resources/logo-dark@2x.png create mode 100644 resources/logo-white@2x.png diff --git a/.dockerignore b/.dockerignore index 482e191..0ad6512 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,3 +10,4 @@ web-vault # Other .github Makefile +.vscode diff --git a/Dockerfile b/Dockerfile index b9cdc1d..938ce36 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-v2022.10.2 -ARG VAULT_VERSION=703860f1ac7bad2dfa9a98640a568db26fdcf5ed +# Using https://github.com/bitwarden/clients/releases/tag/web-v2022.11.1 +ARG VAULT_VERSION=eea3ddcaf2c5fc1c3ed3d405367cfed2d0789736 WORKDIR /vault RUN git init @@ -38,6 +38,7 @@ RUN git fetch --depth 1 origin "${VAULT_VERSION}" RUN git -c advice.detachedHead=false checkout FETCH_HEAD COPY --chown=node:node patches /patches +COPY --chown=node:node resources /resources COPY --chown=node:node scripts/apply_patches.sh /apply_patches.sh RUN bash /apply_patches.sh diff --git a/patches/v2022.11.1.patch b/patches/v2022.11.1.patch new file mode 100644 index 0000000..ff7b8c4 --- /dev/null +++ b/patches/v2022.11.1.patch @@ -0,0 +1,347 @@ +diff --git a/apps/web/src/404.html b/apps/web/src/404.html +index 6cf5e363d..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 9bd0fda6f..4ef20fa5c 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 75089529f..969d81a8a 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/web-platform-utils.service.ts b/apps/web/src/app/core/web-platform-utils.service.ts +index 115d53401..e62638e35 100644 +--- a/apps/web/src/app/core/web-platform-utils.service.ts ++++ b/apps/web/src/app/core/web-platform-utils.service.ts +@@ -188,11 +188,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 @@ +