From 9efb207eb17a9bdd61c66220c1a1a8e4747d385f Mon Sep 17 00:00:00 2001
From: BlackDex
Date: Wed, 23 Feb 2022 14:20:20 +0100
Subject: [PATCH] Support v2.26.1
- Added support for v2.26.1
- Hide some more input fields we do not use
- Fixed building with npm (The audit fix breaks the build)
- Fixed the vaultwarden version json filename.
---
Dockerfile | 10 +-
package_web_vault.sh | 6 +-
patches/v2.26.1.patch | 271 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 278 insertions(+), 9 deletions(-)
create mode 100644 patches/v2.26.1.patch
diff --git a/Dockerfile b/Dockerfile
index 1ae0246..9a7b6c5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -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.25.1
-ARG VAULT_VERSION=23b30422d886bd395259cb864a7d83caffe1d099
+# Using https://github.com/bitwarden/web/releases/tag/v2.26.1
+ARG VAULT_VERSION=aa42890fdfbfe603efd6d410d2cbd109f2033db9
RUN git clone https://github.com/bitwarden/web.git /vault
WORKDIR /vault
@@ -38,13 +38,13 @@ COPY --chown=node:node apply_patches.sh /apply_patches.sh
RUN bash /apply_patches.sh
# Build
-RUN npm ci --legacy-peer-deps
-RUN npm audit fix --legacy-peer-deps || true
+RUN npm ci
+# RUN npm audit fix || true
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##') \
- > build/bwrs-version.json
+ > build/vw-version.json
# Delete debugging map files, optional
# RUN find build -name "*.map" -delete
diff --git a/package_web_vault.sh b/package_web_vault.sh
index de1919a..d3d3a80 100755
--- a/package_web_vault.sh
+++ b/package_web_vault.sh
@@ -18,8 +18,6 @@ VAULT_FOLDER=web-vault
OUTPUT_FOLDER=builds
OUTPUT_NAME="$OUTPUT_FOLDER/bw_web_$VAULT_VERSION.tar.gz"
-npm install npm@7
-
mkdir -p "$OUTPUT_FOLDER"
# If this is the first time, clone the project
@@ -47,8 +45,8 @@ git submodule update --recursive --init
. ../apply_patches.sh
# Build
-npm ci --legacy-peer-deps
-npm audit fix --legacy-peer-deps || true
+npm ci
+# npm audit fix || true
npm run dist:oss:selfhost
# Delete debugging map files, optional
diff --git a/patches/v2.26.1.patch b/patches/v2.26.1.patch
new file mode 100644
index 0000000..32ccf7a
--- /dev/null
+++ b/patches/v2.26.1.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 16ccb6ea..52ef9b28 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";
+@@ -49,7 +49,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
+ protected logService: LogService
+ ) {
+ super(environmentService, i18nService, platformUtilsService);
+- this.showTerms = !platformUtilsService.isSelfHost();
++ this.showTerms = false;
+ }
+
+ async ngOnInit() {
+@@ -87,6 +87,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.
+
+
+-
++
+