Remove Tools section from mod loader page
This commit is contained in:
@@ -18,7 +18,6 @@ A GitHub Actions workflow runs every 6 hours, on every push to `main`, and on de
|
||||
|
||||
- finds every repo owned by the account with the `sotf-mod` topic and mirrors the zip from its latest release
|
||||
- mirrors the latest RedLoader release
|
||||
- lists repos with the `sotf-tool` topic under Tools
|
||||
- publishes everything with a `manifest.json` to GitHub Pages
|
||||
|
||||
The page writes files straight into the game folder using the browser's File System Access API.
|
||||
@@ -26,7 +25,7 @@ The page writes files straight into the game folder using the browser's File Sys
|
||||
## Setup
|
||||
|
||||
1. Settings, Pages, Source: **GitHub Actions**.
|
||||
2. Add the `sotf-mod` topic to each mod repo and `sotf-tool` to each tool repo.
|
||||
2. Add the `sotf-mod` topic to each mod repo.
|
||||
3. Actions, **Build and deploy**, **Run workflow**.
|
||||
|
||||
## Mod release requirements
|
||||
|
||||
@@ -13,7 +13,6 @@ OWNER = os.environ.get("OWNER", "JustinOros")
|
||||
TOKEN = os.environ.get("GITHUB_TOKEN", "")
|
||||
REDLOADER_REPO = "ToniMacaroni/RedLoader"
|
||||
MOD_TOPIC = "sotf-mod"
|
||||
TOOL_TOPIC = "sotf-tool"
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
SITE_SRC = ROOT / "site"
|
||||
OUT = ROOT / "_site"
|
||||
@@ -188,47 +187,27 @@ def build_redloader():
|
||||
}
|
||||
|
||||
|
||||
def build_tool(repo):
|
||||
if repo.get("homepage"):
|
||||
url = repo["homepage"]
|
||||
elif repo.get("has_pages"):
|
||||
url = f"https://{OWNER.lower()}.github.io/{repo['name']}/"
|
||||
else:
|
||||
url = repo["html_url"]
|
||||
print(f"tool {repo['name']}")
|
||||
return {
|
||||
"name": repo["name"],
|
||||
"description": repo.get("description") or "",
|
||||
"url": url,
|
||||
"repo": repo["html_url"],
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
if OUT.exists():
|
||||
shutil.rmtree(OUT)
|
||||
shutil.copytree(SITE_SRC, OUT)
|
||||
mods = []
|
||||
tools = []
|
||||
for repo in sorted(list_repos(), key=lambda r: r["name"].lower()):
|
||||
topics = repo.get("topics") or []
|
||||
if MOD_TOPIC in topics:
|
||||
entry = build_mod(repo)
|
||||
if entry:
|
||||
mods.append(entry)
|
||||
elif TOOL_TOPIC in topics:
|
||||
tools.append(build_tool(repo))
|
||||
redloader = build_redloader()
|
||||
manifest = {
|
||||
"generated": datetime.now(timezone.utc).isoformat(timespec="seconds"),
|
||||
"owner": OWNER,
|
||||
"redloader": redloader,
|
||||
"mods": mods,
|
||||
"tools": tools,
|
||||
}
|
||||
(OUT / "manifest.json").write_text(json.dumps(manifest, indent=2), encoding="utf-8")
|
||||
(OUT / ".nojekyll").write_text("", encoding="utf-8")
|
||||
print(f"done: {len(mods)} mods, {len(tools)} tools")
|
||||
print(f"done: {len(mods)} mods")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
-23
@@ -462,28 +462,6 @@ function renderMods() {
|
||||
node.replaceChildren(head, ...notes, el("ul", { class: "rows" }, mods.map(modRow)));
|
||||
}
|
||||
|
||||
function renderTools() {
|
||||
const node = $("tools");
|
||||
const tools = state.manifest.tools || [];
|
||||
node.hidden = !tools.length;
|
||||
if (!tools.length) return;
|
||||
node.classList.add("tools");
|
||||
node.replaceChildren(
|
||||
el("div", { class: "block-head" }, el("h2", { id: "tools-title" }, "Tools")),
|
||||
el("ul", { class: "rows" },
|
||||
tools.map((tool) =>
|
||||
el("li", { class: "row" },
|
||||
el("div", {},
|
||||
el("h3", {}, el("a", { href: tool.url, target: "_blank", rel: "noopener" }, tool.name)),
|
||||
tool.description ? el("p", { class: "desc" }, tool.description) : null,
|
||||
el("p", { class: "meta" }, el("a", { href: tool.repo, target: "_blank", rel: "noopener" }, "Source")),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function renderFooter() {
|
||||
const { owner, generated, redloader } = state.manifest;
|
||||
const updated = generated ? new Date(generated).toLocaleString() : "unknown";
|
||||
@@ -502,7 +480,6 @@ function render() {
|
||||
renderFolder();
|
||||
renderRedloader();
|
||||
renderMods();
|
||||
renderTools();
|
||||
renderFooter();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
<section id="folder" class="folder" aria-label="Game folder"></section>
|
||||
<section id="redloader" class="block" aria-labelledby="redloader-title" hidden></section>
|
||||
<section id="mods" class="block" aria-labelledby="mods-title"></section>
|
||||
<section id="tools" class="block" aria-labelledby="tools-title" hidden></section>
|
||||
<p id="status" class="status" role="status" aria-live="polite"></p>
|
||||
<footer id="footer" class="footer"></footer>
|
||||
</main>
|
||||
|
||||
@@ -255,10 +255,6 @@ button:disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.tools .row {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.status {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
|
||||
Reference in New Issue
Block a user