diff --git a/.dockerignore b/.dockerignore
index 6b9b3d4..482e191 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,7 +1,12 @@
# Local build artifacts
builds
+docker_builds
web-vault
# Documentation
*.md
*.txt
+
+# Other
+.github
+Makefile
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index ed4a1ce..e1547f8 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -30,7 +30,7 @@ jobs:
echo "set-output name=DOCKER_TAG::testing"
echo "::set-output name=DOCKER_TAG::testing"
fi
-
+
- name: Build and push
uses: docker/build-push-action@a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229 # v2.7.0
with:
diff --git a/.gitignore b/.gitignore
index cd21c1c..6d5f3e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
builds/
+docker_builds/
web-vault/
*.tar.gz
diff --git a/Dockerfile b/Dockerfile
index f58fc61..07fdbec 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,7 +13,7 @@
# docker rm $image_id
FROM node:16-bullseye as build
-RUN node -v && npm -v
+RUN node --version && npm --version
# Prepare the folder to enable non-root, otherwise npm will refuse to run the postinstall
RUN mkdir /vault
@@ -21,19 +21,19 @@ RUN chown node:node /vault
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
+# https://github.com/bitwarden/web/commit/${VAULT_VERSION}
#
-# Using https://github.com/bitwarden/web/releases/tag/v2.28.1
-ARG VAULT_VERSION=78a7181fe5afa677220d69c6ebb2d6c0a5b83729
+# Using https://github.com/bitwarden/web/releases/tag/2022.05.0
+ARG VAULT_VERSION=ec80782d8f2ec593adf4f2d874fc8b97783c9d33
RUN git clone https://github.com/bitwarden/web.git /vault
WORKDIR /vault
-RUN git checkout "$VAULT_VERSION" && \
- git submodule update --recursive --init
+RUN git -c advice.detachedHead=false checkout "${VAULT_VERSION}" && \
+ git submodule update --recursive --init --force
COPY --chown=node:node patches /patches
-COPY --chown=node:node apply_patches.sh /apply_patches.sh
+COPY --chown=node:node scripts/apply_patches.sh /apply_patches.sh
RUN bash /apply_patches.sh
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c792ca3
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,51 @@
+SHELL := bash
+.ONESHELL:
+.SHELLFLAGS := -eu -o pipefail -c
+.DELETE_ON_ERROR:
+
+help:
+ @echo "Use either: clean, checkout, build, patch-web-vault, generate-patch, tar, or full"
+ @echo "Or for docker builds use: docker or docker-extract"
+.PHONY: help
+
+clean:
+ rm -rvf "./web-vault"
+ rm -rvf "./builds"
+ rm -rvf "./docker_builds"
+.PHONY: clean
+
+checkout:
+ ./scripts/checkout_web_vault.sh
+.PHONY: checkout
+
+patch-web-vault:
+ ./scripts/patch_web_vault.sh
+.PHONY: patch-web-vault
+
+generate-patch:
+ ./scripts/generate_patch_file.sh
+.PHONY: generate-patch
+
+build:
+ ./scripts/build_web_vault.sh
+.PHONY: checkout
+
+tar:
+ ./scripts/tar_web_vault.sh
+.PHONY: tar
+
+full: checkout patch-web-vault build tar
+.PHONY: full
+
+docker:
+ docker build -t bw_web_vault .
+.PHONY: docker
+
+docker-extract: docker
+ @docker rm bw_web_vault_extract || true
+ @docker create --name bw_web_vault_extract bw_web_vault
+ @mkdir -vp docker_builds
+ @docker cp bw_web_vault_extract:/bw_web_vault.tar.gz ./docker_builds/bw_web_vault.tar.gz
+ @docker cp bw_web_vault_extract:/web-vault ./docker_builds/web-vault
+ @docker rm bw_web_vault_extract || true
+.PHONY: docker-extract
diff --git a/README.md b/README.md
index ddf1426..f9684d4 100644
--- a/README.md
+++ b/README.md
@@ -5,18 +5,54 @@
[![GPL-3.0 Licensed](https://img.shields.io/github/license/dani-garcia/bw_web_builds.svg)](https://github.com/dani-garcia/bw_web_builds/blob/master/LICENSE.txt)
[![Matrix Chat](https://img.shields.io/matrix/vaultwarden:matrix.org.svg?logo=matrix)](https://matrix.to/#/#vaultwarden:matrix.org)
+**This project is not associated with the [Bitwarden](https://bitwarden.com/) project nor 8bit Solutions LLC.**
+
+#### ⚠️**IMPORTANT**⚠️: When using this server, please report any bugs or suggestions to us directly (look at the bottom of this page for ways to get in touch), regardless of whatever clients you are using (mobile, desktop, browser...). DO NOT use the official support channels.
+
+---
+
+
+
This is a repository to store the builds of the [Bitwarden web vault](https://github.com/bitwarden/web) with the patches to make it work with [vaultwarden](https://github.com/dani-garcia/vaultwarden)
To create a patch you need to modify the original sources from [Bitwarden web vault](https://github.com/bitwarden/web) and execute:
```bash
-git diff --submodule=diff
+git --no-pager diff --submodule=diff --no-color --minimal
```
This is needed because there are patches within the jslib submodule which with a default `git diff` are not shown.
+## Building the web-vault
+To build the web-vault you need either node and npm installed or use Docker.
+
+### Using node and npm
+For a quick and easy local build you could run:
+```bash
+make full
+```
+
+That will generate a `tar.gz` file within the `builds` directory which you can extract and use with the `WEB_VAULT_FOLDER` environment variable.
+
+### Using Docker
+Or via the usage of Docker:
+```bash
+make docker-extract
+```
+
+That will extract the `tar.gz` and files generated via Docker into the `docker_builds` directory.
+
+### More information
For more information see: [Install the web-vault](https://github.com/dani-garcia/vaultwarden/wiki/Building-binary#install-the-web-vault)
+### Pre-build
The builds are available in the [releases page](https://github.com/dani-garcia/bw_web_builds/releases), and can be replicated with the scripts in this repo.
-_*Note, that this project is not associated with the [Bitwarden](https://bitwarden.com/) project nor 8bit Solutions LLC._
+
+
+## Get in touch
+To ask a question, offer suggestions or new features or to get help configuring or installing the software, please [use the forum](https://vaultwarden.discourse.group/).
+
+If you spot any bugs or crashes with vaultwarden itself, please [create an issue](https://github.com/dani-garcia/vaultwarden/issues/). Make sure there aren't any similar issues open, though!
+
+If you prefer to chat, we're usually hanging around at [#vaultwarden:matrix.org](https://matrix.to/#/#vaultwarden:matrix.org) room on Matrix. Feel free to join us!
diff --git a/package_web_vault.sh b/package_web_vault.sh
deleted file mode 100755
index d3d3a80..0000000
--- a/package_web_vault.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env bash
-set -o pipefail -o errexit
-
-# Error handling
-handle_error() {
- read -n1 -r -p "FAILED: line $1, exit code $2. Press any key to exit..." _
- exit 1
-}
-trap 'handle_error $LINENO $?' ERR
-
-# Ask for ref if not provided
-if [[ -z "$VAULT_VERSION" ]]; then
- read -rp "Input a git ref (commit hash, branch name, tag name, 'master'): " input
- VAULT_VERSION="$input"
-fi
-
-VAULT_FOLDER=web-vault
-OUTPUT_FOLDER=builds
-OUTPUT_NAME="$OUTPUT_FOLDER/bw_web_$VAULT_VERSION.tar.gz"
-
-mkdir -p "$OUTPUT_FOLDER"
-
-# If this is the first time, clone the project
-if [ ! -d "$VAULT_FOLDER" ]; then
- git clone https://github.com/bitwarden/web.git "$VAULT_FOLDER"
-fi
-
-cd $VAULT_FOLDER
-
-# Clean
-git checkout -f
-
-# Update branch
-git fetch --tags --all
-git pull origin master
-
-# Checkput the branch we want
-git checkout "$VAULT_VERSION"
-git submodule update --recursive --init
-
-## How to create patches
-# git --no-pager diff --submodule=diff --no-color --minimal > changes.patch
-## How to apply patches
-# git apply changes.patch
-. ../apply_patches.sh
-
-# Build
-npm ci
-# npm audit fix || true
-npm run dist:oss:selfhost
-
-# Delete debugging map files, optional
-#find build -name "*.map" -delete
-
-# Create bwrs-version.json with the latest tag from the remote repo.
-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/vw-version.json
-
-# Prepare the final archives
-mv build web-vault
-tar -czvf "../$OUTPUT_NAME" web-vault --owner=0 --group=0
-mv web-vault build
diff --git a/package_web_vault.sh b/package_web_vault.sh
new file mode 120000
index 0000000..c82a3ba
--- /dev/null
+++ b/package_web_vault.sh
@@ -0,0 +1 @@
+scripts/package_web_vault.sh
\ No newline at end of file
diff --git a/patches/v2022.05.0.patch b/patches/v2022.05.0.patch
new file mode 100644
index 0000000..3664486
--- /dev/null
+++ b/patches/v2022.05.0.patch
@@ -0,0 +1,283 @@
+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
+- You can return to the web vault, check our +- status page or +- contact us. ++ You can return to the web vault, or ++ contact us. +
+ +- ++ +