From 1e990dd7aed291152fe91496f8f4308846d03a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Wed, 27 Oct 2021 22:31:31 +0200 Subject: [PATCH] Update web vault to v2.24.1, and include PRs #54 and #55 Closes #54 Closes #55 --- Dockerfile | 8 +- apply_patches.sh | 2 +- package_web_vault.sh | 3 +- patches/v2.24.0.patch | 279 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 284 insertions(+), 8 deletions(-) create mode 100644 patches/v2.24.0.patch diff --git a/Dockerfile b/Dockerfile index 1405db9..c008f86 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,9 +25,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.23.0 -# TODO: When updating to a newer image, remove the package.json patch below -ARG VAULT_VERSION=cfa3d81cf87ed59c471021608b9b922023c825f1 +# Using https://github.com/bitwarden/web/releases/tag/v2.24.1 +ARG VAULT_VERSION=a6274fa56ec869a5c981c2edfff9db87a3bca4bf RUN git clone https://github.com/bitwarden/web.git /vault WORKDIR /vault @@ -41,10 +40,9 @@ COPY --chown=node:node apply_patches.sh /apply_patches.sh RUN bash /apply_patches.sh # Build -RUN sed -i 's/"gulp-google-webfonts": "^4.0.0"/"gulp-google-webfonts": "^4.1.0"/' package.json RUN npm ci --legacy-peer-deps RUN npm audit fix --legacy-peer-deps || true -RUN npm run dist +RUN npm run dist:oss:selfhost RUN printf '{"version":"%s"}' \ $(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/dani-garcia/bw_web_builds.git 'v*' | tail -n1 | sed -E 's#.*?refs/tags/v##') \ diff --git a/apply_patches.sh b/apply_patches.sh index 3507c4a..0e8df60 100755 --- a/apply_patches.sh +++ b/apply_patches.sh @@ -15,5 +15,5 @@ if [[ -z $PATCH_NAME ]]; then fi echo "Using patch: $PATCH_NAME" -git apply "../patches/$PATCH_NAME" +git apply "../patches/$PATCH_NAME" --reject echo "Patching successful!" diff --git a/package_web_vault.sh b/package_web_vault.sh index 534145e..a38dc17 100755 --- a/package_web_vault.sh +++ b/package_web_vault.sh @@ -47,10 +47,9 @@ git submodule update --recursive --init . ../apply_patches.sh # Build -sed -i 's/"gulp-google-webfonts": "^4.0.0"/"gulp-google-webfonts": "^4.1.0"/' package.json npm ci --legacy-peer-deps npm audit fix --legacy-peer-deps || true -npm run dist +npm run dist:oss:selfhost # Delete debugging map files, optional #find build -name "*.map" -delete diff --git a/patches/v2.24.0.patch b/patches/v2.24.0.patch new file mode 100644 index 0000000..3fe9b7a --- /dev/null +++ b/patches/v2.24.0.patch @@ -0,0 +1,279 @@ +Submodule jslib contains modified content +diff --git a/jslib/angular/src/components/register.component.ts b/jslib/angular/src/components/register.component.ts +index aecf9ce..7dec3e7 100644 +--- a/jslib/angular/src/components/register.component.ts ++++ b/jslib/angular/src/components/register.component.ts +@@ -29,7 +29,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn + formPromise: Promise; + masterPasswordScore: number; + referenceData: ReferenceEventRequest; +- showTerms = true; ++ showTerms = false; + acceptPolicies: boolean = false; + + protected successRoute = 'login'; +@@ -41,7 +41,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn + platformUtilsService: PlatformUtilsService, + protected passwordGenerationService: PasswordGenerationService, environmentService: EnvironmentService) { + super(environmentService, i18nService, platformUtilsService); +- this.showTerms = !platformUtilsService.isSelfHost(); ++ this.showTerms = false; + } + + async ngOnInit() { +@@ -79,6 +79,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 9d3207e4..779249b8 100644 +--- a/src/app/app.component.ts ++++ b/src/app/app.component.ts +@@ -158,6 +158,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 @@ +