Configurations and other related files for Starlight Network infrastructure, made openly available.
1#!/usr/bin/env fish
2
3# This can be used to generate the correct `CUSTOM_EMOJIS = …` config flag based on a directory. it supports sub-directories too.
4# Once generated and pasted, paste your emoji to $CUSTOM_PATH/public/assets/img/emoji/*.png
5# By default this is /var/lib/forgejo/custom/public/assets/img/emoji
6
7function help
8 printf %s\n "just run forgejo_emotes.fish <path to emoji>"
9end
10
11function generate_emoji
12 # the fact that I have to do this roundabout way of passing around data is a testament to how
13 # I don't fully understand fish yet. Piping didn't work.
14 set prelist (string split -r -f 2 -m1 / $argv[1]/**)
15 set midlist (string split -r -f 1 -m1 . $prelist)
16 set emojilist (string join ', ' $midlist)
17 echo "copy below here ↓"
18 printf %s\n "[ui]" "CUSTOM_EMOJIS = $emojilist"
19 echo "copy above here ↑"
20end
21
22switch $argv
23 case set -ql $_flag_h
24 help
25 case set -ql $argv[1]
26 generate_emoji $argv
27 case '*'
28 help
29end