commit:     638aa63f895a3f289412214da02cb6c9c86d1f4c
Author:     Rahil Bhimjiani <me <AT> rahil <DOT> rocks>
AuthorDate: Mon Apr  8 09:30:42 2024 +0000
Commit:     Rahil Bhimjiani <rahil3108 <AT> gmail <DOT> com>
CommitDate: Mon Apr  8 11:53:43 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=638aa63f

www-apps/vaultwarden-web: update to 2024.3.1

Signed-off-by: Rahil Bhimjiani <me <AT> rahil.rocks>

 www-apps/vaultwarden-web/Manifest                  |   3 +
 .../vaultwarden-web-2024.3.1.ebuild                | 106 +++++++++++++++++++++
 2 files changed, 109 insertions(+)

diff --git a/www-apps/vaultwarden-web/Manifest 
b/www-apps/vaultwarden-web/Manifest
index cdf195ef42..38a131daa6 100644
--- a/www-apps/vaultwarden-web/Manifest
+++ b/www-apps/vaultwarden-web/Manifest
@@ -1,6 +1,9 @@
+DIST bitwarden-clients-60e47af.tar.zst 248520786 BLAKE2B 
1c3f98805c199d7a4391611402a5401d164773aeb22d29d6c95eb22c4d048416d890b805ca72fe74c46958ac1dc1218cd6ef51f1b8cc5d855528f89846119d04
 SHA512 
baca3e3db98e9e5f12455d6a9f2b4e0d79e4d0d53f414eccadf26e765b058087bb290b17d5885a7ea9bf5880d0a916283ea97bff2dd41cd8d0825b56d7e8d790
 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
+DIST vaultwarden-web-2024.3.1-patches.tar.gz 119554 BLAKE2B 
afd4620dbae0d050c38537c7cce13c7596e66e1615425a31bee0c9f4652470d1e4964cbea0a33fb8172371dbc4f21a01c489888f8fc28a412cc3fee0a223aa58
 SHA512 
f3cd1b3fe95b602777d27cded7415459a6d1ec739e50ddf9ea211ccdbb52e66e2e004182509526748ef2562cd6007c63f0a1ee5cdcc671df1a6b1f02bcab2e2b
+DIST vaultwarden-web-2024.3.1.tar.gz 20649053 BLAKE2B 
374a52ded74eafea33460175fd74b174230f9111a9a89e2aecdb52cd15a626bf62eb29b6312d369a0c87ed5ddccf9324fadec10192fd2727f510df92c0682d9e
 SHA512 
30133b2ecaaffb2ed68af7e12fcd023902ee81fecd39de4a005a565d716cfac5a67f2ea41e31c49bd242278e8a0502e6147de302ef8b5228e913027d64b01ac9

diff --git a/www-apps/vaultwarden-web/vaultwarden-web-2024.3.1.ebuild 
b/www-apps/vaultwarden-web/vaultwarden-web-2024.3.1.ebuild
new file mode 100644
index 0000000000..ecff10e558
--- /dev/null
+++ b/www-apps/vaultwarden-web/vaultwarden-web-2024.3.1.ebuild
@@ -0,0 +1,106 @@
+# 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 unpacker
+
+DESCRIPTION="Bitwarden web vault patched to make it work with Vaultwarden"
+HOMEPAGE="https://github.com/dani-garcia/bw_web_builds";
+
+BW_CLIENTS_COMMIT="60e47af"
+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.zst
 -> bitwarden-clients-${BW_CLIENTS_COMMIT}.tar.zst
+       
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 || die
+       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
+       popd || die
+}
+
+src_install() {
+       insinto /usr/share/webapps/"${PN}"
+       doins -r apps/web/build/*
+}

Reply via email to