Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / Backend (Go: vet, tests, a real ubusd and uhttpd) (push) Blocked by required conditions
CI / Package files (push) Blocked by required conditions
- **Backend rewritten in Go.** One daemon, `dawnlined`, replaces the whole ucode backend: the rpcd plugin, the agent, the CLI and the updater. The package no longer depends on ucode. - **Per-architecture builds.** The release carries the backend for arm64, ARMv7, mips, mipsle and amd64; the router fetches its own after the package is installed and checks its sha256. Dawnline does not run on other architectures (older ARM, 32-bit x86, RISC-V). - **Faster on the router.** A firewall sync takes 0.06 s instead of 0.9 s; a full apply takes about 300 ms. The portal is served by the daemon itself, without a CGI process per request. - **Live pages.** The admin and the portal follow a live stream from the router instead of re-fetching the whole state every 30 seconds. - **Admin redesigned in the portal's style.** Three sections (Overview · Log · Settings); a server is a page of its own with People, Places and Settings; a device opens as a dialog over its person. - **Changes wait for «Apply».** Every setting, and a person's access, is staged in one dock before it reaches the router. - **Configuration rollout.** After a change that makes devices fetch their configuration again, the admin shows how many have fetched it and who has not. Every setting shows beforehand (⟳N) how many devices it will touch. - **Waiting for a decision.** Overview and People put first the people who need one (access ended, limit reached, a device that does not connect), each with its one action a tap away. - **Bulk actions on people.** «Select» (or a long press on a card) picks several people to extend by a month, pause or resume at once. - **Undo.** An action done from a card or a request is undone from its toast. - **Update dialogs redesigned.** An update is one view from its question to its result; Dawnline's own update runs in it like every other, and the page reloads itself once the new version answers. Other versions are a list, each with its notes and Install on a page of its own. - **Site to site: networks behind a router.** A router connected as a device can have networks behind it (up to eight, /16 to /30): the server routes them and applies the router's access to them. A network that shares addresses with a tunnel, the router's own networks or another site is refused by name. - **Routers from the portal.** People can add a router and name its networks on their own page; the admin accepts or declines with a reason, or lets them through without asking. - **Check access and Health know the networks behind routers.** - **Usage limits reworked.** A monthly limit no longer follows the calendar. A person's month starts with their first traffic and ends a month later; the next one starts only when they connect again, so time away uses up none of it. Before, everyone's limit reset on the 1st. - Extra data lasts until that person's month ends; «Reset usage» starts the month anew. - A limit is for a month or for the whole term; the admin and the portal show when it resets. - Charts that said «this month» show the last 30 days. - After the update nobody loses what was counted: the month that was running becomes the person's first and ends on the 1st. - **Access by time of day removed.** The Hours limit is gone from the admin, the portal and the backend; saved hours are dropped. - **Expiry simplified.** An end date always stops access, with a heads-up three days before; the per-person choice is gone. - **No false disconnects from sleeping phones.** A phone or a tablet stays online through ten minutes of silence. - **Mobile Safari fixes.** Pressing a control no longer sends the page to its top; tab tracks that do not fit scroll; switches animate after a press.
138 lines
6.7 KiB
Python
Executable File
138 lines
6.7 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Frame the README screenshots the way the portal draws its own surfaces.
|
|
|
|
Raw captures live in docs/screenshots/raw/<name>.png at SCALE device pixels
|
|
per CSS pixel (the admin's taken from its pages over made-up answers, in the
|
|
Outline theme with its navbar on top; scripts/capture-portal.mjs takes the
|
|
portal's from its demo); the framed images
|
|
are written to docs/screenshots/<name>.png at the same scale. Each page sits on
|
|
a panel like the portal's sheets (#121212, radius 36, 16px around it, the page
|
|
inside at radius 20) on the portal's own black. A shot in ALONE is a dialog
|
|
captured by itself: it stands on that black with no panel. A shot in FLOWS gets its steps
|
|
in a row in front of the page's lower edge, numbered: sheets captured alone on
|
|
a transparent page (raw/<step>.png, FLOW_MARGIN around each). Needs a
|
|
Chromium-based browser for the headless render (BROWSER=/path/to/chrome,
|
|
default: Brave or Chrome on macOS).
|
|
Run: scripts/frame-screenshots.py [name ...] (all of them when no name is given)
|
|
"""
|
|
import os
|
|
import shutil
|
|
import struct
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
|
|
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
|
RAW = os.path.join(ROOT, 'docs', 'screenshots', 'raw')
|
|
OUT = os.path.join(ROOT, 'docs', 'screenshots')
|
|
|
|
SHOTS = ['people', 'person', 'places', 'core', 'device', 'portal',
|
|
'people-ru', 'person-ru', 'places-ru', 'core-ru', 'device-ru', 'portal-ru']
|
|
# name -> the steps in front of its page, in order (raw captures). The portal's come from its demo
|
|
# (scripts/capture-portal.mjs), not a router: adding a device there would add one. -ru: README_ru's.
|
|
FLOWS = {
|
|
'portal': ['portal-add-1', 'portal-add-2', 'portal-add-3'],
|
|
'portal-ru': ['portal-add-1-ru', 'portal-add-2-ru', 'portal-add-3-ru'],
|
|
}
|
|
# A dialog captured alone (transparent around it, FLOW_MARGIN on each side, as a step is): it stands on the canvas
|
|
# as it is, with no panel under it.
|
|
ALONE = {'device', 'device-ru'}
|
|
PAD_X, PAD_Y, INSET = 96, 80, 16 # canvas around the panel; panel around the page
|
|
FLOW_MARGIN = (56, 40, 56, 72) # around a step's sheet in its capture: left, top, right, bottom
|
|
STEP_GAP, STEP_OVER, STEP_PAD = 28, 150, 120 # between steps; how far they reach over the page; canvas beside them
|
|
SCALE = 2
|
|
|
|
CANDIDATES = [
|
|
os.environ.get('BROWSER', ''),
|
|
'/Applications/Brave Browser.app/Contents/MacOS/Brave Browser',
|
|
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
|
shutil.which('chromium') or '',
|
|
shutil.which('google-chrome') or '',
|
|
]
|
|
|
|
TEMPLATE = """<!doctype html><html><head><meta charset="utf-8"><style>
|
|
html,body{{margin:0;width:{w}px;height:{h}px;overflow:hidden}}
|
|
body{{position:relative;background:#080808}}
|
|
.panel{{position:absolute;
|
|
border-radius:36px;background:#121212;box-shadow:inset 0 0 0 1px rgba(255,255,255,.05),0 30px 80px rgba(0,0,0,.5)}}
|
|
.page{{position:absolute;display:block;border-radius:20px;
|
|
box-shadow:0 0 0 1px rgba(255,255,255,.04)}}
|
|
.sheet{{position:absolute;display:block;filter:drop-shadow(0 24px 48px rgba(0,0,0,.6))}}
|
|
.n{{position:absolute;width:34px;height:34px;border-radius:50%;display:grid;place-items:center;
|
|
font:600 16px system-ui,-apple-system,sans-serif;color:#ededed;background:#232323;
|
|
box-shadow:0 0 0 1px rgba(255,255,255,.12),0 6px 16px rgba(0,0,0,.5)}}
|
|
</style></head><body>{body}</body></html>"""
|
|
PAGE = '<div class="panel" style="left:{px}px;top:{py}px;width:{pw}px;height:{ph}px"></div><img class="page" style="left:{x}px;top:{y}px;width:{iw}px;height:{ih}px" src="file://{src}">{steps}'
|
|
SHEET = '<img class="sheet" style="left:{x}px;top:{y}px;width:{iw}px;height:{ih}px" src="file://{src}">'
|
|
|
|
|
|
def png_size(path):
|
|
with open(path, 'rb') as f:
|
|
head = f.read(24)
|
|
return struct.unpack('>II', head[16:24])
|
|
|
|
|
|
def layout(iw, ih, flow):
|
|
"""Where the page goes and its steps in a row in front of its lower edge: (width, height, page x, page y, steps)."""
|
|
w, h = iw + 2 * (INSET + PAD_X), ih + 2 * (INSET + PAD_Y)
|
|
x, y = PAD_X + INSET, PAD_Y + INSET
|
|
if not flow:
|
|
return w, h, x, y, ''
|
|
ml, mt, mr, mb = FLOW_MARGIN
|
|
sizes = [tuple(v // SCALE for v in png_size(src)) for src in flow]
|
|
row = sum(pw - ml - mr for pw, _ in sizes) + STEP_GAP * (len(sizes) - 1)
|
|
w = max(w, row + 2 * STEP_PAD)
|
|
x = (w - iw) // 2
|
|
top = y + ih - STEP_OVER
|
|
h = top + max(ph - mt - mb for _, ph in sizes) + PAD_Y
|
|
out, sx = [], (w - row) // 2
|
|
for i, (src, (pw, ph)) in enumerate(zip(flow, sizes)):
|
|
out.append(f'<img class="sheet" src="file://{src}" style="left:{sx - ml}px;top:{top - mt}px;width:{pw}px;height:{ph}px">')
|
|
out.append(f'<span class="n" style="left:{sx - 14}px;top:{top - 14}px">{i + 1}</span>')
|
|
sx += pw - ml - mr + STEP_GAP
|
|
return w, h, x, y, ''.join(out)
|
|
|
|
|
|
def main():
|
|
browser = next((b for b in CANDIDATES if b and os.path.exists(b)), None)
|
|
if not browser:
|
|
sys.exit('No Chromium-based browser found; set BROWSER=/path/to/chrome')
|
|
only = sys.argv[1:]
|
|
unknown = [n for n in only if n not in SHOTS]
|
|
if unknown:
|
|
sys.exit(f'unknown screenshot {", ".join(unknown)} (one of {", ".join(SHOTS)})')
|
|
tmp = tempfile.mkdtemp()
|
|
for name in SHOTS:
|
|
if only and name not in only:
|
|
continue
|
|
src = os.path.join(RAW, f'{name}.png')
|
|
if not os.path.exists(src):
|
|
print(f'skip {name}: no raw capture')
|
|
continue
|
|
iw, ih = (v // SCALE for v in png_size(src))
|
|
flow = [os.path.join(RAW, f'{step}.png') for step in FLOWS.get(name, [])]
|
|
if not all(os.path.exists(p) for p in flow):
|
|
print(f'{name}: a step is missing, the page alone')
|
|
flow = []
|
|
if name in ALONE:
|
|
ml, mt, mr, mb = FLOW_MARGIN
|
|
w, h = iw - ml - mr + 2 * PAD_X, ih - mt - mb + 2 * PAD_Y
|
|
body = SHEET.format(x=PAD_X - ml, y=PAD_Y - mt, iw=iw, ih=ih, src=src)
|
|
else:
|
|
w, h, x, y, steps = layout(iw, ih, flow)
|
|
body = PAGE.format(x=x, y=y, iw=iw, ih=ih, px=x - INSET, py=y - INSET, pw=iw + 2 * INSET, ph=ih + 2 * INSET,
|
|
src=src, steps=steps)
|
|
html = os.path.join(tmp, f'{name}.html')
|
|
with open(html, 'w', encoding='utf-8') as f:
|
|
f.write(TEMPLATE.format(w=w, h=h, body=body))
|
|
out = os.path.join(OUT, f'{name}.png')
|
|
subprocess.run([browser, '--headless=new', '--disable-gpu', '--hide-scrollbars', '--allow-file-access-from-files',
|
|
f'--force-device-scale-factor={SCALE}', f'--window-size={w},{h}', f'--screenshot={out}', f'file://{html}'],
|
|
check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
print(f'{name}: {w}x{h}')
|
|
shutil.rmtree(tmp)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|