From 6995e8b4be74297a4508f1d3ab000813db008399 Mon Sep 17 00:00:00 2001 From: BlackDex Date: Sat, 23 Apr 2022 17:04:11 +0200 Subject: [PATCH] Support for bitwarden/web v2.28.0 The patch is almost identical just some offsets are different. This version does solve the multiple `/sync` requests which will benefit the loading time and load on the server! --- Dockerfile | 6 +- patches/v2.28.0.patch | 271 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 274 insertions(+), 3 deletions(-) create mode 100644 patches/v2.28.0.patch diff --git a/Dockerfile b/Dockerfile index ebe3e48..ae4fe59 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ # docker cp $image_id:/bw_web_vault.tar.gz . # docker rm $image_id -FROM node:16-buster as build +FROM node:16-bullseye as build RUN node -v && npm -v # Prepare the folder to enable non-root, otherwise npm will refuse to run the postinstall @@ -23,8 +23,8 @@ USER node # Can be a tag, release, but prefer a commit hash because it's not changeable # https://github.com/bitwarden/web/commit/$VAULT_VERSION # -# Using https://github.com/bitwarden/web/releases/tag/v2.27.0 -ARG VAULT_VERSION=05a17629a52ea188a146fbb6b2b82595e5eb73b5 +# Using https://github.com/bitwarden/web/releases/tag/v2.28.0 +ARG VAULT_VERSION=3a248bc8386a8e2f0ea8063b8a2b2b3ee1f6c51d RUN git clone https://github.com/bitwarden/web.git /vault WORKDIR /vault diff --git a/patches/v2.28.0.patch b/patches/v2.28.0.patch new file mode 100644 index 0000000..77ae1af --- /dev/null +++ b/patches/v2.28.0.patch @@ -0,0 +1,271 @@ +Submodule jslib contains modified content +diff --git a/jslib/angular/src/components/register.component.ts b/jslib/angular/src/components/register.component.ts +index d4b99e17..c1626200 100644 +--- a/jslib/angular/src/components/register.component.ts ++++ b/jslib/angular/src/components/register.component.ts +@@ -28,7 +28,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn + formPromise: Promise; + masterPasswordScore: number; + referenceData: ReferenceEventRequest; +- showTerms = true; ++ showTerms = false; + acceptPolicies = false; + + protected successRoute = "login"; +@@ -47,7 +47,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn + protected logService: LogService + ) { + super(environmentService, i18nService, platformUtilsService); +- this.showTerms = !platformUtilsService.isSelfHost(); ++ this.showTerms = false; + } + + async ngOnInit() { +@@ -85,6 +85,15 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn + } + + async submit() { ++ if (typeof crypto.subtle === 'undefined') { ++ this.platformUtilsService.showToast( ++ "error", ++ "This browser requires HTTPS to use the web vault", ++ "Check the Vaultwarden wiki for details on how to enable it" ++ ); ++ return; ++ } ++ + if (!this.acceptPolicies && this.showTerms) { + this.platformUtilsService.showToast( + "error", +diff --git a/src/404.html b/src/404.html +index 6cf5e363..54d11495 100644 +--- a/src/404.html ++++ b/src/404.html +@@ -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/src/app/app.component.ts b/src/app/app.component.ts +index cd94408f..56bc4bdb 100644 +--- a/src/app/app.component.ts ++++ b/src/app/app.component.ts +@@ -159,6 +159,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/src/app/layouts/footer.component.html b/src/app/layouts/footer.component.html +index 8601e123..22a0248b 100644 +--- a/src/app/layouts/footer.component.html ++++ b/src/app/layouts/footer.component.html +@@ -1,6 +1,6 @@ +