Add host32 game downloads and restore app download dialogs

This commit is contained in:
waozi committed 2026-10-25 12:37:17 -03:00
1 parent 64a050fbc6
commit 52c71db3c4
39 files changed
+601 -58

No files matched your search

+6
View File
@@ -1,5 +1,11 @@
# Changelog
## [2.1.47] - 2026-10-25
- App downloads show their progress and open the app when ready.
- Installed apps no longer show download sizes.
- Arcade can download each game separately from its smaller catalog.
## [2.1.46] - 2026-10-24
- Practices can update its session controls, guides and settings without reinstalling Breeze.
+2 -1
View File
@@ -395,7 +395,8 @@ APP_RESOURCES += $(shell find -L $(PRACTICE_MEDIA) -type f -not -path '*/.git/*'
APP_RESOURCES += $(wildcard apps/*/achievements.json) $(wildcard apps/*/achievement-locales/*.json)
APP_RESOURCES += $(wildcard assets/*/sidebar.shape)
EMBEDDED_ASSET_FILES := apps/publishers.json $(INBE_BUNDLE) build/apps-ui/apps.zx assets/app/icon.png
APPS_BUNDLE ?= build/apps-ui/apps.zx
EMBEDDED_ASSET_FILES := apps/publishers.json $(INBE_BUNDLE) $(APPS_BUNDLE) assets/app/icon.png
KRY_GEN_DIR := $(BUILD_DIR)/kryon/generated
# Dependencies are imported as PACKAGE/Module through their linked packages.
ZI_PACKAGE_PATHS := $(shell sh scripts/package-paths.sh)
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.3.11] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.47.
## [1.3.10] - 2026-10-24
- Maintenance release for Inner Breeze 2.1.46.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.3.1] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.47.
## [1.3.0] - 2026-10-24
- The habit list, each habit's week and calendar, its day with its entries, its editor and its statistics now come with Habits, so they can change without an app update.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [2.1.47] - 2026-10-25
- Bring Lumi 1.5.14, Habits 1.3.1, Practices 1.5.1, Lists 1.1.15, Diary 1.3.11 and Leaderboard 1.0.16 for Inner Breeze 2.1.47.
## [2.1.46] - 2026-10-24
- Bring Lumi 1.5.13, Habits 1.2.11, Practices 1.3.11, Lists 1.1.14, Diary 1.3.10 and Leaderboard 1.0.15 for Inner Breeze 2.1.46.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.0.16] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.47.
## [1.0.15] - 2026-10-24
- Maintenance release for Inner Breeze 2.1.46.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.1.15] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.47.
## [1.1.14] - 2026-10-24
- Maintenance release for Inner Breeze 2.1.46.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.5.14] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.47.
## [1.5.13] - 2026-10-24
- Maintenance release for Inner Breeze 2.1.46.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.5.1] - 2026-10-25
- Maintenance release for Inner Breeze 2.1.47.
## [1.5.0] - 2026-10-25
- Running Meditation, Breathing Patterns, Wim Hof, Sun Salutation, Tai Chi, Astral Projection and 7-Minute Workout layouts now come with Practices.
+23 -23
View File
@@ -1,66 +1,66 @@
{
"host_api": 31,
"host_api": 32,
"oldest_host_api": 12,
"package_format": "zx",
"module_api": 2,
"apps": {
"inbe": {
"id": "inbe",
"version": "2.1.46",
"sequence": 43,
"version": "2.1.47",
"sequence": 44,
"bundled": true,
"host_api": 31,
"release": "2.1.46"
"host_api": 32,
"release": "2.1.47"
},
"habits": {
"id": "inbe.habits",
"version": "1.3.0",
"sequence": 24,
"version": "1.3.1",
"sequence": 25,
"bundled": true,
"host_api": 30,
"oldest_host_api": 30,
"release": "2.1.46"
"release": "2.1.47"
},
"practices": {
"id": "inbe.practices",
"version": "1.5.0",
"sequence": 24,
"version": "1.5.1",
"sequence": 25,
"bundled": true,
"host_api": 31,
"oldest_host_api": 31,
"release": "2.1.46"
"release": "2.1.47"
},
"lists": {
"id": "inbe.lists",
"version": "1.1.14",
"sequence": 22,
"version": "1.1.15",
"sequence": 23,
"bundled": true,
"host_api": 27,
"release": "2.1.46"
"release": "2.1.47"
},
"diary": {
"id": "inbe.diary",
"version": "1.3.10",
"sequence": 27,
"version": "1.3.11",
"sequence": 28,
"bundled": true,
"host_api": 21,
"release": "2.1.46"
"release": "2.1.47"
},
"lumi": {
"id": "inbe.lumi",
"version": "1.5.13",
"sequence": 31,
"version": "1.5.14",
"sequence": 32,
"bundled": true,
"host_api": 20,
"release": "2.1.46"
"release": "2.1.47"
},
"leaderboard": {
"id": "inbe.leaderboard",
"version": "1.0.15",
"sequence": 16,
"version": "1.0.16",
"sequence": 17,
"bundled": true,
"host_api": 25,
"release": "2.1.46"
"release": "2.1.47"
}
},
"node_apps": {
+2 -2
View File
@@ -67,8 +67,8 @@ android {
minSdk 21
targetSdk 36
testInstrumentationRunner "android.test.InstrumentationTestRunner"
versionCode 183
versionName "2.1.46"
versionCode 184
versionName "2.1.47"
manifestPlaceholders = [
inbeAppLabel: "Inner Breeze",
inbeUsesCleartextTraffic: "false"
@@ -7,6 +7,23 @@ import java.io.File;
public final class LocalNodeApp {
public static final String EXTRA_LOCAL_NODE_APP = "local_node_app";
/** A USB test can serve the explicitly offered bundle's children locally. */
public static String origin(boolean debug, Intent intent) {
if (!debug || intent == null || !intent.getBooleanExtra(EXTRA_LOCAL_NODE_APP, false)) {
return null;
}
String value = intent.getStringExtra("local_package_origin");
if (value == null || !value.startsWith("http://127.0.0.1:")) {
return null;
}
String port = value.substring("http://127.0.0.1:".length());
if (port.isEmpty() || port.length() > 5 || !port.matches("[0-9]+")) {
return null;
}
int number = Integer.parseInt(port);
return number > 0 && number <= 65535 ? value : null;
}
private LocalNodeApp() {
}
@@ -1197,6 +1197,12 @@ public class MainActivity extends NativeActivity {
private void offerLocalNodeApp() {
File bundle = LocalNodeApp.offered(BuildConfig.DEBUG, getIntent(), getExternalFilesDir(null));
try {
String origin = bundle == null ? null : LocalNodeApp.origin(BuildConfig.DEBUG, getIntent());
if (origin == null) {
android.system.Os.unsetenv("INBE_LOCAL_PACKAGE_ORIGIN");
} else {
android.system.Os.setenv("INBE_LOCAL_PACKAGE_ORIGIN", origin, true);
}
if (bundle == null) {
android.system.Os.unsetenv("INBE_NODE_APP_FILE");
} else {
@@ -0,0 +1,3 @@
- App downloads show their progress and open the app when ready.
- Installed apps no longer show download sizes.
- Arcade can download each game separately from its smaller catalog.
+2 -2
View File
@@ -11,7 +11,7 @@ ENTITY_SOURCES = $(wildcard $(ENTITY_DIR)/src/*.zi $(ENTITY_DIR)/assets/entity/*
# The shared Apps controller is built from the locked Apps package with its
# own pinned graph, so its digest identifies the reviewed Apps release.
APPS_DIR := build/packages/apps
APPS_BUNDLE := build/apps-ui/apps.zx
APPS_BUNDLE ?= build/apps-ui/apps.zx
$(BUILD_DIR)/apps-ui/apps.zx: ziran.lock scripts/build-apps.py $(wildcard $(APPS_DIR)/ziran.lock $(APPS_DIR)/src/*.zi $(APPS_DIR)/ui/*.zi $(APPS_DIR)/ui/locales/*.json)
env -u DISPLAY -u WAYLAND_DISPLAY PATH="$(abspath $(dir $(ZIRAN_BIN))):$$PATH" \
python3 scripts/build-apps.py --ziran $(abspath $(ZIRAN_BIN)) --output $(abspath $(dir $@))
@@ -21,7 +21,7 @@ apps: $(APP_BUNDLES) $(INBE_BUNDLE) $(INBE_FULL_BUNDLE)
$(APP_BUNDLES) $(INBE_BUNDLE) $(INBE_FULL_BUNDLE): CHANGELOG.md scripts/release_notes.py $(APPS_BUNDLE) src/apps/apps_controller.zi
$(APP_BUNDLES) $(INBE_BUNDLE) $(INBE_FULL_BUNDLE) &: $(ENTITY_SOURCES) $(APP_SOURCES) $(APP_RESOURCES) ziran.lock apps/versions.json scripts/check-package-versions.py scripts/generate-package-versions.py scripts/prepare-package-assets.py scripts/achievement_icons.py scripts/animation_inventory.py scripts/build-apps.sh src/practices/sun_salutation/sun_salutation_assets.zi src/practices/sun_salutation/sun_salutation_inventory.zi $(IMAGE_FILES) $(SOUND_FILES) $(FONT_FILES) $(STYLE_FILES) $(LOCALE_FILES) $(ZIRAN_BIN)
sh scripts/build-apps.sh $(ZIRAN_BIN)
sh scripts/build-apps.sh $(ZIRAN_BIN) $(BUILD_DIR)/apps $(APPS_BUNDLE)
# Apps the node offers build on their own, never into the root package.
NODE_APP_NAMES := $(shell python3 -c 'import json; print(" ".join(json.load(open("apps/versions.json")).get("node_apps", {})))')
+1 -1
View File
@@ -1,5 +1,5 @@
Package: inbe.waozi
Version: 2.1.46
Version: 2.1.47
Architecture: arm64
Maintainer: Waozi <[email protected]>
Click-Version: 0.4
+1 -1
View File
@@ -28,7 +28,7 @@
<binary>inbe</binary>
</provides>
<releases>
<release version="2.1.46" date="2026-10-24"/>
<release version="2.1.47" date="2026-10-25"/>
</releases>
<content_rating type="oars-1.1"/>
</component>
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "inbe",
"title": "Inner Breeze",
"version": "2.1.46",
"version": "2.1.47",
"architecture": "arm64",
"framework": "ubuntu-sdk-20.04",
"description": "Syncable breathing, meditation, and habit practice app.",
+1 -1
View File
@@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Inner Breeze",
"short_name": "Inbe",
"version": "2.1.46",
"version": "2.1.47",
"description": "Breathing, meditation, habit tracking, and encrypted sync.",
"permissions": [
"contextMenus"
+1 -1
View File
@@ -22,7 +22,7 @@
<binary>inbe</binary>
</provides>
<releases>
<release version="2.1.46" date="2026-10-24"/>
<release version="2.1.47" date="2026-10-25"/>
</releases>
<content_rating type="oars-1.1"/>
</component>
+1 -1
View File
@@ -22,7 +22,7 @@
<binary>inbe</binary>
</provides>
<releases>
<release version="2.1.46" date="2026-10-24"/>
<release version="2.1.47" date="2026-10-25"/>
</releases>
<content_rating type="oars-1.1"/>
</component>
+1 -1
View File
@@ -6,7 +6,7 @@ description: |
meditation, and habit tracking with visual and audio cues, meditation
timers, habit counters, session history, and optional sync.
version: '2.1.46'
version: '2.1.47'
license: BSD-3-Clause
base: core22
confinement: strict
+2 -1
View File
@@ -9,6 +9,7 @@ mkdir -p build
exec 9>build/apps-build.lock
flock 9
ziran=${1:-build/ziran-toolchain/bin/ziran}
controller=${3:-build/apps-ui/apps.zx}
packages=$(sh scripts/package-paths.sh)
output=${2:-build/apps}
python3 scripts/check-package-versions.py
@@ -18,7 +19,7 @@ python3 tests/locale_used_keys_test.py
python3 tests/lumi_guide_narration_test.py "$ziran"
python3 scripts/generate-package-versions.py
python3 scripts/animation_inventory.py --check
python3 scripts/prepare-package-assets.py
python3 scripts/prepare-package-assets.py --apps-controller "$controller"
if [ ! -s build/package-assets/inbe/assets/apps/apps.zx ]; then
echo 'Root Apps requires the reviewed Apps controller bundle; run make apps' >&2
exit 1
+4 -3
View File
@@ -28,11 +28,12 @@ def emit(output: Path, files: list[Path], root: Path) -> None:
resolved = file.resolve(strict=True)
# Keep build/packages/<name> links unresolved so package assets get
# stable embedded names regardless of the package cache location.
path = Path(os.path.abspath(file)).relative_to(root).as_posix()
if file.name == "apps.zx":
path = "apps.zx"
else:
path = Path(os.path.abspath(file)).relative_to(root).as_posix()
if path.startswith("build/apps/"):
path = "cells/" + path.removeprefix("build/apps/")
if path == "build/apps-ui/apps.zx":
path = "apps.zx"
if path == "build/inbe.zx":
path = "inbe.zx"
if path.startswith("build/packages/kss/styles/"):
+8 -1
View File
@@ -256,6 +256,7 @@ LauncherAppDrain :: (group: *LauncherAppGroup) {
}
slot := app_launcher_install_offer(app, name)
if slot < 0 { group.status = "rejected"; return }
app.launcher_pending_node = slot + 1
if request.operation == Rules.APPS_OPEN { app_launcher_activate(app, AppNavNodeRoute(slot)) }
group.status = "applied"
return
@@ -272,6 +273,7 @@ LauncherAppDrain :: (group: *LauncherAppGroup) {
!NodeAppInstalled(AppNavNodeSlot(route)) {
// Its download symbol: the package downloads, and the card says so.
slot := AppNavNodeSlot(route)
app.launcher_pending_node = slot + 1
state: Vec(u8)
BuilderPrint(*state, "slot % name % available % installed % pending % found % temporary %",
slot, NodeAppName(slot), ifx app_nav_route_available(app, route) then 1 else 0,
@@ -501,8 +503,13 @@ app_launcher_shared_group :: (app: *InnerBreeze, section: s32, routes: []s32,
document: Vec(u8)
BuilderPrint(*document, "\"title\":\"\",\"locale\":")
Rules.AppsWriteQuoted(*document, LocaleActiveCode())
BuilderPrint(*document, ",\"presentation\":{\"mode\":\"%\",\"hide_sizes\":true,\"section_break\":%,\"columns\":%,\"tile_class\":%,\"action_class\":%,\"muted_class\":%},\"children\":[",
BuilderPrint(*document, ",\"presentation\":{\"mode\":\"%\",\"hide_sizes\":true,\"section_break\":%,\"columns\":%,\"tile_class\":%,\"action_class\":%,\"muted_class\":%",
ifx grid then "icon" else "list", section_break, columns, KssClassId(KssMakeName("launcher-tile")), KssClassId(KssMakeName("launcher-action")), KssClassId(KssMakeName("launcher-muted")))
if app.launcher_pending_node > 0 {
LauncherAppQuoted(*document, "download_id", TextUntilNul(app.launcher_download_id[:]))
BuilderPrint(*document, ",\"download_request\":%", app.launcher_download_request)
}
BuilderPrint(*document, "},\"children\":[")
for route: routes {
if route >= 0 { LauncherAppCatalogEntry(group, *document, route) }
else { LauncherAppCatalogEntry(group, *document, -1, -route - 2) }
+10
View File
@@ -13,6 +13,7 @@
#import, file "../apps/package_manager.zi";
#import, file "../apps/node_apps.zi";
#import, file "session_window.zi";
#import, file "text_buffers.zi";
using AppNavRoute;
@@ -148,6 +149,15 @@ app_launcher_install :: (app: *InnerBreeze, route: s32) -> bool {
return app_nav_route_available(app, route)
}
#program_export
app_launcher_show_download :: (app: *InnerBreeze, slot: s32) {
app.launcher_open = true
app.launcher_editing = false
app.launcher_pending_node = slot + 1
app.launcher_download_request += 1
unused AppCopyText(PackageID(NodeAppIndex(slot)), app.launcher_download_id[:])
}
app_launcher_activate :: (app: *InnerBreeze, route: s32) {
if !app_launcher_install(app, route) { return }
// An app the node offers that is not on this device yet stays closed,
+4 -1
View File
@@ -77,6 +77,9 @@ app_nav_route_available :: (app: *InnerBreeze, route: s32) -> bool {
// An app the node offers opens only once it is on this device. Asking for
// one that is not starts it when its package is here, or downloads it
// again, and leaves the current page as it is.
c :: #system_library "c";
app_launcher_show_download :: (app: *InnerBreeze, slot: s32) #foreign c;
app_nav_node_app_ready :: (app: *InnerBreeze, slot: s32) -> bool {
if !app_nav_route_available(app, AppNavNodeRoute(slot)) {
return false
@@ -84,10 +87,10 @@ app_nav_node_app_ready :: (app: *InnerBreeze, slot: s32) -> bool {
if !NodeAppInstalled(slot) && !PackagePending(NodeAppIndex(slot)) {
unused NodeAppInstall(NodeAppName(slot))
}
if !NodeAppInstalled(slot) { app_launcher_show_download(app, slot) }
return NodeAppInstalled(slot)
}
c :: #system_library "c";
app_leave_practice_config :: (app: *InnerBreeze) #foreign c;
save_settings :: (app: *InnerBreeze) #foreign c;
habit_edit_request_leave :: (app: *InnerBreeze, route: s32) -> bool #foreign c;
+2
View File
@@ -656,6 +656,8 @@ InnerBreeze :: struct {
// An app from the node tapped while it was still downloading, as its slot
// plus one: it opens once installed if Apps is still open. 0 for none.
launcher_pending_node: s32
launcher_download_request: s64
launcher_download_id: [128]u8
launcher_drag_vertical: bool
launcher_drag_origin: Vector2
launcher_drag_pointer: Vector2
+4 -1
View File
@@ -2,8 +2,11 @@
// bytes, but cannot select or replace the host's controller trust anchor.
// Collections built before the ZX format carried ZIB controllers, which this
// runtime cannot run; earlier ZX controllers stay trusted for collections.
AppsControllerSha256 :: "20ad36d054088484f069e3e7aa72135762fe25354fb8249ca0a2fcc019834a48"
AppsControllerSha256 :: "0b350b5a5ae9813e9e0521ad6089bda78ee125483cefa09cf9062f42c3d70227"
// The ZX controller before the download dialog and the fading carousel
// titles. Collections published with it, such as Arcade 0.7.49, keep opening.
AppsControllerBeforeDownload :: "b8733db7256c4e96f8f8bd198072dcc2c3fc4e66b266a9e396c40e88949d8011"
// Existing collections keep the controller from before separate downloads.
AppsControllerBeforeSeparateDownloads :: "20ad36d054088484f069e3e7aa72135762fe25354fb8249ca0a2fcc019834a48"
+1 -1
View File
@@ -1,5 +1,5 @@
// Generated from apps/versions.json. This host runs packages built for host
// interfaces from the oldest to the current one; module interfaces must match.
PackageHostAPI :: 31
PackageHostAPI :: 32
PackageHostAPIOldest :: 12
PackageModuleAPI :: 2
+5 -1
View File
@@ -24,6 +24,7 @@ Portable :: #import "kryon/app_protocol";
#import "session"
#import "text_input_props"
#import, file "apps_controller.zi";
#import, file "node_child_packages.zi";
#import, file "../app/assets.zi";
Node :: #import "apps/node_types";
Codec :: #import "apps/node_codec";
@@ -473,9 +474,11 @@ NodeTreeStart :: (runner: *NodeAppRunner, bytes: string, verified: string,
Sha256Hex(payload.data, bytes.count, *digest[0])
}
unused AppHostTrustHarness(host, AppsControllerBeforeDownload)
unused AppHostTrustHarness(host, AppsControllerBeforeSeparateDownloads)
platform := AppPlatform.{.context = cast(*void)runner, .allows = NodeTreeAllows, .call = NodeTreeCall,
.widgets = NodeTreeWidgets, .save = NodeTreeSave, .state = NodeTreeState,
.effect = NodeTreeEffect}
.effect = NodeTreeEffect, .bundle = NodeChildBundle,
.download = NodeChildDownload, .fetch = NodeChildFetch}
ready := false
if preparation != null {
ready = AppHostStartPrepared(host, preparation, TextUntilNul(authority[:]), PackageID(NodeAppIndex(slot)),
@@ -636,5 +639,6 @@ NodeTreeClose :: (runner: *NodeAppRunner) -> bool {
return false
}
runner.nested = null
NodeChildClose(NodeAppSlotOf(runner))
return true
}
+2
View File
@@ -40,6 +40,7 @@ Time :: #import "date_time_linux";
#import, file "node_app_snapshot.zi";
#import, file "node_app_replacements.zi";
#import, file "node_app_open.zi";
#import, file "node_child_packages.zi";
#import, file "node_icon_work.zi";
#import, file "achievement_media.zi";
Nested :: #import "apps/host";
@@ -1806,6 +1807,7 @@ NodeAppsCatalogPump :: (now: s32, wanted: bool) {
// Inbe drew anything kept a phone on a black screen for seconds.
NodeAppsPump :: (now: s32, catalog_wanted: bool, defer_open: bool = false) {
NodeAppsInitialize()
NodeChildPump()
NodeAppsCatalogPump(now, catalog_wanted)
NodeAppsIconsPump()
if PackageRevision() != node_package_revision {
+253
View File
@@ -0,0 +1,253 @@
// Games declared by a signed collection download independently. Its catalog
// authenticates each digest; only that parent's package route can supply it.
#import "apps/host"
#import "apps/tree"
#import "apps/catalog"
#import "apps/protocol"
#import "kryon/hosted_app"
#import "std/c_string"
#import "std/byte_text_linux"
#import "std/text_buffer"
#import "file_download"
#import "file_linux"
#import, file "node_apps.zi";
#import, file "node_app_runner.zi";
#import, file "node_app_tree.zi";
#import, file "package_manager.zi";
#import, file "package_work.zi";
#import, file "package_files.zi";
#import, file "package_release.zi";
#import, file "catalog.zi";
#import, file "../app/assets.zi";
#import, file "../storage/temporary_data.zi";
#import, file "../storage/data.zi";
using FileDownloadStatus;
NODE_CHILD_LIMIT :: 32
NODE_CHILD_MEMORY_LIMIT :: 64 * 1024 * 1024
NodeChildPackage :: struct {
used: bool
root: s32
account: [65]u8
root_hash: [65]u8
digest: [65]u8
bytes: string
path: string
status: s32
requested: bool
retired: bool
size: s64
}
node_children: [NODE_CHILD_LIMIT]NodeChildPackage;
node_child_active: s32 = -1;
node_child_transfer: FileDownload;
node_child_work: *PackageWork;
node_child_memory: s64;
NodeChildOrigin :: (root: s32) -> string {
value := DataEnvironment("INBE_LOCAL_PACKAGE_ORIGIN")
if NodeAppLocal(NodeAppName(root)) && value != null {
address := TextFromCString(value)
prefix := "http://127.0.0.1:"
if address.count > prefix.count && address.count <= prefix.count + 5 &&
address[:prefix.count] == prefix {
port: s32
valid := true
for digit: address[prefix.count:] {
if digit < #char "0" || digit > #char "9" { valid = false; break }
port = port * 10 + cast(s32)(digit - #char "0")
}
if valid && port > 0 && port <= 65535 { return address }
}
}
return TextUntilNul(package_origin[:])
}
NodeChildFind :: (runner: *NodeAppRunner, entry: *AppEntry) -> s32 {
root := NodeAppSlotOf(runner)
if root < 0 || runner.nested == null ||
TextUntilNul(runner.nested.tree.account[:]) != NodeTreeAccount() ||
!AppDigestValid(TextUntilNul(entry.sha256[:])) {
return -1
}
empty: s32 = -1
for index: cast(s32)0..NODE_CHILD_LIMIT - 1 {
child := *node_children[index]
if !child.used {
if empty < 0 { empty = index }
} else if !child.retired && child.root == root &&
TextUntilNul(child.account[:]) == NodeTreeAccount() &&
TextUntilNul(child.root_hash[:]) == TextUntilNul(runner.release_hash[:]) &&
TextUntilNul(child.digest[:]) == TextUntilNul(entry.sha256[:]) {
return index
}
}
if empty < 0 { return -1 }
child := *node_children[empty]
child.used = true
child.root = root
child.root_hash = runner.release_hash
child.digest = entry.sha256
unused CopyCString(NodeTreeAccount(), child.account[:])
directory := PackageDirectory()
path: Vec(u8)
BuilderPrint(*path, "%/child-%-%.zx", directory, PackageID(NodeAppIndex(root)),
TextUntilNul(child.digest[:]))
PackageFree(directory)
child.path = BuilderFinish(path)
child.requested = PackageFileSize(child.path) > 0
if child.requested { child.status = 1 }
return empty
}
NodeChildBundle :: (context: *void, parent: *AppNode, entry: *AppEntry) -> HostedAsset {
unused parent
index := NodeChildFind(cast(*NodeAppRunner)context, entry)
if index < 0 || node_children[index].status != 2 { return HostedAsset.{} }
return HostedAsset.{.found = true, .data = node_children[index].bytes}
}
NodeChildDownload :: (context: *void, parent: *AppNode, entry: *AppEntry,
download: *AppDownload) -> bool {
runner := cast(*NodeAppRunner)context
// Packed children keep their normal offline path and do not allocate a job.
packed := AppHostAsset(parent, TextUntilNul(entry.bundle[:]))
if packed.found { return false }
index := NodeChildFind(runner, entry)
if index < 0 {
download.failed = true
return true
}
child := *node_children[index]
if child.status == 2 { return false }
download.downloading = child.status == 1
download.failed = child.status == 3
download.bytes = child.size
download.progress = -1
if index == node_child_active && node_child_work == null && node_child_transfer.total_bytes > 0 {
download.bytes = cast(s64)node_child_transfer.total_bytes
received := cast(s64)node_child_transfer.bytes
if received > download.bytes { received = download.bytes }
download.progress = cast(s32)(received * 100 / download.bytes)
}
return true
}
NodeChildFetch :: (context: *void, account: string, parent: *AppNode, entry: *AppEntry,
operation: s32, reply: *AppsReply) -> bool {
runner := cast(*NodeAppRunner)context
if operation != APPS_INSTALL || account != NodeTreeAccount() ||
AppHostAsset(parent, TextUntilNul(entry.bundle[:])).found { return false }
index := NodeChildFind(runner, entry)
if index < 0 {
reply.* = AppRejected("download queue full")
return true
}
child := *node_children[index]
if child.status == 2 { return false }
child.requested = true
child.status = 1
reply.status = APPS_QUEUED
return true
}
NodeChildClear :: (index: s32) {
child := *node_children[index]
node_child_memory -= child.bytes.count
PackageFree(child.bytes)
if DataTemporary() { unused RemoveFile(child.path) }
PackageFree(child.path)
child.* = NodeChildPackage.{}
}
NodeChildClose :: (root: s32) {
for index: cast(s32)0..NODE_CHILD_LIMIT - 1 {
if !node_children[index].used || node_children[index].root != root { continue }
if index == node_child_active {
node_children[index].retired = true
FileDownloadRelease(*node_child_transfer)
if node_child_work != null { continue }
node_child_active = -1
}
NodeChildClear(index)
}
}
NodeChildFinish :: (ok: bool) {
child := *node_children[node_child_active]
FileDownloadRelease(*node_child_transfer)
temporary := PackageText(child.path, ".download")
unused RemoveFile(temporary)
PackageFree(temporary)
child.status = ifx ok then 2 else 3
child.requested = false
if child.retired { NodeChildClear(node_child_active) }
node_child_active = -1
AssetNotifyAvailable()
}
NodeChildPump :: () {
if node_child_active < 0 {
for index: cast(s32)0..NODE_CHILD_LIMIT - 1 {
child := *node_children[index]
if !child.used || !child.requested || child.retired { continue }
node_child_active = index
child.requested = false
if PackageFileSize(child.path) > 0 {
node_child_work = PackageWorkCreate(child.path, "", TextUntilNul(child.account[:]),
PackageID(NodeAppIndex(child.root)), PackageRelease.{}, false)
if node_child_work == null { NodeChildFinish(false) }
return
}
url: Vec(u8)
BuilderPrint(*url, "%/api/v2/packages/%/%.zx", NodeChildOrigin(child.root),
PackageID(NodeAppIndex(child.root)), TextUntilNul(child.digest[:]))
address := BuilderFinish(url)
temporary := PackageText(child.path, ".download")
node_child_transfer = FileDownload.{}
node_child_transfer.maximum_bytes = cast(u64)PackageMaximumBytes
started := FileDownloadStart(*node_child_transfer, address, temporary)
PackageFree(address)
PackageFree(temporary)
if !started { NodeChildFinish(false) }
return
}
return
}
child := *node_children[node_child_active]
if !child.retired && TextUntilNul(child.account[:]) != NodeTreeAccount() {
NodeChildClose(child.root)
return
}
if node_child_work != null {
if !PackageWorkReady(node_child_work) { return }
ok := !child.retired && node_child_work.ok &&
TextUntilNul(node_child_work.digest[:]) == TextUntilNul(child.digest[:]) && node_child_work.bytes.count > 0 &&
node_child_work.bytes.count <= NODE_CHILD_MEMORY_LIMIT - node_child_memory
if ok && node_child_work.path != child.path {
ok = RenamePath(node_child_work.path, child.path)
}
if ok {
child.bytes = node_child_work.bytes
node_child_work.bytes = ""
child.size = child.bytes.count
node_child_memory += child.bytes.count
}
if !ok && !child.retired { unused RemoveFile(node_child_work.path) }
PackageWorkFree(node_child_work)
node_child_work = null
NodeChildFinish(ok)
return
}
status := FileDownloadPoll(*node_child_transfer)
if status == cast(FileDownloadStatus)Error { NodeChildFinish(false); return }
if status != cast(FileDownloadStatus)Ready { return }
child.size = cast(s64)node_child_transfer.bytes
temporary := PackageText(child.path, ".download")
node_child_work = PackageWorkCreate(temporary, "", TextUntilNul(child.account[:]),
PackageID(NodeAppIndex(child.root)), PackageRelease.{}, false)
PackageFree(temporary)
if node_child_work == null { NodeChildFinish(false) }
}
+2 -2
View File
@@ -3,7 +3,7 @@ PackageBundledVersion :: (index: s32) -> string {
if index < 0 || index >= 7 {
return ""
}
versions: [7]string = .["2.1.46", "1.1.14", "1.3.0", "1.5.0", "1.3.10", "1.5.13", "1.0.15"]
versions: [7]string = .["2.1.47", "1.1.15", "1.3.1", "1.5.1", "1.3.11", "1.5.14", "1.0.16"]
return versions[index]
}
@@ -11,7 +11,7 @@ PackageBundledSequence :: (index: s32) -> s32 {
if index < 0 || index >= 7 {
return 0
}
sequences: [7]s32 = .[43, 22, 24, 24, 27, 31, 16]
sequences: [7]s32 = .[44, 23, 25, 25, 28, 32, 17]
return sequences[index]
}
+2 -2
View File
@@ -3,7 +3,7 @@
#define APP_VERSION_MAJOR 2
#define APP_VERSION_MINOR 1
#define APP_VERSION_PATCH 46
#define APP_VERSION_STRING "2.1.46"
#define APP_VERSION_PATCH 47
#define APP_VERSION_STRING "2.1.47"
#endif
+2 -2
View File
@@ -1,5 +1,5 @@
// Generated by update_version.sh from CHANGELOG.md. Do not edit by hand.
VersionMajor :: 2
VersionMinor :: 1
VersionPatch :: 46
VersionString :: "2.1.46"
VersionPatch :: 47
VersionString :: "2.1.47"
+13 -4
View File
@@ -26,7 +26,8 @@ OUTPUT = ROOT / "build/node-app-not-installed-ui-test"
OUTPUT.mkdir(parents=True, exist_ok=True)
BINARY = Path(sys.argv[1]).resolve()
FAILURE_ONLY = "--failure-only" in sys.argv[2:]
DESKTOP_ENV = ("DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "DBUS_SESSION_BUS_ADDRESS")
DESKTOP_ENV = ("DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "DBUS_SESSION_BUS_ADDRESS",
"GDK_DISPLAY", "SESSION_MANAGER")
assert all(not os.environ.get(key) for key in DESKTOP_ENV), "Inherited desktop environment"
WIDTH, HEIGHT = 390, 844
# ScreenNodeApp, the screen of an app the node offers.
@@ -126,6 +127,11 @@ with contextlib.ExitStack() as stack:
return [node for node in driver.find(label=label, role="button", visible=True)
if node.get("focus_id") != NAVIGATION and node["width"] > 60]
def close_download():
driver.wait(role="modal")
driver.key("escape")
driver.wait_gone(role="modal")
with application("initialize"):
pass
with contextlib.closing(sqlite3.connect(profile / "inbe.db")) as db, db:
@@ -156,6 +162,7 @@ with contextlib.ExitStack() as stack:
# Radio's pin in the navigation.
driver.press(label="Radio", role="button", focus_id=NAVIGATION)
close_download()
stays_closed(log_path, "navigation pin")
# Radio's card in Apps: Apps stays open on its list.
@@ -163,16 +170,18 @@ with contextlib.ExitStack() as stack:
wait(apps_open, "Apps did not open")
radio = wait(lambda: grid_cards("Radio"), "Radio has no card in Apps")[0]
driver.press(key=radio["key"], label="Radio")
close_download()
stays_closed(log_path, "Apps card")
assert apps_open(), "Tapping an app that is not installed closed Apps"
# Photos is only offered: the tap installs it on the account, as
# before, and does not open it.
# An offered app asks in the same dialog before installing.
driver.press(label="Find an app", role="text_field")
driver.type("Photos")
photos = wait(lambda: grid_cards("Photos"), "Photos is not offered in Apps")[0]
driver.press(key=photos["key"], label="Photos")
wait(lambda: settings().get("app_used_photos") == "1", "The Photos tap was not taken")
driver.wait(contains="Download size:")
assert settings().get("app_used_photos") != "1", "The app downloaded before consent"
close_download()
stays_closed(log_path, "offered app")
assert apps_open(), "Tapping an offered app closed Apps"
+187
View File
@@ -0,0 +1,187 @@
"""Download one declared game, reject corruption, and reopen its offline cache."""
import contextlib
import hashlib
import http.server
import json
import os
from pathlib import Path
import re
import sqlite3
import subprocess
import sys
import tempfile
import threading
import time
from ui_driver import UiDriver
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / 'scripts'))
from practice_content import bundle_assets
sys.path.insert(0, str(ROOT.parent / 'shovey/tests'))
from inbe_apps import open_arcade
BINARY, CATALOG = (Path(value).resolve() for value in sys.argv[1:3])
BUNDLE = Path(sys.argv[3]).resolve() if len(sys.argv) > 3 else ROOT / 'build/inbe-full.zx'
OUTPUT = ROOT / 'build/node-child-download-ui-test'
OUTPUT.mkdir(parents=True, exist_ok=True)
DESKTOP = ('DISPLAY', 'WAYLAND_DISPLAY', 'XAUTHORITY', 'DBUS_SESSION_BUS_ADDRESS',
'GDK_DISPLAY', 'SESSION_MANAGER')
assert all(not os.environ.get(key) for key in DESKTOP), 'Inherited desktop environment'
catalog = json.loads(bundle_assets(CATALOG.read_bytes())['assets/apps/catalog.json'])
assert catalog['id'] == 'inbe.arcade'
assert all(entry['bundle'] not in bundle_assets(CATALOG.read_bytes()) for entry in catalog['children'])
classic = next(entry for entry in catalog['children'] if entry['expected_id'] == 'shovey')
payloads = CATALOG.with_suffix('.games')
game = (payloads / (classic['sha256'] + '.zx')).read_bytes()
assert hashlib.sha256(game).hexdigest() == classic['sha256']
requests = []
class Handler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
requests.append(self.path)
wanted = '/api/v2/packages/inbe.arcade/' + classic['sha256'] + '.zx'
if self.path != wanted:
self.send_error(404)
return
# The first response has the correct length and a deliberately bad hash.
body = game if len(requests) > 1 else game[:-1] + bytes([game[-1] ^ 1])
self.send_response(200)
self.send_header('Content-Length', str(len(body)))
self.end_headers()
try:
for start in range(0, len(body), 65536):
self.wfile.write(body[start:start + 65536])
self.wfile.flush()
time.sleep(.02)
except (BrokenPipeError, ConnectionResetError):
pass
def log_message(self, *_):
pass
def stop(process):
if process.poll() is None:
process.terminate()
try:
process.wait(timeout=10)
except subprocess.TimeoutExpired:
process.kill()
process.wait(timeout=5)
with contextlib.ExitStack() as stack:
profile = Path(stack.enter_context(tempfile.TemporaryDirectory(prefix='child-download-', dir=OUTPUT)))
audio = profile / 'alsa.conf'
audio.write_text('pcm.!default { type null }\n')
server = http.server.ThreadingHTTPServer(('127.0.0.1', 0), Handler)
server_thread = threading.Thread(target=server.serve_forever)
server_thread.start()
stack.callback(server_thread.join)
stack.callback(server.server_close)
stack.callback(server.shutdown)
driver = UiDriver(profile / 'driver')
env = {key: value for key, value in os.environ.items() if key not in DESKTOP}
for key in ('http_proxy', 'https_proxy', 'HTTP_PROXY', 'HTTPS_PROXY', 'ALL_PROXY'):
env.pop(key, None)
env.update(driver.environment())
env.update(APP_DATA_ROOT=str(profile), APP_NO_TRAY='1', YUE_DESKTOP_RECOVERY='0',
INBE_NODE_APP_FILE=str(CATALOG),
INBE_LOCAL_PACKAGE_ORIGIN='http://127.0.0.1:' + str(server.server_port),
NO_PROXY='127.0.0.1', SDL_VIDEODRIVER='x11', LIBGL_ALWAYS_SOFTWARE='1',
LP_NUM_THREADS='2', ALSA_CONFIG_PATH=str(audio))
display_log = stack.enter_context((OUTPUT / 'display.log').open('w'))
display = subprocess.Popen(['Xvfb', ':975', '-noreset', '-displayfd', '1',
'-screen', '0', '411x900x24', '-nolisten', 'tcp'], env=env,
stdout=subprocess.PIPE, stderr=display_log)
stack.callback(stop, display)
number = display.stdout.readline().decode().strip()
display.stdout.close()
assert number.isdecimal() and int(number) >= 400 and display.poll() is None
env['DISPLAY'] = ':' + number
@contextlib.contextmanager
def application(name):
driver.reset()
log_path = OUTPUT / (name + '.log')
with log_path.open('w') as log:
process = subprocess.Popen([str(BINARY), '--bundle', str(BUNDLE)], cwd=ROOT,
env=env, stdout=log, stderr=subprocess.STDOUT)
driver.attach(process, log_path)
try:
driver.tree()
found = subprocess.check_output(['xdotool', 'search', '--onlyvisible', '--pid', str(process.pid)],
env=env, text=True, timeout=5)
window = found.splitlines()[0]
subprocess.run(['xdotool', 'windowsize', window, '411', '900'], env=env, check=True, timeout=5)
yield process
assert process.poll() is None, log_path.read_text()[-3000:]
finally:
stop(process)
with application('initialize'):
pass
with sqlite3.connect(profile / 'inbe.db') as db:
user = db.execute("SELECT id FROM users WHERE kind='local' LIMIT 1").fetchone()[0]
settings = dict(language='en', language_system=0, language_setup_done=1,
apps_setup_done=1, tutorial_seen=1, habits_guide_seen=1,
launcher_guide_seen=1, lumi_guides_seen=127, enabled_apps=63,
package_updates_allowed=0, sync_enabled=0, navigation_placement=2,
apps_last_update_check=1900000000, node_apps_checked_at=int(time.time()),
node_apps_offers='arcade|Arcade\n', node_app_slot_0='arcade', app_used_arcade=1)
for key, value in settings.items():
db.execute('INSERT INTO settings(user_id,key,value,updated_at) VALUES(?,?,?,1) '
'ON CONFLICT(user_id,key) DO UPDATE SET value=excluded.value', (user, key, str(value)))
percentages = []
captured = False
def wait_for_download(label):
global captured
deadline = time.monotonic() + 60
while time.monotonic() < deadline:
labels = driver.labels()
percentages.extend(int(match.group(1)) for text in labels
if (match := re.fullmatch(r'Downloading (\d+)%', text)))
if not captured and percentages and 0 < percentages[-1] < 100:
windows = subprocess.check_output(['xdotool', 'search', '--onlyvisible', '--pid',
str(driver.process.pid)], env=env, text=True, timeout=5)
subprocess.run(['import', '-display', env['DISPLAY'], '-window', windows.splitlines()[0],
str(OUTPUT / 'progress.png')], env=env, check=True, timeout=10)
captured = True
if any(label in text for text in labels):
return
time.sleep(.05)
raise AssertionError('Download did not reach ' + label + ': ' + driver.text())
with application('download'):
driver.wait(label='Apps', role='button')
open_arcade(driver)
driver.wait_idle(frames=4)
assert not requests, 'Opening the catalog downloaded a game'
driver.press(label='Play', role='button')
driver.wait(role='modal')
assert not requests, 'Opening the dialog downloaded before consent'
driver.press(label='Download', role='button')
wait_for_download('Download failed')
assert not driver.find(contains='Level 1 / ', visible=True), 'Corrupt bytes opened'
driver.press(label='Try again', role='button')
wait_for_download('Level 1 / ')
assert len(requests) == 2 and all(classic['sha256'] in request for request in requests), requests
assert any(0 < value < 100 for value in percentages), percentages
count = len(requests)
with application('offline-restart'):
open_arcade(driver)
driver.wait_idle(frames=4)
driver.press(label='Play', role='button')
wait_for_download('Level 1 / ')
assert len(requests) == count, 'Restart downloaded the cached game again'
(OUTPUT / 'result.json').write_text(json.dumps(dict(
passed=True, requests=requests, percentages=percentages,
corrupt_payload_rejected=True, automatic_open=True, offline_restart=True), indent=2) + '\n')
print('Separate game download: visible progress, corruption rejection, retry, automatic open and offline restart passed')
+4 -4
View File
@@ -6,8 +6,8 @@ IDI_APP_ICON ICON "inbe.ico"
IDI_NOTIFICATION_ICON ICON "inbe.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,1,46,0
PRODUCTVERSION 2,1,46,0
FILEVERSION 2,1,47,0
PRODUCTVERSION 2,1,47,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -24,11 +24,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "waozi"
VALUE "FileDescription", "Inner Breeze"
VALUE "FileVersion", "2.1.46"
VALUE "FileVersion", "2.1.47"
VALUE "InternalName", "breeze"
VALUE "OriginalFilename", "breeze-windows-x86_64.exe"
VALUE "ProductName", "Inner Breeze"
VALUE "ProductVersion", "2.1.46"
VALUE "ProductVersion", "2.1.47"
END
END
BLOCK "VarFileInfo"