Subject: testing/webcord: new aport

From: ve <[email-masked]>
Date: Thu, 18 Apr 2024 18:48:27 +0200

https://github.com/SpacingBat3/WebCord
A Discord and SpaceBar electron-based client implemented without Discord API
---
 testing/webcord/APKBUILD             | 47 ++++++++++++++++++++++++++++
 testing/webcord/WebCord.desktop      |  8 +++++
 testing/webcord/launcher             | 20 ++++++++++++
 testing/webcord/local-electron.patch | 29 +++++++++++++++++
 4 files changed, 104 insertions(+)
 create mode 100644 testing/webcord/APKBUILD
 create mode 100644 testing/webcord/WebCord.desktop
 create mode 100755 testing/webcord/launcher
 create mode 100644 testing/webcord/local-electron.patch

diff --git a/testing/webcord/APKBUILD b/testing/webcord/APKBUILD
new file mode 100644
index 00000000000..29e2028ad09
--- /dev/null
+++ b/testing/webcord/APKBUILD
@@ -0,0 +1,47 @@
+# Contributor: ve <[email-masked]>
+# Maintainer: ve <[email-masked]>
+pkgname=webcord
+pkgver=4.8.0
+pkgrel=0
+pkgdesc="A Discord and SpaceBar electron-based client implemented without Discord API"
+url="https://github.com/SpacingBat3/WebCord"
+arch="all"
+license="MIT"
+makedepends="nodejs npm zip electron electron-dev"
+source="$pkgname-$pkgver.tar.gz::https://github.com/SpacingBat3/WebCord/archive/refs/tags/v$pkgver.tar.gz
+	launcher
+	WebCord.desktop
+	local-electron.patch"
+builddir="$srcdir/WebCord-$pkgver"
+
+prepare() {
+	default_prepare
+	npm i
+	npm i @electron-forge/plugin-local-electron
+}
+
+build() {
+	WEBCORD_BUILD=release npm run package
+}
+
+check() {
+	npm run test
+}
+
+package() {
+	mkdir -p "$pkgdir"/usr/share/applications
+	install -Dm644 "$srcdir"/WebCord.desktop "$pkgdir"/usr/share/applications
+
+	install -Dm644 "$builddir"/sources/assets/icons/app.png "$pkgdir"/usr/share/icons/hicolor/512x512/apps/io.github.spacingbat3.webcord.png
+
+	mkdir -p "$pkgdir"/usr/lib/webcord
+	cp -r "$builddir"/out/release/WebCord-linux-x64/. "$pkgdir"/usr/lib/webcord
+
+	install -Dm755 "$srcdir"/launcher "$pkgdir"/usr/bin/webcord
+}
+sha512sums="
+9dbc5ac8fb85723cef2bd2bd0214cbbf05744127c305927bf19064bbf886490bb83a79c1272fceb4bf5d077072c55c45bf4b179d9c9691e309a97e28a4cd0b91  webcord-4.8.0.tar.gz
+d7500e3b02add3a16fcde6472b57ecf98980b145e44dc085074a350d7405206a30a5f10bb7155166885375f1dbee6db101e278716569d4d015247c1f300f6c1a  launcher
+9eec2d03f1fbdfa92cf3846fd10884545ca6162e45f283b3ee8a9e11b5f139a41255addc57f987d3651a389581f09e55535987792f086b24963c86d3b189b954  WebCord.desktop
+078c2219cb43379deea25cf7c23b0fb1e25e90542c9682d3d34e6dfcefa95874cecee64af5a7247aecf43602199b44831b794526299cd6913929b9988d767fec  local-electron.patch
+"
diff --git a/testing/webcord/WebCord.desktop b/testing/webcord/WebCord.desktop
new file mode 100644
index 00000000000..765d8e19cf4
--- /dev/null
+++ b/testing/webcord/WebCord.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=False
+Exec=webcord
+Name=WebCord
+Icon=/usr/share/icons/hicolor/512x512/apps/io.github.spacingbat3.webcord.png
diff --git a/testing/webcord/launcher b/testing/webcord/launcher
new file mode 100755
index 00000000000..6bb9df055c3
--- /dev/null
+++ b/testing/webcord/launcher
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Allow the user to override command-line flags
+# This is based on Debian's chromium-browser package, and is intended
+# to be consistent with Debian.
+for f in /etc/electron/*.conf; do
+    [ -f ${f} ] && . "${f}"
+done
+
+# Prefer user defined ELECTRON_USER_FLAGS (from env) over system
+# default ELECTRON_FLAGS (from /etc/electron/default.conf).
+export ELECTRON_FLAGS="$ELECTRON_FLAGS ${ELECTRON_USER_FLAGS:-"$ELECTRON_USER_FLAGS"}"
+# Re-export, for it to be accessible by the process
+export ELECTRON_OZONE_PLATFORM_HINT="${ELECTRON_OZONE_PLATFORM_HINT}"
+
+if [ "$ELECTRON_RUN_AS_NODE" == "1" ] && [ "$ELECTRON_STILL_PASS_THE_DEFAULT_FLAGS" != "1" ]; then
+	exec "/usr/lib/webcord/webcord" "$@"
+fi
+
+exec "/usr/lib/webcord/webcord" "$@" ${ELECTRON_FLAGS}
diff --git a/testing/webcord/local-electron.patch b/testing/webcord/local-electron.patch
new file mode 100644
index 00000000000..c61f38d9a64
--- /dev/null
+++ b/testing/webcord/local-electron.patch
@@ -0,0 +1,29 @@
+diff --git a/sources/code/build/forge.mts b/sources/code/build/forge.mts
+index 8cb9e3c..973b73e 100644
+--- a/sources/code/build/forge.mts
++++ b/sources/code/build/forge.mts
+@@ -33,6 +33,7 @@ import { PublisherGithub } from "@electron-forge/publisher-github";
+ // Plugins
+ 
+ import { FusesPlugin } from "@electron-forge/plugin-fuses";
++import { LocalElectronPlugin } from "@electron-forge/plugin-local-electron";
+ 
+ // Constrains
+ 
+@@ -243,6 +244,9 @@ const config:ForgeConfig = {
+       [FuseV1Options.EnableNodeOptionsEnvironmentVariable]: getBuildID() === "devel",
+       [FuseV1Options.EnableNodeCliInspectArguments]: getBuildID() === "devel",
+       [FuseV1Options.EnableCookieEncryption]: true
++    }),
++    new LocalElectronPlugin({
++      electronPath: "/usr/lib/electron"
+     })
+   ],
+   hooks: {
+@@ -275,4 +279,4 @@ const config:ForgeConfig = {
+ };
+ 
+ /* eslint-disable-next-line import/no-unused-modules *//* Module entry point */
+-export default config;
+\ No newline at end of file
++export default config;
-- 
2.44.0