From 2ae84a8dd4d08d811812e07d495219d0a022ad0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Sun, 12 Dec 2021 23:51:40 +0100 Subject: [PATCH] Update web vault to v2.25.0 --- Dockerfile | 10 +- patches/v2.25.0.patch | 268 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 272 insertions(+), 6 deletions(-) create mode 100644 patches/v2.25.0.patch diff --git a/Dockerfile b/Dockerfile index c008f86..11408e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,10 +12,8 @@ # docker cp $image_id:/bw_web_vault.tar.gz . # docker rm $image_id -FROM node:14-buster as build - -# Update NPM - Matching the bitwarden/web GH Action Workflow. -RUN npm -g install npm@7 +FROM node:16-buster as build +RUN node -v && npm -v # Prepare the folder to enable non-root, otherwise npm will refuse to run the postinstall RUN mkdir /vault @@ -25,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.24.1 -ARG VAULT_VERSION=a6274fa56ec869a5c981c2edfff9db87a3bca4bf +# Using https://github.com/bitwarden/web/releases/tag/v2.25.0 +ARG VAULT_VERSION=d10dc94a48f7786d0b7b33a53f15a208f3f2b75f RUN git clone https://github.com/bitwarden/web.git /vault WORKDIR /vault diff --git a/patches/v2.25.0.patch b/patches/v2.25.0.patch new file mode 100644 index 0000000..5b35d19 --- /dev/null +++ b/patches/v2.25.0.patch @@ -0,0 +1,268 @@ +Submodule jslib contains modified content +diff --git a/jslib/angular/src/components/register.component.ts b/jslib/angular/src/components/register.component.ts +index fd91af2..abcfd62 100644 +--- a/jslib/angular/src/components/register.component.ts ++++ b/jslib/angular/src/components/register.component.ts +@@ -30,7 +30,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn + formPromise: Promise; + masterPasswordScore: number; + referenceData: ReferenceEventRequest; +- showTerms = true; ++ showTerms = false; + acceptPolicies: boolean = false; + + protected successRoute = 'login'; +@@ -43,7 +43,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn + protected passwordGenerationService: PasswordGenerationService, environmentService: EnvironmentService, + protected logService: LogService) { + super(environmentService, i18nService, platformUtilsService); +- this.showTerms = !platformUtilsService.isSelfHost(); ++ this.showTerms = false; + } + + async ngOnInit() { +@@ -81,6 +81,12 @@ 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', this.i18nService.t('errorOccurred'), + this.i18nService.t('acceptPoliciesError')); +diff --git a/src/404.html b/src/404.html +index eba36375..cb8883ec 100644 +--- a/src/404.html ++++ b/src/404.html +@@ -41,10 +41,10 @@ + +

+

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

++ or contact us.

+ + + + +diff --git a/src/app/app.component.ts b/src/app/app.component.ts +index f01ecb69..22fd7dc2 100644 +--- a/src/app/app.component.ts ++++ b/src/app/app.component.ts +@@ -160,6 +160,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 b001b9e3..c1bd2ac8 100644 +--- a/src/app/layouts/footer.component.html ++++ b/src/app/layouts/footer.component.html +@@ -1,7 +1,7 @@ +