#!/usr/bin/env python3 # SPDX-License-Identifier: LicenseRef-Starship-1.0 # Copyright (c) 2023-2026 Robert A. James """build.py -- the starshipos-f18.com XWiki pages, made from the "StarshipOS.com" design canvas. site/com/build.py [--release TAG --sums SHA256SUMS] canvas/{Main,Inquiries,TryIt}.dc.html -> {Main,Inquiries,TryIt}.WebHome.xwiki, and with a release, canvas/{Downloads,Documents}.dc.html too The canvas is the source: its artboards are copied into canvas/ as they are, and this turns each into one {{html}} block (which needs a page author with script rights). What changes on the way: - the accent hole becomes its default colour, and the canvas's links become the wiki's pages (Main.dc.html -> /bin/view/Main/, ...) and the real domains (starshipos.org -> starshipos-f18.org); - the two images become attachments of Main.WebHome (badge.jpg, captain-bob.jpg -- web-size copies of the canvas's uploads); - Try it: the drawn console becomes the real one, an iframe of try.starshipos-f18.com; - the inquiry form posts to the .org's PublicInquiry, which files it under Inquiries there (admin-only, site/org/inquiries); the announcements form, which has no server, sends by e-mail; - Downloads and Documents (#126, #157) are built from a release: --release TAG and the release's SHA256SUMS fill in [TAG], [RELEASE]/ (the file on the Gitea release) and [SHA:]. Without a release they are not built, and the other pages' links to them are taken out, so nothing on the site points at a page that is not there (they go live with alpha.4); install.sh puts the pages and the images on the wiki. """ import os import re import sys sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) import colorlock # noqa: E402 the design's colours over the wiki's high-contrast theme ACCENT = "#F5891F" FONTS = ('\n' '') ORG = "https://starshipos-f18.org/" PAGES = ["Main", "Inquiries", "TryIt"] RELEASE_PAGES = ["Downloads", "Documents"] RELEASES = "https://gitea.starshipos-f18.org/rajames/LithosAnanke/releases/download/" IMAGES = {"/_blob/5b564d54d98e02ad600c913a9a1888f2": "badge.jpg", "/_blob/5483451f292782a8b366e437181c4bcf": "captain-bob.jpg"} CONSOLE = '''
StarshipOS · amd64 · your session try.starshipos-f18.com

If the console does not connect, every machine is in use: try again in a few minutes.

''' def body(src, pages): m = re.search(r"(.*)", src, re.S) html = re.sub(r".*?", "", m.group(1), flags=re.S).strip() html = html.replace("{{accent}}", ACCENT) # a page not built this time is not linked to: its taken out (the nav, the footers) for p in RELEASE_PAGES: if p not in pages: html = re.sub(r']*>[^<]*\n?' % p, "", html) for p in pages: html = html.replace('href="%s.dc.html"' % p, 'href="/bin/view/%s/"' % p) html = html.replace('href="https://starshipos.org"', 'href="%s"' % ORG) html = html.replace(">starshipos.org", ">starshipos-f18.org") html = html.replace("on starshipos.org.", "on starshipos-f18.org.") for blob, name in IMAGES.items(): html = html.replace('src="%s"' % blob, 'src="/bin/download/Main/WebHome/%s"' % name) html = html.replace("min-height: 100vh", "min-height: 0") # inside the wiki's page, not a screen return html def try_it(html): start = html.index('
", html.index("[LIVE CONSOLE]")) + len("

") return html[:start] + CONSOLE + html[end:] def forms(html, page): if page == "Main": html = html.replace('
', '') html = html.replace('', '\n' '
', 1) for i, n in (("q-name", "name"), ("q-email", "email"), ("q-org", "organization"), ("q-topic", "topic"), ("q-msg", "message"), ("q-list", "announcements")): html = html.replace('id="%s"' % i, 'id="%s" name="%s"' % (i, n), 1) html = html.replace('