www-apps/vaultwarden-web: Web UI for Vaultwarden

add 2024.1.2b

Signed-off-by: Rahil Bhimjiani <me@rahil.rocks>
This commit is contained in:
Rahil Bhimjiani
2024-02-24 19:36:32 +05:30
parent 635550c3c8
commit cd2faf0f21
3 changed files with 87 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
DIST bitwarden-clients-a1a5c4b.tar.xz 204680568 BLAKE2B dd7ae09792831dacf9e7c110a508315e8d57c3231c6c32014e7b842ffc01a046fec03f375c48afd40379ba2853159e594a54b3f8ec229c1568ba3d1b8c054335 SHA512 5644d0b53c525164c2af14036dd7d432be9a943b55df2aef9922329326b164b31336bd53e2f9f2eb35a858f974d8fc0a3bd3aac6e42b821d5d4634ca714a51c3
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

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>me@rahil.rocks</email>
<name>Rahil Bhimjiani</name>
</maintainer>
<upstream>
<remote-id type="github">dani-garcia/bw_web_builds</remote-id>
<bugs-to>https://github.com/dani-garcia/bw_web_builds/issues</bugs-to>
<doc>https://github.com/dani-garcia/bw_web_builds/blob/master/README.md</doc>
</upstream>
</pkgmetadata>

View File

@@ -0,0 +1,71 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit check-reqs
DESCRIPTION="Bitwarden web vault patched to make it work with Vaultwarden"
HOMEPAGE="https://github.com/dani-garcia/bw_web_builds"
BW_CLIENTS_COMMIT="a1a5c4b"
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="
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
}
src_prepare() {
default
# mimicking the behaviour of https://github.com/dani-garcia/bw_web_builds/blob/master/scripts/apply_patches.sh
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
eapply "${PATCH_FILE}"
mv -v ../node_modules ./ || die
}
src_compile() {
# 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/*
}