summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorXiretza2022-05-23 18:34:00 +0200
committerXiretza2022-05-23 19:00:14 +0200
commit29cfb68e8c1e9dfcdbb8ae96cd2e072bb13d03c3 (patch)
tree61f8016e0835126b3ed5d92e186c48b27c30dec0
downloadaur-stickerpicker-git.tar.gz
Initial commit
-rw-r--r--.SRCINFO32
-rw-r--r--0001-Change-default-dirs-to-point-to-package-directories.patch37
-rw-r--r--PKGBUILD72
-rw-r--r--nginx.conf12
-rw-r--r--stickerpicker.tmpfiles2
5 files changed, 155 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..d93c3550a7ce
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,32 @@
+pkgbase = stickerpicker-git
+ pkgdesc = Element sticker picker widget
+ pkgver = r78.99ced88
+ pkgrel = 1
+ url = https://github.com/maunium/stickerpicker
+ arch = any
+ license = AGPL3
+ checkdepends = python-pytest
+ makedepends = git
+ makedepends = python-build
+ makedepends = python-installer
+ makedepends = python-wheel
+ makedepends = python-setuptools
+ depends = python
+ depends = python-aiohttp
+ depends = python-yarl
+ depends = python-pillow
+ depends = python-telethon
+ depends = python-cryptg
+ depends = python-magic
+ provides = stickerpicker=r78.99ced88
+ conflicts = stickerpicker
+ source = git+https://github.com/maunium/stickerpicker.git
+ source = 0001-Change-default-dirs-to-point-to-package-directories.patch
+ source = stickerpicker.tmpfiles
+ source = nginx.conf
+ sha256sums = SKIP
+ sha256sums = c314dffebf5cc36d1dde79cf49eca20c1823167a1917f31504e940ae40446b92
+ sha256sums = 41df176c7557a0c632ed4c3b3473dc2660ccbb2fde3a4a14c2e40e52f5632902
+ sha256sums = 0ae7588129d7d9cc594a41b3ec79a9bed2f7b7b23b3e815dde2860c053c28805
+
+pkgname = stickerpicker-git
diff --git a/0001-Change-default-dirs-to-point-to-package-directories.patch b/0001-Change-default-dirs-to-point-to-package-directories.patch
new file mode 100644
index 000000000000..2925a6744aa1
--- /dev/null
+++ b/0001-Change-default-dirs-to-point-to-package-directories.patch
@@ -0,0 +1,37 @@
+From 210955f20b8a2a6d78db451d10d02838ec8b15f5 Mon Sep 17 00:00:00 2001
+From: Xiretza <xiretza@xiretza.xyz>
+Date: Mon, 23 May 2022 17:59:56 +0200
+Subject: [PATCH] Change default dirs to point to package directories
+
+---
+ sticker/stickerimport.py | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/sticker/stickerimport.py b/sticker/stickerimport.py
+index f153e98..2bcb30a 100644
+--- a/sticker/stickerimport.py
++++ b/sticker/stickerimport.py
+@@ -29,6 +29,9 @@ from telethon.tl.types.messages import StickerSet as StickerSetFull
+ from .lib import matrix, util
+
+
++DEFAULT_CONFIG_FILE = "/etc/webapps/stickerpicker/config.json"
++DEFAULT_PACK_DIR = "/var/lib/stickerpicker/packs/"
++
+ async def reupload_document(client: TelegramClient, document: Document) -> matrix.StickerInfo:
+ print(f"Reuploading {document.id}", end="", flush=True)
+ data = await client.download_media(document, file=bytes)
+@@ -124,8 +127,8 @@ parser.add_argument("--list", help="List your saved sticker packs", action="stor
+ parser.add_argument("--session", help="Telethon session file name", default="sticker-import")
+ parser.add_argument("--config",
+ help="Path to JSON file with Matrix homeserver and access_token",
+- type=str, default="config.json")
+-parser.add_argument("--output-dir", help="Directory to write packs to", default="web/packs/",
++ type=str, default=DEFAULT_CONFIG_FILE)
++parser.add_argument("--output-dir", help="Directory to write packs to", default=DEFAULT_PACK_DIR,
+ type=str)
+ parser.add_argument("pack", help="Sticker pack URLs to import", action="append", nargs="*")
+
+--
+2.36.1
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..c6a1ff3bf676
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,72 @@
+# Maintainer: xiretza <xiretza+aur@xiretza.xyz>
+
+_pkgname=stickerpicker
+pkgname="$_pkgname-git"
+pkgver=r78.99ced88
+pkgrel=1
+pkgdesc="Element sticker picker widget"
+arch=(any)
+url="https://github.com/maunium/$_pkgname"
+license=('AGPL3')
+depends=(
+ 'python'
+ 'python-aiohttp'
+ 'python-yarl'
+ 'python-pillow'
+ 'python-telethon'
+ 'python-cryptg'
+ 'python-magic'
+)
+makedepends=('git' 'python-build' 'python-installer' 'python-wheel' 'python-setuptools')
+checkdepends=('python-pytest')
+provides=("$_pkgname=$pkgver")
+conflicts=("$_pkgname")
+source=(
+ "git+$url.git"
+ "0001-Change-default-dirs-to-point-to-package-directories.patch"
+ "stickerpicker.tmpfiles"
+ "nginx.conf"
+)
+sha256sums=('SKIP'
+ 'c314dffebf5cc36d1dde79cf49eca20c1823167a1917f31504e940ae40446b92'
+ '41df176c7557a0c632ed4c3b3473dc2660ccbb2fde3a4a14c2e40e52f5632902'
+ '0ae7588129d7d9cc594a41b3ec79a9bed2f7b7b23b3e815dde2860c053c28805')
+
+pkgver() {
+ cd "$_pkgname"
+
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+}
+
+prepare() {
+ cd "$_pkgname"
+
+ patch -p1 < "$srcdir/0001-Change-default-dirs-to-point-to-package-directories.patch"
+}
+
+build() {
+ cd "$_pkgname"
+
+ python -m build --wheel --no-isolation
+}
+
+check() {
+ cd "$_pkgname"
+
+ # No tests
+ #pytest
+}
+
+package() {
+ cd "$_pkgname"
+
+ python -m installer --destdir="$pkgdir" dist/*.whl
+
+ install -Dm 655 "$srcdir/stickerpicker.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/$_pkgname.conf"
+ install -Dm 655 "$srcdir/nginx.conf" "$pkgdir/usr/share/doc/$_pkgname/nginx.example.conf"
+
+ install -dm 755 "$pkgdir/usr/share/webapps/$_pkgname"
+ cp -a web/* "$pkgdir/usr/share/webapps/$_pkgname"
+
+ install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/COPYING"
+}
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 000000000000..781af6b0c990
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,12 @@
+server {
+ server_name YOUR_HOSTNAME;
+ listen 80;
+ listen [::]:80;
+
+ root /usr/share/webapps/stickerpicker/;
+ index index.html;
+
+ location /packs {
+ root /var/lib/stickerpicker/;
+ }
+}
diff --git a/stickerpicker.tmpfiles b/stickerpicker.tmpfiles
new file mode 100644
index 000000000000..e34232eb93a1
--- /dev/null
+++ b/stickerpicker.tmpfiles
@@ -0,0 +1,2 @@
+d /etc/webapps/stickerpicker/ 0750
+d /var/lib/stickerpicker/packs/ 0755