Remove Tools section from mod loader page
This commit is contained in:
1 parent
85ad3dde82
commit
df59c7edbb
5 files changed
+2
-52
No files matched your search
@@ -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
|
- 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
|
- mirrors the latest RedLoader release
|
||||||
- lists repos with the `sotf-tool` topic under Tools
|
|
||||||
- publishes everything with a `manifest.json` to GitHub Pages
|
- 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.
|
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
|
## Setup
|
||||||
|
|
||||||
1. Settings, Pages, Source: **GitHub Actions**.
|
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**.
|
3. Actions, **Build and deploy**, **Run workflow**.
|
||||||
|
|
||||||
## Mod release requirements
|
## Mod release requirements
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ OWNER = os.environ.get("OWNER", "JustinOros")
|
|||||||
TOKEN = os.environ.get("GITHUB_TOKEN", "")
|
TOKEN = os.environ.get("GITHUB_TOKEN", "")
|
||||||
REDLOADER_REPO = "ToniMacaroni/RedLoader"
|
REDLOADER_REPO = "ToniMacaroni/RedLoader"
|
||||||
MOD_TOPIC = "sotf-mod"
|
MOD_TOPIC = "sotf-mod"
|
||||||
TOOL_TOPIC = "sotf-tool"
|
|
||||||
ROOT = Path(__file__).resolve().parent
|
ROOT = Path(__file__).resolve().parent
|
||||||
SITE_SRC = ROOT / "site"
|
SITE_SRC = ROOT / "site"
|
||||||
OUT = 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():
|
def main():
|
||||||
if OUT.exists():
|
if OUT.exists():
|
||||||
shutil.rmtree(OUT)
|
shutil.rmtree(OUT)
|
||||||
shutil.copytree(SITE_SRC, OUT)
|
shutil.copytree(SITE_SRC, OUT)
|
||||||
mods = []
|
mods = []
|
||||||
tools = []
|
|
||||||
for repo in sorted(list_repos(), key=lambda r: r["name"].lower()):
|
for repo in sorted(list_repos(), key=lambda r: r["name"].lower()):
|
||||||
topics = repo.get("topics") or []
|
topics = repo.get("topics") or []
|
||||||
if MOD_TOPIC in topics:
|
if MOD_TOPIC in topics:
|
||||||
entry = build_mod(repo)
|
entry = build_mod(repo)
|
||||||
if entry:
|
if entry:
|
||||||
mods.append(entry)
|
mods.append(entry)
|
||||||
elif TOOL_TOPIC in topics:
|
|
||||||
tools.append(build_tool(repo))
|
|
||||||
redloader = build_redloader()
|
redloader = build_redloader()
|
||||||
manifest = {
|
manifest = {
|
||||||
"generated": datetime.now(timezone.utc).isoformat(timespec="seconds"),
|
"generated": datetime.now(timezone.utc).isoformat(timespec="seconds"),
|
||||||
"owner": OWNER,
|
"owner": OWNER,
|
||||||
"redloader": redloader,
|
"redloader": redloader,
|
||||||
"mods": mods,
|
"mods": mods,
|
||||||
"tools": tools,
|
|
||||||
}
|
}
|
||||||
(OUT / "manifest.json").write_text(json.dumps(manifest, indent=2), encoding="utf-8")
|
(OUT / "manifest.json").write_text(json.dumps(manifest, indent=2), encoding="utf-8")
|
||||||
(OUT / ".nojekyll").write_text("", 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__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
-23
@@ -462,28 +462,6 @@ function renderMods() {
|
|||||||
node.replaceChildren(head, ...notes, el("ul", { class: "rows" }, mods.map(modRow)));
|
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() {
|
function renderFooter() {
|
||||||
const { owner, generated, redloader } = state.manifest;
|
const { owner, generated, redloader } = state.manifest;
|
||||||
const updated = generated ? new Date(generated).toLocaleString() : "unknown";
|
const updated = generated ? new Date(generated).toLocaleString() : "unknown";
|
||||||
@@ -502,7 +480,6 @@ function render() {
|
|||||||
renderFolder();
|
renderFolder();
|
||||||
renderRedloader();
|
renderRedloader();
|
||||||
renderMods();
|
renderMods();
|
||||||
renderTools();
|
|
||||||
renderFooter();
|
renderFooter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
<section id="folder" class="folder" aria-label="Game folder"></section>
|
<section id="folder" class="folder" aria-label="Game folder"></section>
|
||||||
<section id="redloader" class="block" aria-labelledby="redloader-title" hidden></section>
|
<section id="redloader" class="block" aria-labelledby="redloader-title" hidden></section>
|
||||||
<section id="mods" class="block" aria-labelledby="mods-title"></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>
|
<p id="status" class="status" role="status" aria-live="polite"></p>
|
||||||
<footer id="footer" class="footer"></footer>
|
<footer id="footer" class="footer"></footer>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -255,10 +255,6 @@ button:disabled {
|
|||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tools .row {
|
|
||||||
grid-template-columns: minmax(0, 1fr);
|
|
||||||
}
|
|
||||||
|
|
||||||
.status {
|
.status {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|||||||
Reference in new issue
Block a user