aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'www-apps/vaultwarden-web')
-rw-r--r--www-apps/vaultwarden-web/Manifest3
-rw-r--r--www-apps/vaultwarden-web/vaultwarden-web-2024.3.0.ebuild105
2 files changed, 108 insertions, 0 deletions
diff --git a/www-apps/vaultwarden-web/Manifest b/www-apps/vaultwarden-web/Manifest
index d0df5d97e..cdf195ef4 100644
--- a/www-apps/vaultwarden-web/Manifest
+++ b/www-apps/vaultwarden-web/Manifest
@@ -1,3 +1,6 @@
DIST bitwarden-clients-a1a5c4b.tar.xz 204680568 BLAKE2B dd7ae09792831dacf9e7c110a508315e8d57c3231c6c32014e7b842ffc01a046fec03f375c48afd40379ba2853159e594a54b3f8ec229c1568ba3d1b8c054335 SHA512 5644d0b53c525164c2af14036dd7d432be9a943b55df2aef9922329326b164b31336bd53e2f9f2eb35a858f974d8fc0a3bd3aac6e42b821d5d4634ca714a51c3
+DIST bitwarden-clients-dbf0f1e.tar.xz 246354040 BLAKE2B 88ff3b2ac9d1f255313086f16f89af469b595ae95476adc7cc5a119770569dd661cd83d2b946d548902d43b68717129f9d4e8db730d5155732c76fc8d40b1f9d SHA512 1ca13c13293dca613af36f111fc74a1beb489cd7686f80800af82a5767aa41dc0420775607353e3c44e6d543b700135dec2fc63fb95436f14790168574d9aaa6
DIST vaultwarden-web-2024.1.2.tar.gz 20199824 BLAKE2B da8f8f87a88a7baaa05985f5f8ec46ad2eae14953b1bec03fa22eb490f5d86a752d270fd76681dba23543e1d51ec02dad2c24aab60a47751300c539f9859bd46 SHA512 eea08dc128495b157ebf9b5ee48bf4b48d929257bb2b9839b2e7ac9913cb60118886df622765889aa84985a3ec47339e9f11196e1a09ebd0faa985061a43dacc
DIST vaultwarden-web-2024.1.2b-patches.tar.gz 97946 BLAKE2B 6b43ec5949c58e88d534d24dbb1b107320a50f1989dddd79243b17c0d8c5f65989a59542196890afdc036b3114c55776d2ed6609f51ebc114935bef61323705f SHA512 5463ce39642e3d53bffe774fa5bcdfde240cd1f7eadbcef8e7db4d5795deb2bc3a601505dc091a1dd0b4aa684e6a8f59a9a8c1542251b749e9c290986dd02f7f
+DIST vaultwarden-web-2024.3.0-patches.tar.gz 111779 BLAKE2B 6c40e599407a98f9acd84e28840cd46c9a9722b82ed76ea88d0cec6f99047d6afae6b8d509a147155428851c4a746af8011fb9a6c8a82e7833c28b0dcf015e3c SHA512 d6713eb4d5ebc2da26b38e6a3bd9ed9e977fcd9c18321b369f9456d7454206916e71020b7fd4d4b844d7e6598f0d2a7cafe538004f4a6d000521a999b25b85f1
+DIST vaultwarden-web-2024.3.0.tar.gz 20547395 BLAKE2B 1c0bec79f88bd44a26ba2d1d75f4a82cf13839c86bd3d1feb31f0f326fff4bbd908890ae11be2eb3ad31c591bde286d050afdb5942930b193201959174fb01c6 SHA512 f9326b8f8b334a8a9eb376cba66411d2890f265f810f3a444283ec8da229b4a4516593010e00b00d96f4d85c1f07a90ac19094ad70c9fbad8f3ba2c92d714348
diff --git a/www-apps/vaultwarden-web/vaultwarden-web-2024.3.0.ebuild b/www-apps/vaultwarden-web/vaultwarden-web-2024.3.0.ebuild
new file mode 100644
index 000000000..c5e2bb861
--- /dev/null
+++ b/www-apps/vaultwarden-web/vaultwarden-web-2024.3.0.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..12} )
+
+inherit check-reqs python-any-r1
+
+DESCRIPTION="Bitwarden web vault patched to make it work with Vaultwarden"
+HOMEPAGE="https://github.com/dani-garcia/bw_web_builds"
+
+BW_CLIENTS_COMMIT="dbf0f1e"
+SRC_URI="
+ https://github.com/bitwarden/clients/archive/refs/tags/web-v${PV%b}.tar.gz -> ${PN}-${PV%b}.tar.gz
+ https://github.com/rahilarious/gentoo-distfiles/releases/download/bitwarden-clients-${BW_CLIENTS_COMMIT}/deps.tar.xz -> bitwarden-clients-${BW_CLIENTS_COMMIT}.tar.xz
+ https://github.com/dani-garcia/bw_web_builds/archive/refs/tags/v${PV}.tar.gz -> ${P}-patches.tar.gz
+"
+
+S="${WORKDIR}/clients-web-v${PV%b}"
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="!www-apps/vaultwarden-web-bin"
+BDEPEND="
+ ${PYTHON_DEPS}
+ net-libs/nodejs[npm]
+"
+
+CHECKREQS_MEMORY=3G
+CHECKREQS_DISK_BUILD=2G
+
+pkg_pretend() {
+ einfo ""
+ einfo "#################################################"
+ einfo "Prebuilt alternative to this package is available:"
+ einfo " ${CATEGORY}/${PN}-bin"
+ einfo "#################################################"
+ einfo ""
+ check-reqs_pkg_pretend
+}
+
+pkg_setup() {
+ python-any-r1_pkg_setup
+}
+
+src_prepare() {
+ default
+
+ # mimicking the behaviour of https://github.com/dani-garcia/bw_web_builds/blob/master/scripts/apply_patches.sh
+ function replace_embedded_svg_icon() {
+ if [ ! -f $1 ]; then echo "$1 does not exist"; exit -1; fi
+ if [ ! -f $2 ]; then echo "$2 does not exist"; exit -1; fi
+
+ echo "'$1' -> '$2'"
+
+ first='`$'
+ last='^`'
+ sed -i "/$first/,/$last/{ /$first/{p; r $1
+}; /$last/p; d }" $2
+ }
+
+ local PATCH_FILE
+ if [[ -f "../bw_web_builds-${PV}/patches/v${PV%b}.patch" ]]; then
+ einfo "Exact patch file found, using that"
+ PATCH_FILE="../bw_web_builds-${PV}/patches/v${PV%b}.patch"
+ else
+ einfo "No exact patch file not found, using latest"
+ PATCH_FILE="../bw_web_builds-${PV}/patches/$(find ../bw_web_builds-${PV}/patches -type f -print0 | xargs -0 basename -a | sort -V | tail -n1)" || die
+ fi
+
+ cp -vfR ../bw_web_builds*/resources/src/* ./apps/web/src/ || die
+ replace_embedded_svg_icon \
+ ../bw_web_builds-"${PV}"/resources/vaultwarden-admin-console-logo.svg \
+ ./apps/web/src/app/admin-console/icons/admin-console-logo.ts || die
+ replace_embedded_svg_icon \
+ ../bw_web_builds-"${PV}"/resources/vaultwarden-password-manager-logo.svg \
+ ./apps/web/src/app/layouts/password-manager-logo.ts || die
+
+ eapply "${PATCH_FILE}"
+}
+
+src_compile() {
+ # mimicking https://contributing.bitwarden.com/getting-started/clients/
+ export \
+ npm_config_cache="${WORKDIR}"/npm-cache \
+ npm_config_nodedir="${EPREFIX}"/usr \
+ NODE_GYP_FORCE_PYTHON="${PYTHON}" \
+ ELECTRON_SKIP_BINARY_DOWNLOAD=1 \
+ || die
+ npm --verbose --offline clean-install || die
+
+ # mimicking the behaviour of https://github.com/dani-garcia/bw_web_builds/blob/master/scripts/build_web_vault.sh
+ pushd apps/web
+ npm --verbose --offline run dist:oss:selfhost && printf '{"version":"%s"}' "${PV}" | tee build/vw-version.json \
+ || die "Build failed! Try prebuilt from upstream ${CATEGORY}/${PN}-bin"
+ # although following is optional in upstream's build process, it reduced build dir size from 44M to 25M
+ find build -name "*.map" -delete || die
+}
+
+src_install() {
+ insinto /usr/share/webapps/"${PN}"
+ doins -r apps/web/build/*
+}