Files
breeze/scripts/generate-node-app-codec.py
T
waozi 73142a5c07 Add Photos and the account's media library, copied to every photo node
Photos is a beta app the node offers (inbe.photos, host interface 13): a
gallery of the library's photos newest first under the day each was taken,
a viewer with previous, next and Move to Trash, and Trash, where a photo can
be restored. Add photo opens the desktop file dialog or Android's photo
picker.

The library belongs to the account, so its photos stay when Photos is
removed. The host keeps each photo once by its SHA-256 with an upright JPEG
preview (Kryon ImagePreview), its capture day from Exif, and syncs the
records in their own collection, private.inbe.v1.media, which released
versions skip. Only Photos is granted the media calls (MediaQueryHost,
MediaItemHost, MediaAssetHost, MediaPickHost, MediaStatusHost,
MediaUpdateHost), and hosted apps may draw only this account's library.

Photo bytes travel as the Diary's sealed copies, so the same picture is one
copy per node. The media pass now moves Diary photos and library originals
and previews to every node in the account's list whose photo upload is on,
each on its own media session with the device registered there, and fetches
a copy from the sync node first, then the others. Originals download where
they are opened; previews everywhere. Removing a node forgets its session and
the copies it held. JPEG photos stored sideways now draw upright.

Tests: media library, Exif reader, Photos through the real node-app host,
storage sync of the library and per-node sessions, two clients and two real
Daochi nodes, and a private-display check that adds a camera photo through
the desktop picker.
2026-10-17 07:35:10 -03:00

33 lines
1.4 KiB
Python

#!/usr/bin/env python3
"""Generate src/cells/node_app_codec.zi with Kryon's widget codec generator.
These are the records every app the node offers exchanges with the host
through the generic app interface (src/cells/node_app_types.zi).
Pass --check to verify the file is current."""
from pathlib import Path
import subprocess
import sys
ROOT = Path(__file__).resolve().parent.parent
KRYON = ROOT / 'build/packages/kryon'
KRYON_MODULES = ['session']
APP_TYPES = ['node_app_types']
ROOTS = ['AppMessage', 'AppUiFrame', 'AppPerson', 'AppShared', 'AppSharedItem',
'AppInvitation', 'AppSharedCommand', 'MediaEntry', 'MediaStatus']
command = [sys.executable, str(KRYON / 'scripts/generate-widget-codecs.py'),
'--output', str(ROOT / 'src/cells/node_app_codec.zi'),
'--uses', str(KRYON / 'src/backend/widget_codec.zi'),
'--generated-by', 'scripts/generate-node-app-codec.py']
for module in KRYON_MODULES:
command += ['--source', str(KRYON / 'src/ui' / (module + '.zi'))]
for name in APP_TYPES:
command += ['--source', str(ROOT / 'src/cells' / (name + '.zi'))]
for root in ROOTS:
command += ['--root', root]
for line in ['"std/bundle_host"', '"std/byte_text_linux"', '"hosted_values"', '"widget_codec"',
*(f', file "{name}.zi";' for name in APP_TYPES), *(f'"{module}"' for module in KRYON_MODULES)]:
command += ['--import', line]
command += sys.argv[1:]
sys.exit(subprocess.run(command).returncode)