Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them.
Page: /drakestapleton/aienos.com/blob/main/scripts/floor-shell.py
# aienos.com
Source of www.aienos.com, served from my own hardware
Brought by drakestapleton
Sign in to star 0 stars 0 watching
About Files History Releases Proposed changes Issues For developers
branch `main` Branches Tags History
`aienos.com / scripts / floor-shell.py`
97 lines ยท 7465 bytes Raw Blame History
1 #!/usr/bin/env python3
2 """The homepage floor shell is the exact public /now/ document of the installed
3 floor, with three preview changes. Python is tooling and verification only; the
4 site build reads the generated `text ffdoc` line in om/site/floor.om.
5
6 python3 scripts/floor-shell.py emit NOW print the ffdoc line for NOW
7 python3 scripts/floor-shell.py check DIST NOW DIST/index.html embeds exactly that shell
8
9 NOW is a file or an http(s) URL of the public /now/ page of the floor release
10 that ships with the site (https://www.aienos.com/now/ once installed). Floor
11 markup and /now/*.js change together, so a stale shell breaks the live preview
12 (2026-11-09: renderStats wrote to #sPower after the floor removed it). Run
13 `check` against the live /now/ before every site release and after every floor
14 install; regenerate with `emit` when it fails.
15
16 Preview changes: after the charset, relative asset paths
17 made /now/ absolute, the preview style after the stylesheets, and em dashes
18 written as hyphens (site copy rule). The preview style (r6, 2026-11-10) also
19 gives phones (600 px and below) one head row: the Live/Still/More controls sit
20 on the line's eyebrow row with the live text kept for screen readers, the zoom
21 group sits on the frame's top right, the line draws at its design size (100%)
22 with native horizontal pan, and the station list is one aligned column; every
23 width gets 150 ms colour/opacity states, a pressed state and a 2px focus ring.
24 Interaction states (AienosStates, 2026-11-11, measured with real pointer input):
25 the selected Live/Still segment dims on hover, the Rescue and operator summaries
26 take the station hover fill, and stations, queue summaries, those summaries and
27 the selected segment answer a press with opacity.
28 """
29 import hashlib
30 import html
31 import re
32 import sys
33 import urllib.request
34 from pathlib import Path
35
36 PREVIEW_STYLE = """
52 """
53
54
55 def fetch(now):
56 if now.startswith(('http://', 'https://')):
57 with urllib.request.urlopen(now, timeout=30) as r:
58 return r.read().decode('utf-8')
59 return Path(now).read_text()
60
61
62 def shell(source):
63 assert 'data-mode="public"' in source and '\n', '\n\n', 1)
67 out = re.sub(r'(<(?:link|script|img)\b[^>]*?\b(?:href|src)=")(?![a-z]+:|/|#)', r'\1/now/', out)
68 links = list(re.finditer(r']*>\n', out))
69 assert links and '' in out, 'stylesheets and charset expected'
70 end = links[-1].end()
71 out = out[:end] + PREVIEW_STYLE + out[end:]
72 return out.replace('\u2014', '-').replace('\u2013', '-')
73
74
75 def omega_line(doc):
76 return 'text ffdoc "' + doc.replace('"', '\\"').replace('\n', '\\n') + '"'
77
78
79 if __name__ == '__main__':
80 mode = sys.argv[1] if len(sys.argv) > 1 else ''
81 if mode == 'emit' and len(sys.argv) == 3:
82 doc = shell(fetch(sys.argv[2]))
83 print(f'note Embedded public-only ffdoc literal: {len(doc.encode())} bytes, sha256 {hashlib.sha256(doc.encode()).hexdigest()}. Generated by scripts/floor-shell.py from the public /now/ document.')
84 print(omega_line(doc))
85 elif mode == 'check' and len(sys.argv) == 4:
86 doc = shell(fetch(sys.argv[3]))
87 index = (Path(sys.argv[2]) / 'index.html').read_text()
88 found = re.search(r'data-floor-srcdoc="([^"]*)"', index)
89 assert found, 'no embedded floor shell'
90 embedded = html.unescape(found.group(1))
91 if embedded != doc:
92 want = set(re.findall(r'id="([^"]+)"', doc))
93 have = set(re.findall(r'id="([^"]+)"', embedded))
94 sys.exit(f'FLOOR-SHELL STALE: embedded shell differs from {sys.argv[3]}; ids missing {sorted(want - have)}, extra {sorted(have - want)}')
95 print(f'FLOOR-SHELL PASS: embedded shell equals the public /now/ document of {sys.argv[3]} ({len(doc.encode())} bytes, sha256 {hashlib.sha256(doc.encode()).hexdigest()[:16]})')
96 else:
97 sys.exit(__doc__)