yoink-emoji/README.rst

63 lines
2 KiB
ReStructuredText
Raw Normal View History

2024-09-25 15:28:30 +00:00
===========
Yoink-Emoji
===========
Lets you yoink emoji packs from any other instance with MastoAPI suppport,
instead of only shareable packs from other \*oma instances like admin-fe does.
Note this currently might not work as well for updating packs not created by this script.
It expects files t be named after their shortocde, if an meoji already exists but with
a different filename this will leave duplicate images behind.
*(shortocde names are checked to be safe wrt to path traversal before writing anything)*
Installing
==========
Just plop the script somewhere.
A ``.cache`` for remote emoji data will be created at the script location.
*(Caches remain valid within the same UTC day, currently not cleaned up automatically so just `rm -fr .cache` from time to time if it becomes too big)*
Usage
=====
Enter the emoji pack dir (or create an new empty dir for this), then incoke the script;
the third argument is optional:
```
yoink-or-update-emoj.sh domain_of_server_to_be_yoinked_from category_to yoink [additional_conditions]
```
Additionally the follwoing env vars affect the result:
- ``OVERWRITE_IMG=YES``: overwrite existing images instead of skipping download
- ``OVERWRITE_METAKEYS=YES``: overwrite existing shortcode file path entries instead of preserving the original
Example
-------
Yoinking the blobcat pack from an Akkoma instance and also merge any blobcat emotes from another category into the local pack:
```sh
yoink-or-update-emoji.sh example.org "pack:blobcat" 'or (.shortcode | test("blobcatpnd|^ameow|^blobcat|^ablobcat"))'
```
Yoink woozy pack from a Sharkey instance *(no ``pack:`` prefix)*:
```sh
yoink-or-update-emoji.sh example.org "woozy"
```
Merge multiple remote packs into one local pack:
```sh
yoink-or-update-emoji.sh example.org "pack:touhou" 'or .category == "pack:reimu" or .category == "pack:marisa"'
```
Dependencies
============
- POSIX ``sh`` and ``awk`` _(in general all POSIX tools)_
- ``date`` with ``-I`` extension
- jq
- wget **and** curl _(idk why i used both, might remove one at some point)_
- ``mktemp``