diff --git a/.forgejo/scripts/update-wiki.py b/.forgejo/scripts/update-wiki.py
new file mode 100644
index 0000000..568b0e7
--- /dev/null
+++ b/.forgejo/scripts/update-wiki.py
@@ -0,0 +1,11 @@
+--2024-09-29 17:54:28-- https://git.lgbt/root/posspack/raw/branch/mistress/.forgejo/scripts/update-wiki.py
+Resolving git.lgbt (git.lgbt)... 213.66.116.217
+Connecting to git.lgbt (git.lgbt)|213.66.116.217|:443... connected.
+HTTP request sent, awaiting response... 200 OK
+Length: 3328 (3.2K) [text/plain]
+Saving to: ‘update-wiki.py’
+
+ 0K ... 100% 677M=0s
+
+2024-09-29 17:54:28 (677 MB/s) - ‘update-wiki.py’ saved [3328/3328]
+
diff --git a/.forgejo/update-wiki.py b/.forgejo/update-wiki.py
new file mode 100644
index 0000000..1c75c41
--- /dev/null
+++ b/.forgejo/update-wiki.py
@@ -0,0 +1,123 @@
+#!/usr/bin/env python
+
+from pip._vendor import requests
+from pip._vendor import tomli
+import json
+import glob
+import os
+
+mods = dict()
+count = dict()
+count["server"] = 0
+count["client"] = 0
+count["both"] = 0
+
+cache = dict()
+
+if os.path.isfile("cache/licenses.json"):
+ with open("cache/licenses.json", "r") as f:
+ cache = json.load(f)
+
+for mod in glob.glob("pack/mods/*.toml"):
+ with open(mod, "r") as f:
+ data = tomli.load(f)
+ moddata = dict()
+ moddata["name"] = data["name"]
+ moddata["url"] = ""
+ moddata["side"] = data["side"]
+ license = dict()
+
+ if "modrinth" in data["update"]:
+ id = data["update"]["modrinth"]["mod-id"]
+ moddata["id"] = id
+ moddata["url"] = "https://modrinth.com/mod/" + id
+ moddata["site"] = "Modrinth"
+
+ if id in cache:
+ data = cache[id]
+ else:
+ data = requests.get("https://api.modrinth.com/v2/project/" + id).json()["license"]
+ cache[id] = data
+ moddata["license"] = data
+ elif "curseforge" in data["update"]:
+ moddata["url"] = "https://legacy.curseforge.com/projects/" + str(data["update"]["curseforge"]["project-id"])
+ moddata["site"] = "CurseForge"
+
+ count[moddata["side"]] += 1
+ mods[moddata["name"]] = moddata
+
+with open("wiki/Modlist.md", "w") as f:
+ f.write("## Total Count\r\n")
+ f.write("
")
+ f.write("\r\n")
+ f.write("Side | ")
+ f.write("Count | ")
+ f.write("
\r\n")
+
+ f.write("")
+ f.write("Total | ")
+ f.write("" + str(count["server"] + count["client"] + count["both"]) + " | ")
+ f.write("
\r\n")
+
+ f.write("")
+ f.write("Shared | ")
+ f.write("" + str(count["both"]) + " | ")
+ f.write("
\r\n")
+
+ f.write("")
+ f.write("Client | ")
+ f.write("" + str(count["client"]) + " | ")
+ f.write("
\r\n")
+
+ f.write("")
+ f.write("Server | ")
+ f.write("" + str(count["server"]) + " | ")
+ f.write("
\r\n")
+
+ f.write("
\r\n\r\n")
+
+ f.write("## Individual Mods\r\n")
+ f.write("")
+ f.write("\r\n")
+ f.write("Name | ")
+ f.write("Side | ")
+ f.write("Link | ")
+ f.write("
\r\n")
+
+ for mod in mods:
+ data = mods[mod]
+ f.write("\r\n")
+ f.write("" + mod + " | ")
+ f.write("" + data["side"] + " | ")
+ if data["url"] != "":
+ f.write("" + data["site"] + " | ")
+ else:
+ f.write("N/A | ")
+ f.write("\r\n
")
+ f.write("\r\n
")
+
+with open("wiki/Licenses.md", "w") as f:
+ for mod in mods:
+ data = mods[mod]
+ f.write("## " + mod + "\r\n")
+ f.write("")
+ if data["site"] == "CurseForge":
+ f.write("CurseForge API does not provide license information, see mod page for details.")
+ elif "license" in data:
+ license = data["license"]
+ if license["name"] == "":
+ if license["id"] == "LicenseRef-Custom":
+ license["name"] = "Custom"
+ else:
+ license["name"] = license["id"][11:].replace("-", " ")
+
+ if license["url"] != None:
+ f.write("" + license["name"] + "")
+ else:
+ f.write(license["name"])
+ else:
+ f.write("Unknown")
+ f.write("\r\n")
+
+with open("cache/licenses.json", "w") as f:
+ json.dump(cache, f)
diff --git a/.forgejo/workflows/update-wiki.yaml b/.forgejo/workflows/update-wiki.yaml
new file mode 100644
index 0000000..604fad4
--- /dev/null
+++ b/.forgejo/workflows/update-wiki.yaml
@@ -0,0 +1,44 @@
+on: [push]
+name: "Update wiki"
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - name: "Clone modpack"
+ uses: actions/checkout@v3
+ with:
+ repository: "root/posspack"
+ path: "pack"
+
+ - name: "Clone wiki"
+ uses: actions/checkout@v3
+ with:
+ repository: "root/posspack.wiki"
+ path: "wiki"
+ ref: "main"
+
+ - name: Restore cached licenses
+ id: cache-licenses-restore
+ uses: actions/cache/restore@v4
+ with:
+ path: cache
+ key: licenses
+
+ - name: "Update modlist"
+ run: python pack/.forgejo/scripts/update-wiki.py
+
+ - name: Save cached licenses
+ id: cache-licenses-save
+ uses: actions/cache/save@v4
+ with:
+ path: cache
+ key: ${{ steps.cache-licenses-restore.outputs.cache-primary-key }}
+
+ - name: "Commit changes"
+ run: |
+ cd wiki
+ git add .
+ git config --global user.name 'PossPack Wiki Updater'
+ git config --global user.email 'root@possum.city'
+ git commit -am "Automated wiki update"
+ git push