phigros.tools

Publishing a mod

Players install mods from the Mods tab of the game's settings: the mods of the catalog, and any other GitHub repository from its link. A mod is a public GitHub repository, and what's installed is its latest release.

The release

Asset
mod.zipThe mod's folder: init.lua at its root (or inside one top folder) with its other files
mod.luaInstead of the zip, for a mod made of one file
mod.zip.sig, mod.lua.sigYour signature of the asset, needed for the catalog

There's no manifest: the repository's name is the mod's name, the release's tag its version, and the README describes it. The zip is at most 32 MB, 64 MB unpacked in 512 files.

The mod is installed in phigros++/installed/<owner>/<name>/, which each new release replaces whole. Keep what your mod saves in setting() or elsewhere under phigrospp.root.

local sprite = image("logo.png")      -- files are found next to the file naming them, as in mods/
local util = require("util")          -- util.lua of your mod's own folder, before any other mod's
local dir = phigrospp.dir()           -- your mod's folder, for anything else

Write it with node mod.mjs push --watch (Your first mod): it runs the same once installed.

Signing

node mod.mjs keygen
MOD_KEY=<seed> node mod.mjs sign <owner>/<repo> <tag> mod.zip

mod.mjs (Your first mod) only needs node. keygen prints a new Ed25519 key: keep the seed secret, the public half is what players' games check. Signing writes mod.zip.sig: your public key, then the signature of the repository, the tag and the asset's SHA-512, so it's only good for this release of this mod.

A mod made with node mod.mjs new has the workflow that releases it: put the seed in the repository's MOD_KEY secret, and each tag pushed becomes a signed release of the repository's files, without its dot files and README.

The catalog

Open a pull request on registry.txt adding your key once and a line per mod, in lowercase:

<owner>:<your public key>
<owner>/<repo>

Once it's merged, phigros.tools follows the repository: a new release shows in the game and on phigros.tools/mods within a quarter of an hour, with no other pull request, or at once after curl -X POST https://phigros.tools/api/catalog (the workflow of node mod.mjs new runs it). A release that isn't signed by your key is never listed, and the game refuses it too.

ShownComes from
NameThe README's title, else the repository's name
Author, starsThe repository
Version, sizeThe latest release and its asset
DescriptionThe README's text between its title and its next heading
PreviewThe README's first video, GIF or image hosted on GitHub: a file of the repository, or one dropped into the README on github.com. A video or a GIF plays as a short muted clip

The README in the game

A mod's page shows its README under its preview, name and buttons. The game draws:

HeadingsThree sizes, a line under the two biggest. The title isn't repeated, it's the mod's name
TextBold, italic, code and links. A link opens the browser, one to phigrospp://install/ asks to install that mod
Lists, quotes, code blocks, rulesAs they read
TablesA line per row: its first cell in bold, then the others
Images, GIFs, videosUp to 8, PNG, JPEG, WebP, GIF, MP4, MOV or WebM hosted on GitHub. The first two videos or GIFs play, the others show their first frame. The one that is the preview isn't shown twice

Other HTML is dropped and its text kept. The README is read up to 12000 characters.

A Settings button opens the tab your mod put its settings in, when it has any.

phigrospp://install/<owner>/<repo> opens the game on the mod, from a README or a web page.

Mods outside the catalog

"Install from GitHub" in the Mods tab installs the repository whose link is in the clipboard, and so does a phigrospp://install/ link. The player is warned that nobody reviewed the mod. Its release doesn't have to be signed, but once a signed one was installed, the next ones must be signed by the same key.