diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dde78312..2c7a700c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/). ## [Unreleased] +## [1.15.7] + +### Highlights + +**Zimi** + +- Voices install on the portable Linux build, pip step included (#151). +- A card's menu no longer closes by itself while a download updates. +- Changing the date no longer freezes the page on machines without a graphics card. + ## [1.15.6] ### Highlights diff --git a/ci/smoke_portable.sh b/ci/smoke_portable.sh index b749caaa8..f063b8094 100755 --- a/ci/smoke_portable.sh +++ b/ci/smoke_portable.sh @@ -3,7 +3,7 @@ # ci/smoke_portable.sh [path-to-a-test.zim] # Copies the folder to a fresh "stick" with a zimi-data and a zims folder beside the executable, then: # `serve -d` answers /health with the ZIM, leaves zimi.pid and zimi.log in zimi-data, writes its state there -# and nowhere else, `doctor --check` passes, `service print` points at this executable, and stopping it +# and nowhere else, `doctor --check` passes (it makes a venv under the data folder and imports ssl with its python), `service print` points at this executable, and stopping it # removes the pid file. set -euo pipefail @@ -28,7 +28,8 @@ echo "zimi config (the portable folder decides the paths)..." "$Z" config | tee "$STICK/config.txt" grep -q "portable" "$STICK/config.txt" || { echo "FAIL: config does not show the portable folder"; exit 1; } -echo "zimi doctor --check (also: the machine's python3, started from the app, is not handed the bundle's libraries, #151)..." +echo "zimi doctor --check (also: the machine's python3, and a venv python made in the data folder beside the executable" +echo "(what voices run pip with), started from the app, are not handed the bundle's libraries, #151)..." "$Z" doctor --check | tee "$STICK/doctor.txt" grep -q "would not run properly" "$STICK/doctor.txt" && { echo "FAIL: the app leaks its environment to outside programs"; exit 1; } diff --git a/pyproject.toml b/pyproject.toml index 365cc51f3..5f447e428 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "zimi" -version = "1.15.6" +version = "1.15.7" description = "Offline knowledge server for ZIM files — search and read Wikipedia, Stack Overflow and 50+ sources with no internet" readme = "README.md" license = {text = "GPL-3.0-or-later"} diff --git a/scripts/build_map_regions.py b/scripts/build_map_regions.py index 6fc2d31ba..f19eacf10 100644 --- a/scripts/build_map_regions.py +++ b/scripts/build_map_regions.py @@ -163,6 +163,28 @@ "osm-washington-dc": [-77.6, 38.6, -76.6, 39.2], "osm-west-africa": [-18.0, 4.0, 16.0, 28.0], "osm-west-asia": [25.0, 12.0, 63.5, 42.5], + # Added with the 2026-11-13 catalog refresh. + "osm-athens": [23.4, 37.8, 24.1, 38.2], + "osm-cairo": [30.9, 29.8, 31.6, 30.3], + "osm-india-central": [73.5, 17.5, 84.5, 26.9], + "osm-india-central-light": [73.5, 17.5, 84.5, 26.9], + "osm-india-east": [83.0, 17.8, 89.9, 27.3], + "osm-india-east-light": [83.0, 17.8, 89.9, 27.3], + "osm-india-northeast": [89.6, 21.9, 97.5, 29.5], + "osm-india-northeast-light": [89.6, 21.9, 97.5, 29.5], + "osm-india-northwest": [68.1, 23.9, 81.1, 37.1], + "osm-india-northwest-light": [68.1, 23.9, 81.1, 37.1], + "osm-india-south-light": [74.0, 8.0, 85.0, 19.9], + "osm-india-west": [68.1, 15.6, 80.9, 24.7], + "osm-india-west-light": [68.1, 15.6, 80.9, 24.7], + "osm-kyiv": [30.2, 50.2, 30.9, 50.6], + "osm-moscow": [36.8, 55.1, 38.0, 56.0], + "osm-osaka": [135.1, 34.4, 135.8, 34.9], + "osm-seoul": [126.7, 37.4, 127.2, 37.7], + "osm-south-central-us": [-109.1, 25.8, -88.8, 37.0], + "osm-taipei": [121.3, 24.9, 121.7, 25.2], + "osm-tehran": [51.1, 35.5, 51.7, 35.9], + "osm-thailand": [97.3, 5.6, 105.7, 20.5], } diff --git a/tests/test_almanac_back_to_1x_browser.py b/tests/test_almanac_back_to_1x_browser.py index 324c9e19f..398a0f370 100644 --- a/tests/test_almanac_back_to_1x_browser.py +++ b/tests/test_almanac_back_to_1x_browser.py @@ -19,6 +19,7 @@ GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] VIEW = {"width": 390, "height": 844} diff --git a/tests/test_almanac_bodyinfo_browser.py b/tests/test_almanac_bodyinfo_browser.py index 31f450c71..291c006e8 100644 --- a/tests/test_almanac_bodyinfo_browser.py +++ b/tests/test_almanac_bodyinfo_browser.py @@ -24,6 +24,7 @@ GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] PHONE = {"width": 390, "height": 844} diff --git a/tests/test_almanac_clock_browser.py b/tests/test_almanac_clock_browser.py index 681143dfe..dd91b6a9a 100644 --- a/tests/test_almanac_clock_browser.py +++ b/tests/test_almanac_clock_browser.py @@ -7,20 +7,29 @@ import os import sys import threading +from datetime import datetime import pytest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) POLL_MS = 100 +#: What a wait on the page's state is bounded by, as a hang's bound and not as the state's pace: a transition, a computed +#: style or a part redrawn lands with a frame, and a runner software-drawing the page makes seconds between frames. +FRAME_BOUND_MS = 30_000 SF = '{"lat":37.77,"lon":-122.42,"name":"San Francisco"}' TOKYO = '{"lat":35.68,"lon":139.69,"name":"Tokyo"}' GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] LA = "America/Los_Angeles" +#: The clock is under test, not the sky: the true horizon is the sky that stands still when nothing moves. The beach's life +#: (palms, waves) repaints the sky's canvas every frame and software GL rasters each at a runner's speed, so a page +#: whose clock is paused still answered a click seconds late. +QUIET_SKY = '{"skin":"horizon"}' ALM_SECBAR_H_PX = 44 # ALM_SECBAR_H ALM_LINGER_WAIT_MS = 15_000 # ALM_SPD_LINGER_MS, with room for a slow machine @@ -59,6 +68,38 @@ def browser(served): br.close() +# The flip runs the page through the hours between two moments by frames and by Date.now(). What the test asks is that it +# runs through them, not how many frames a runner draws in its 900 ms, so the page's frames and its clock are held and +# stepped here, 16 ms a frame, and what the page showed at each is read. Every frame the page asks for in the meantime +# (its other loops too) waits for the step and is handed back to the real frames after. +STEP_THE_FLIP = """async (selector) => { + const real = { now: Date.now, raf: window.requestAnimationFrame, caf: window.cancelAnimationFrame }; + const t0 = real.now.call(Date); + let virtual = t0, queue = [], serial = 0; + Date.now = () => virtual; + window.requestAnimationFrame = (cb) => { queue.push([++serial, cb]); return serial; }; + window.cancelAnimationFrame = (id) => { queue = queue.filter((q) => q[0] !== id); }; + const seen = []; + try { + const el = document.querySelector(selector), r = el.getBoundingClientRect(); + const at = { bubbles: true, clientX: r.left + r.width / 2, clientY: r.top + r.height / 2, pointerId: 1, pointerType: 'mouse', isPrimary: true }; + el.dispatchEvent(new PointerEvent('pointerdown', at)); + el.dispatchEvent(new PointerEvent('pointerup', at)); + el.dispatchEvent(new MouseEvent('click', at)); + for (let frames = 0; _almRunToRAF && frames < 600; frames++) { + virtual += 16; + const due = queue; queue = []; + due.forEach((q) => q[1](virtual)); + seen.push(_almFocusInstant().getTime()); + } + } finally { + Date.now = real.now; window.requestAnimationFrame = real.raf; window.cancelAnimationFrame = real.caf; + queue.forEach((q) => real.raf.call(window, q[1])); + } + return seen; +}""" + + def _page(browser, served, width=390, place=SF, tz=LA, init=""): phone = width < 600 ctx = browser.new_context( @@ -71,8 +112,8 @@ def _page(browser, served, width=390, place=SF, tz=LA, init=""): timezone_id=tz, ) ctx.add_init_script( - "try { localStorage.setItem('zimi_app_theme', 'dark'); localStorage.setItem('zimi_almanac_place', %r); }" - " catch (e) {}" % place + "try { localStorage.setItem('zimi_app_theme', 'dark'); localStorage.setItem('zimi_almanac_place', %r);" + " localStorage.setItem('zimi_sky_settings', %r); } catch (e) {}" % (place, QUIET_SKY) ) if init: ctx.add_init_script(init) @@ -92,13 +133,20 @@ def _page(browser, served, width=390, place=SF, tz=LA, init=""): def _land(pg, iso): """Park the clock, paused, on an instant (a typed moment keeps the pace, so a test of typing stands it still first).""" pg.evaluate("(iso) => { _almClockSetRate(0); _almClockGoTo(new Date(iso)); }", iso) - pg.wait_for_function("() => !_almEd", timeout=5000, polling=POLL_MS) + # The moment is the page's answer; `!_almEd` alone was true the instant the call returned, so a timeout here was the page + # not answering at all, not a state that never came. + pg.wait_for_function( + "(ms) => !_almEd && _almRate === 0 && _almFocusInstant().getTime() === ms", + arg=int(datetime.fromisoformat(iso.replace("Z", "+00:00")).timestamp() * 1000), + timeout=FRAME_BOUND_MS, + polling=POLL_MS, + ) def _open(pg): """A tap on the resting clock's time opens it: the slider shows.""" pg.click("#almanac-head-time .ep[data-p=hour]") - pg.wait_for_function("() => !document.querySelector('#almanac-head .alm-clock').classList.contains('alm-ck-rest')", timeout=5000) + pg.wait_for_function("() => !document.querySelector('#almanac-head .alm-clock').classList.contains('alm-ck-rest')", timeout=FRAME_BOUND_MS) def _wall(pg): @@ -116,12 +164,12 @@ def _edit(pg, part, text, key="Enter"): pg.wait_for_function( "(p) => !!_almEd && _almEd.part === p && document.activeElement && document.activeElement.className === 'ef'", arg=part, - timeout=5000, + timeout=FRAME_BOUND_MS, polling=POLL_MS, ) pg.keyboard.type(text) pg.keyboard.press(key) - pg.wait_for_function("() => !_almEd", timeout=10_000, polling=POLL_MS) + pg.wait_for_function("() => !_almEd", timeout=FRAME_BOUND_MS, polling=POLL_MS) def test_each_part_is_typed_where_it_stands(browser, served): @@ -146,43 +194,33 @@ def test_each_part_is_typed_where_it_stands(browser, served): ), head # AM/PM flips on a tap, running back through the twelve hours (PM to AM) rather than jumping. The run is # stretched here so a slow software-GL frame rate still lands frames in between. - pg.evaluate("() => { ALM_CLOCK_FLIP_MS = 6000; }") before = pg.evaluate("() => _almFocusInstant().getTime()") - pg.evaluate( - "() => { window._ckSeen = []; (function rec() { window._ckSeen.push(_almFocusInstant().getTime()); if (window._ckSeen.length < 400) requestAnimationFrame(rec); })(); }" - ) - pg.click("#almanac-head-time .ep[data-p=ap]") - pg.wait_for_function( - "() => !_almRunToRAF && document.querySelector('#almanac-head-time .ep[data-p=ap]').textContent === 'AM'", - timeout=30_000, - polling=POLL_MS, - ) + seen = pg.evaluate(STEP_THE_FLIP, "#almanac-head-time .ep[data-p=ap]") + assert pg.evaluate("() => document.querySelector('#almanac-head-time .ep[data-p=ap]').textContent") == "AM" assert _wall(pg)[3] == 9 - seen = pg.evaluate("() => window._ckSeen") half = 12 * 3600 * 1000 between = [v for v in seen if before - half < v < before] assert between, "the flip jumped instead of running through the hours" assert between == sorted(between, reverse=True), "PM to AM runs backwards" # And AM to PM runs forward. at = pg.evaluate("() => _almFocusInstant().getTime()") - pg.evaluate("() => { window._ckSeen = []; (function rec() { window._ckSeen.push(_almFocusInstant().getTime()); if (window._ckSeen.length < 400) requestAnimationFrame(rec); })(); }") - pg.click("#almanac-head-time .ep[data-p=ap]") - pg.wait_for_function("() => !_almRunToRAF && _almFocusInstant().getTime() === %d" % (at + half), timeout=10_000, polling=POLL_MS) - fwd = [v for v in pg.evaluate("() => window._ckSeen") if at < v < at + half] + seen = pg.evaluate(STEP_THE_FLIP, "#almanac-head-time .ep[data-p=ap]") + assert pg.evaluate("() => _almFocusInstant().getTime()") == at + half + fwd = [v for v in seen if at < v < at + half] assert fwd and fwd == sorted(fwd) - pg.click("#almanac-head-time .ep[data-p=ap]") - pg.wait_for_function("() => !_almRunToRAF && _almFocusInstant().getTime() === %d" % at, timeout=10_000, polling=POLL_MS) + seen = pg.evaluate(STEP_THE_FLIP, "#almanac-head-time .ep[data-p=ap]") + assert pg.evaluate("() => _almFocusInstant().getTime()") == at # The month is a twelve-cell popover; a pick lands it. pg.click("#almanac-head-date .ep[data-p=month]") - pg.wait_for_selector(".alm-ck-pop", timeout=5000) + pg.wait_for_selector(".alm-ck-pop", timeout=FRAME_BOUND_MS) assert pg.locator(".alm-ck-pop button").count() == 12 pg.click(".alm-ck-pop button[data-m='3']") - pg.wait_for_function("() => !_almEd", timeout=10_000, polling=POLL_MS) + pg.wait_for_function("() => !_almEd", timeout=FRAME_BOUND_MS, polling=POLL_MS) assert _wall(pg)[1] == 3 and pg.locator(".alm-ck-pop").count() == 0 # Typing a day the month does not have lands on its last. pg.click("#almanac-head-date .ep[data-p=month]") pg.click(".alm-ck-pop button[data-m='2']") - pg.wait_for_function("() => !_almEd", timeout=10_000, polling=POLL_MS) + pg.wait_for_function("() => !_almEd", timeout=FRAME_BOUND_MS, polling=POLL_MS) _edit(pg, "day", "31") assert _wall(pg)[1:3] == [2, 28] assert not errors, errors @@ -195,10 +233,10 @@ def test_escape_puts_a_part_back_and_a_tap_away_lands_it(browser, served): try: _land(pg, "2026-11-07T20:34:00Z") pg.click("#almanac-head-date .ep[data-p=day]") - pg.wait_for_function("() => !!_almEd", timeout=5000) + pg.wait_for_function("() => !!_almEd", timeout=FRAME_BOUND_MS) pg.keyboard.type("21") pg.keyboard.press("Escape") - pg.wait_for_function("() => !_almEd", timeout=5000) + pg.wait_for_function("() => !_almEd", timeout=FRAME_BOUND_MS) assert _wall(pg)[2] == 7 assert pg.evaluate( "() => document.getElementById('almanac-head-date').textContent" @@ -206,14 +244,14 @@ def test_escape_puts_a_part_back_and_a_tap_away_lands_it(browser, served): pg.click("#almanac-head-date .ep[data-p=day]") pg.keyboard.type("21") pg.mouse.click(5, 600) # away - pg.wait_for_function("() => !_almEd", timeout=10_000, polling=POLL_MS) + pg.wait_for_function("() => !_almEd", timeout=FRAME_BOUND_MS, polling=POLL_MS) assert _wall(pg)[2] == 21 # Another part lands the first and opens itself. pg.click("#almanac-head-date .ep[data-p=day]") pg.keyboard.type("3") pg.click("#almanac-head-time .ep[data-p=hour]") pg.wait_for_function( - "() => !!_almEd && _almEd.part === 'hour'", timeout=10_000, polling=POLL_MS + "() => !!_almEd && _almEd.part === 'hour'", timeout=FRAME_BOUND_MS, polling=POLL_MS ) assert _wall(pg)[2] == 3 pg.keyboard.press("Escape") @@ -231,7 +269,7 @@ def test_the_nearest_part_to_the_finger_wins(browser, served): box = pg.locator("#almanac-head-date .ep[data-p=day]").bounding_box() # Six pixels off to the left, outside the day, nearer to it than to the month. pg.mouse.click(box["x"] - 3, box["y"] + box["height"] / 2) - pg.wait_for_function("() => !!_almEd", timeout=5000) + pg.wait_for_function("() => !!_almEd", timeout=FRAME_BOUND_MS) assert pg.evaluate("() => _almEd.part") == "day" pg.keyboard.press("Escape") # Well clear of every part: nothing opens. @@ -257,13 +295,13 @@ def test_a_minus_means_bc(browser, served): pg.click("#almanac-head-date .ep[data-p=era]") pg.wait_for_function( "() => document.getElementById('almanac-head-date').textContent.indexOf('BC') < 0", - timeout=10_000, + timeout=FRAME_BOUND_MS, polling=POLL_MS, ) assert _wall(pg)[0] == 44 # While the year is typed the field says it the way it is typed. pg.click("#almanac-head-date .ep[data-p=year]") - pg.wait_for_function("() => !!_almEd && _almEd.input", timeout=5000) + pg.wait_for_function("() => !!_almEd && _almEd.input", timeout=FRAME_BOUND_MS) assert pg.evaluate("() => _almEd.input.value") == "44" # A number pad has no minus: the era beside the field flips it, and keeps the field's focus. assert pg.locator(".alm-ck-era").inner_text() == "AD" @@ -274,7 +312,7 @@ def test_a_minus_means_bc(browser, served): ) assert pg.evaluate("() => document.activeElement === _almEd.input") pg.keyboard.press("Enter") - pg.wait_for_function("() => !_almEd", timeout=10_000, polling=POLL_MS) + pg.wait_for_function("() => !_almEd", timeout=FRAME_BOUND_MS, polling=POLL_MS) assert _wall(pg)[0] == -43 assert not errors, errors finally: @@ -369,7 +407,7 @@ def test_the_slider_drags_continuously_and_lands_on_its_stops(browser, served): pg.mouse.move(_stop_x(box, 3), y) pg.mouse.move(_stop_x(box, 4.05), y) pg.mouse.up() - pg.wait_for_function("() => _almRate === 1", timeout=5000) + pg.wait_for_function("() => _almRate === 1", timeout=FRAME_BOUND_MS) # A tap on a unit's mark goes to its stop. pg.click("#almanac-head .alm-spd-mark[data-stop='7']", force=True) assert pg.evaluate("() => _almRate") == 86400 @@ -386,7 +424,7 @@ def test_the_middle_button_pauses_and_resumes(browser, served): # At real time the thumb stands on the button: a tap on the thumb pauses. box = pg.locator("#almanac-head .alm-spd-range").bounding_box() pg.mouse.click(_stop_x(box, 4), box["y"] + box["height"] / 2) - pg.wait_for_function("() => _almRate === 0", timeout=5000) + pg.wait_for_function("() => _almRate === 0", timeout=FRAME_BOUND_MS) held = pg.evaluate("() => _almFocusInstant().getTime()") pg.wait_for_timeout(1200) assert ( @@ -413,7 +451,7 @@ def test_the_middle_button_pauses_and_resumes(browser, served): # Running fast, the parts are not underlined and a tap on one types nothing. pg.wait_for_function( "() => /rgba\\(0, 0, 0, 0\\)|transparent/.test(getComputedStyle(document.querySelector('#almanac-head-time .ep[data-p=hour]')).textDecorationColor)", - timeout=5000, + timeout=FRAME_BOUND_MS, polling=POLL_MS, ) # The part is redrawn every tick at this pace and can be momentarily empty, so the tap is dispatched, not aimed. @@ -434,7 +472,7 @@ def test_the_middle_button_pauses_and_resumes(browser, served): pg.wait_for_function("(a) => _almFocusInstant().getTime() < a", arg=a, timeout=30_000, polling=POLL_MS) # Now is the way home. pg.click("#almanac-head .alm-ck-now") - pg.wait_for_function("() => _almRate === 1 && !_almFocus", timeout=5000) + pg.wait_for_function("() => _almRate === 1 && !_almFocus", timeout=FRAME_BOUND_MS) assert pg.evaluate( "() => document.querySelector('#almanac-head .alm-ck-now').hidden" ) @@ -451,14 +489,14 @@ def test_the_clock_and_the_section_bar_pin_as_one_strip(browser, served): pg.evaluate("() => document.getElementById('almanac-content').scrollTo(0, 900)") pg.wait_for_function( "() => !document.getElementById('alm-pin').hidden", - timeout=5000, + timeout=FRAME_BOUND_MS, polling=POLL_MS, ) # At rest the strip is the section bar alone: the time pins only while the clock is in use. bare = pg.evaluate("() => [getComputedStyle(document.querySelector('#alm-pin .alm-pin-clock')).display, document.getElementById('alm-pin').getBoundingClientRect().height]") assert bare[0] == "none" and bare[1] < ALM_SECBAR_H_PX + 8, bare pg.evaluate("() => _almClockOpenUp(true)") - pg.wait_for_function("() => getComputedStyle(document.querySelector('#alm-pin .alm-pin-clock')).display !== 'none'", timeout=5000, polling=POLL_MS) + pg.wait_for_function("() => getComputedStyle(document.querySelector('#alm-pin .alm-pin-clock')).display !== 'none'", timeout=FRAME_BOUND_MS, polling=POLL_MS) got = pg.evaluate( """() => { var pin = document.getElementById('alm-pin'), r = pin.getBoundingClientRect(), c = pin.querySelector('.alm-clock').getBoundingClientRect(), b = document.getElementById('alm-secbar').getBoundingClientRect(); return { top: r.top, h: r.height, clockBottom: c.bottom, barTop: b.top, bars: document.querySelectorAll('.alm-secbar, .alm-pin').length, @@ -475,12 +513,12 @@ def test_the_clock_and_the_section_bar_pin_as_one_strip(browser, served): pg.click("#alm-pin .ep[data-p=day]") pg.wait_for_function( "() => !!_almEd && _almEd.root.getAttribute('data-v') === 'pin'", - timeout=5000, + timeout=FRAME_BOUND_MS, polling=POLL_MS, ) pg.keyboard.type("12") pg.keyboard.press("Enter") - pg.wait_for_function("() => !_almEd", timeout=10_000, polling=POLL_MS) + pg.wait_for_function("() => !_almEd", timeout=FRAME_BOUND_MS, polling=POLL_MS) assert _wall(pg)[2] == 12 assert ( pg.evaluate( @@ -492,7 +530,7 @@ def test_the_clock_and_the_section_bar_pin_as_one_strip(browser, served): pg.evaluate("() => document.getElementById('almanac-content').scrollTo(0, 0)") pg.wait_for_function( "() => document.getElementById('alm-pin').hidden", - timeout=5000, + timeout=FRAME_BOUND_MS, polling=POLL_MS, ) assert not errors, errors @@ -534,7 +572,7 @@ def test_one_clock_in_the_page_the_orrery_and_the_3d_view(browser, served): ) # Play in the view: forward runs the one clock, the page's moment moves, the view draws it. pg.click("#ae-clock .alm-spd-play", force=True) - pg.wait_for_function("() => _almRate !== 0", timeout=5000) + pg.wait_for_function("() => _almRate !== 0", timeout=FRAME_BOUND_MS) a = pg.evaluate("() => _almFocusInstant().getTime()") pg.evaluate("() => _almClockSetRate(3600)") pg.wait_for_function("(a) => _almFocusInstant().getTime() > a + 60000", arg=a, timeout=30_000, polling=POLL_MS) @@ -567,7 +605,7 @@ def test_one_clock_in_the_page_the_orrery_and_the_3d_view(browser, served): pg.click("#ae-clock .ep[data-p=day]") pg.wait_for_function( "() => !!_almEd && _almEd.root.getAttribute('data-v') === 'foot'", - timeout=5000, + timeout=FRAME_BOUND_MS, polling=POLL_MS, ) pg.keyboard.press("Escape") @@ -578,7 +616,7 @@ def test_one_clock_in_the_page_the_orrery_and_the_3d_view(browser, served): assert abs(shift["shift"] - shift["half"]) < 1.5, shift # Closing the view leaves the page on the moment. pg.evaluate("() => _aeClose()") - pg.wait_for_function("() => !_aeIsOpen", timeout=10_000, polling=POLL_MS) + pg.wait_for_function("() => !_aeIsOpen", timeout=FRAME_BOUND_MS, polling=POLL_MS) assert pg.evaluate("() => _almFocusInstant().getTime()") == held assert not errors, errors finally: @@ -599,7 +637,7 @@ def test_the_slider_rests_at_now_and_a_picked_day_keeps_the_pace(browser, served pg.click("#almanac-head-time .ep[data-p=hour]") assert not pg.evaluate(rests) and pg.evaluate(shown) and pg.evaluate("() => !_almEd") pg.mouse.click(195, 700) - pg.wait_for_function(rests, timeout=5000, polling=POLL_MS) + pg.wait_for_function(rests, timeout=FRAME_BOUND_MS, polling=POLL_MS) # A day picked on the calendar: the next day at the same time of day, and the clock runs on at 1x, in step. pg.evaluate( "() => { var f = _almFocusInstant(); _almSelectDay(_gregorianToJDN(f.getFullYear(), f.getMonth() + 1, f.getDate()) + 1); }" @@ -672,7 +710,7 @@ def test_the_rate_does_not_persist(browser, served): # A run through the hours under way (AM/PM flipped) as it closes: it stops with the page. pg.evaluate("() => { _almReduceMotion = function () { return false; }; _almClockRunTo(new Date(Date.now() + 12 * 3600e3), function (at) { _almClockHeld = false; _almClockGoTo(at); }); }") pg.evaluate("() => closeAlmanac()") - pg.wait_for_function("() => _almRate === 1 && !_almClockRunning && !_almRunToRAF && _almFocus === null", timeout=5000) + pg.wait_for_function("() => _almRate === 1 && !_almClockRunning && !_almRunToRAF && _almFocus === null", timeout=FRAME_BOUND_MS) pg.wait_for_timeout(2500) # past the run's length: nothing came back to life assert pg.evaluate("() => !_almRunToRAF && !_almClockRunning && _almFocus === null") assert not errors, errors @@ -688,7 +726,7 @@ def test_a_day_picked_keeps_the_place_s_time_of_day(browser, served): _land(pg, "2026-11-07T23:00:00Z") # 08:00 Nov 8 in Tokyo, 15:00 Nov 7 in Los Angeles assert _wall(pg)[:4] == [2026, 11, 8, 8] pg.evaluate("() => _almSelectDay(_gregorianToJDN(2026, 11, 20))") - pg.wait_for_function("() => !_almRunToRAF", timeout=5000, polling=POLL_MS) + pg.wait_for_function("() => !_almRunToRAF", timeout=FRAME_BOUND_MS, polling=POLL_MS) assert _wall(pg)[:4] == [2026, 11, 20, 8] assert not errors, errors finally: diff --git a/tests/test_almanac_flyto_browser.py b/tests/test_almanac_flyto_browser.py index dda743ee1..28642e1b2 100644 --- a/tests/test_almanac_flyto_browser.py +++ b/tests/test_almanac_flyto_browser.py @@ -20,6 +20,7 @@ GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] VIEW = {"width": 390, "height": 844} diff --git a/tests/test_almanac_hd_browser.py b/tests/test_almanac_hd_browser.py index 8820b9a0c..800a1a5f6 100644 --- a/tests/test_almanac_hd_browser.py +++ b/tests/test_almanac_hd_browser.py @@ -19,6 +19,7 @@ GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] VIEW = {"width": 390, "height": 844} diff --git a/tests/test_almanac_iss_browser.py b/tests/test_almanac_iss_browser.py index 6d8a3e89c..37d78a85a 100644 --- a/tests/test_almanac_iss_browser.py +++ b/tests/test_almanac_iss_browser.py @@ -19,6 +19,7 @@ GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] PLACE = '{"lat":37.77,"lon":-122.42,"name":"San Francisco"}' diff --git a/tests/test_almanac_landmarks_bodies_browser.py b/tests/test_almanac_landmarks_bodies_browser.py index 3ae050e5d..e4affdd1f 100644 --- a/tests/test_almanac_landmarks_bodies_browser.py +++ b/tests/test_almanac_landmarks_bodies_browser.py @@ -21,6 +21,7 @@ GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] VIEW = {"width": 390, "height": 844} diff --git a/tests/test_almanac_landmarks_browser.py b/tests/test_almanac_landmarks_browser.py index f28fccd7d..41ca5aa8d 100644 --- a/tests/test_almanac_landmarks_browser.py +++ b/tests/test_almanac_landmarks_browser.py @@ -18,6 +18,7 @@ GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] VIEW = {"width": 390, "height": 844} diff --git a/tests/test_almanac_layout_browser.py b/tests/test_almanac_layout_browser.py index 13b3390c9..aee9b1129 100644 --- a/tests/test_almanac_layout_browser.py +++ b/tests/test_almanac_layout_browser.py @@ -28,7 +28,7 @@ GL_ARGS = ( [] if sys.platform == "darwin" - else ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"] + else ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-accelerated-2d-canvas"] ) VIEW = {"width": 390, "height": 844} PLACE = {"lat": 37.7749, "lon": -122.4194, "name": "San Francisco"} diff --git a/tests/test_almanac_link_browser.py b/tests/test_almanac_link_browser.py index 950372262..e72eabd06 100644 --- a/tests/test_almanac_link_browser.py +++ b/tests/test_almanac_link_browser.py @@ -16,6 +16,7 @@ GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] READY_MS = 180_000 diff --git a/tests/test_almanac_live_sky_browser.py b/tests/test_almanac_live_sky_browser.py index 05de43931..d3731e9a0 100644 --- a/tests/test_almanac_live_sky_browser.py +++ b/tests/test_almanac_live_sky_browser.py @@ -30,7 +30,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"] +GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-accelerated-2d-canvas"] VIEW = {"width": 390, "height": 844} PLACE = {"lat": 37.7749, "lon": -122.4194, "name": "San Francisco"} DAY = "2026-09-30T21:00:00Z" # 14:00 in San Francisco, the Sun high in the south diff --git a/tests/test_almanac_look_browser.py b/tests/test_almanac_look_browser.py index bd6033ace..f1c705d1c 100644 --- a/tests/test_almanac_look_browser.py +++ b/tests/test_almanac_look_browser.py @@ -33,7 +33,7 @@ GL_ARGS = ( [] if sys.platform == "darwin" - else ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"] + else ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-accelerated-2d-canvas"] ) VIEW = {"width": 390, "height": 844} PLACE = {"lat": 37.7749, "lon": -122.4194, "name": "San Francisco"} diff --git a/tests/test_almanac_pan_browser.py b/tests/test_almanac_pan_browser.py index 7b624b4f6..427cc9a6d 100644 --- a/tests/test_almanac_pan_browser.py +++ b/tests/test_almanac_pan_browser.py @@ -22,6 +22,7 @@ GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] VIEW = {"width": 390, "height": 844} @@ -171,9 +172,15 @@ def test_two_fingers_slide_the_view_across_the_station_and_pinch_zooms(station): dist0 = pg.evaluate("() => _ae.dist") # Two fingers 120 px apart move together 40 px right and 30 px down, spreading to 160 px: slide and zoom at once. touches(cdp, "touchStart", [(135, 400), (255, 400)]) + # Moves reach the page aligned to its frames, and a frame holds only the latest of the moves sent before it: two sent + # back to back on a slow runner arrive as one (the spread and the slide together), and the slide is then measured + # at a different distance from the station. Each is sent once the page has taken the one before. touches(cdp, "touchMove", [(115, 415), (275, 415)]) + pg.wait_for_function( + "() => !!_ae.pinch && _ae.pinch.span === 160 && _ae.pinch.mx === 195 && _ae.pinch.my === 415", + timeout=10_000, + ) touches(cdp, "touchMove", [(155, 430), (315, 430)]) - # Moves reach the page aligned to its frames: the state is read once the last one has, not while it is on its way. pg.wait_for_function( "() => !!_ae.pinch && _ae.pinch.span === 160 && _ae.pinch.mx === 235 && _ae.pinch.my === 430", timeout=10_000, diff --git a/tests/test_almanac_phone_defects_browser.py b/tests/test_almanac_phone_defects_browser.py index 700c57f4b..516123b77 100644 --- a/tests/test_almanac_phone_defects_browser.py +++ b/tests/test_almanac_phone_defects_browser.py @@ -17,6 +17,7 @@ GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] VIEW = {"width": 390, "height": 844} diff --git a/tests/test_almanac_places_browser.py b/tests/test_almanac_places_browser.py index e3d1f2c36..9d2077f85 100644 --- a/tests/test_almanac_places_browser.py +++ b/tests/test_almanac_places_browser.py @@ -25,6 +25,7 @@ GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] VIEW = {"width": 390, "height": 844} diff --git a/tests/test_almanac_planets_browser.py b/tests/test_almanac_planets_browser.py index 028e3fe5a..124583900 100644 --- a/tests/test_almanac_planets_browser.py +++ b/tests/test_almanac_planets_browser.py @@ -20,6 +20,7 @@ GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] VIEW = {"width": 390, "height": 844} diff --git a/tests/test_almanac_sky_physical_browser.py b/tests/test_almanac_sky_physical_browser.py index d5323d6fe..e2913845f 100644 --- a/tests/test_almanac_sky_physical_browser.py +++ b/tests/test_almanac_sky_physical_browser.py @@ -29,7 +29,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"] +GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-accelerated-2d-canvas"] VIEW = {"width": 390, "height": 844} PLACE = {"lat": 37.7749, "lon": -122.4194, "name": "San Francisco"} NIGHT = "2026-08-10T08:00:00Z" # 01:00 in San Francisco, Sagittarius low in the south @@ -124,6 +124,20 @@ def _settle(pg, iso): ) +def _page_has_done_its_late_work(pg): + """Until the page has drawn what it draws when it is quiet and given back the space it reserved for it. + + The Almanac's late sections are drawn from a queue that runs between the page's other work, and the tide's reserved + height is released when it is done (17 s after load on a loaded runner, the page 24 px shorter). A test that reads a + place on the page, then acts on it in another turn, begins after that, not on the moment the runner's speed picks. + """ + pg.wait_for_function( + "() => { const p = document.getElementById('almanac-place');" + " return !_quietJobs.length && !_quietBusy && (!p || p.style.minHeight === ''); }", + polling=POLL_MS, + ) + + def _drawn(pg): """Until the GPU sky has its data and has painted with it.""" pg.wait_for_function( @@ -624,6 +638,7 @@ def test_every_bright_star_can_be_tapped_and_its_figure_comes_with_it(browser, s try: _settle(pg, NIGHT) _drawn(pg) + _page_has_done_its_late_work(pg) pg.wait_for_function("() => _skyNames && _skyTapStars > 500", polling=POLL_MS) # Nothing asks for the constellations while the default (no lines) stands. _frames(pg) diff --git a/tests/test_almanac_skyfind_browser.py b/tests/test_almanac_skyfind_browser.py index 93b7a99e7..8a9bd6407 100644 --- a/tests/test_almanac_skyfind_browser.py +++ b/tests/test_almanac_skyfind_browser.py @@ -30,7 +30,7 @@ GL_ARGS = ( [] if sys.platform == "darwin" - else ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"] + else ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-accelerated-2d-canvas"] ) VIEW = {"width": 390, "height": 844} PLACE = {"lat": 37.7749, "lon": -122.4194, "name": "San Francisco"} diff --git a/tests/test_almanac_spin_browser.py b/tests/test_almanac_spin_browser.py index 99b83f6fb..962552b6d 100644 --- a/tests/test_almanac_spin_browser.py +++ b/tests/test_almanac_spin_browser.py @@ -22,6 +22,7 @@ GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] VIEW = {"width": 390, "height": 844} diff --git a/tests/test_almanac_tables_browser.py b/tests/test_almanac_tables_browser.py index 28893dc62..e91fd5bed 100644 --- a/tests/test_almanac_tables_browser.py +++ b/tests/test_almanac_tables_browser.py @@ -32,7 +32,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"] +GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-accelerated-2d-canvas"] VIEW = {"width": 390, "height": 844} SF = { "lat": 37.7749, @@ -117,6 +117,14 @@ def page(served): pg.on("pageerror", lambda e: pg.errors.append(str(e))) pg.goto(served + "/#almanac", wait_until="load") pg.wait_for_function("() => document.getElementById('alm-group-tables')") + # The page keeps growing after it is first drawn: its late sections come when the page is quiet, and the + # tide's reserved space is given back when the tide (or nothing) is drawn. Tests that measure the page's + # height or its end start from there, not from a moment the runner's speed picks. + pg.wait_for_function( + "() => { const p = document.getElementById('almanac-place');" + " return typeof _atRender === 'function' && !!p && p.style.minHeight === '' && !_quietJobs.length && !_quietBusy; }", + timeout=120_000, + ) pg.evaluate("typeof _cancelAllRAF === 'function' && _cancelAllRAF()") yield pg br.close() @@ -403,11 +411,12 @@ def test_a_sheet_stands_above_the_keyboard(page): "() => { const vv = window.visualViewport; Object.defineProperty(vv, 'height', { configurable: true, get: () => innerHeight - 300 });" " vv.dispatchEvent(new Event('resize')); }" ) - # (It moves by a transition: read it once that has run.) + # (It moves by a transition: read it once that has run. A transition ends at the first frame past its time, and a + # runner software-drawing the page makes seconds between frames: the bound is a hang's, not the transition's.) page.wait_for_function( "() => { const p = document.querySelector('.tk-pop'), q = p.querySelector('input'), top = innerHeight - 300;" " return p.getBoundingClientRect().bottom <= top + 1 && q.getBoundingClientRect().bottom <= top; }", - timeout=5000, + timeout=30_000, ) page.evaluate("() => { delete window.visualViewport.height; }") page.keyboard.press("Escape") @@ -625,12 +634,9 @@ def test_back_returns_to_the_almanac_where_it_was(page): page.evaluate( "window.AlmanacRef && document.getElementById('alm-ref') && AlmanacRef.close()" ) - page.wait_for_timeout(300) - page.evaluate("document.getElementById('alm-group-tables').scrollIntoView()") - # The late sections (the tide) and the phone's header settle first. - page.wait_for_timeout(2000) + page.wait_for_function("() => !document.getElementById('alm-ref')") + # The late sections (the tide) are in, and the reserve given back, from the page fixture on. page.evaluate("document.getElementById('alm-group-tables').scrollIntoView()") - page.wait_for_timeout(500) top = page.evaluate("document.getElementById('almanac-content').scrollTop") page.evaluate("document.querySelector(\".alm-tile[data-tb='seasons']\").click()") page.wait_for_function(DRAWN, timeout=60000) @@ -645,16 +651,12 @@ def test_back_returns_to_the_almanac_where_it_was(page): page.evaluate("document.querySelector(\".alm-tile[data-tb='units']\").click()") page.wait_for_function(DRAWN, timeout=60000) page.go_back() - page.wait_for_function("() => !document.getElementById('alm-ref')") - page.wait_for_timeout(300) - assert page.evaluate("_almanacOpen") + page.wait_for_function("() => !document.getElementById('alm-ref') && _almanacOpen") # The view's own Back. page.evaluate("document.querySelector(\".alm-tile[data-tb='days']\").click()") page.wait_for_function(DRAWN, timeout=60000) page.click("[data-tb-close]") - page.wait_for_function("() => !document.getElementById('alm-ref')") - page.wait_for_timeout(300) - assert page.evaluate("_almanacOpen") + page.wait_for_function("() => !document.getElementById('alm-ref') && _almanacOpen") assert not page.errors, page.errors @@ -1228,6 +1230,17 @@ def busy_once(route): assert not page.errors, page.errors +# The failure toast lives 3 s from the moment it is made, and the browser's dialog is asked for after the fonts and two +# frames: on a runner drawing a frame a second the toast is gone before the dialog is asked for. What the test asserts is +# that it was shown, so it is recorded as it is added, not looked for after. +WATCH_TOASTS = """() => { + window.__toasts = []; + new MutationObserver((records) => records.forEach((r) => r.addedNodes.forEach((n) => { + if (n.nodeType === 1 && n.tagName === 'DIV') window.__toasts.push(n.textContent); + }))).observe(document.body, { childList: true }); +}""" + + def test_still_busy_after_the_retry_prints_the_page(page): """Busy twice: the toast, then the browser's own dialog over the book.""" _open(page, "seasons") @@ -1242,6 +1255,7 @@ def busy(route): ) page.route("**/almanac/pdf", busy) + page.evaluate(WATCH_TOASTS) page.evaluate( "() => { window.__printed = 0; window.__pr = window.print; window.print = () => { window.__printed++; }; }" ) @@ -1249,9 +1263,7 @@ def busy(route): page.click("[data-tb-act='print']") page.wait_for_function("() => window.__printed === 1", timeout=30000) assert len(seen) == 2 - assert page.evaluate( - "[...document.querySelectorAll('body > div')].some((d) => d.textContent === t('tb_pdf_failed'))" - ) + assert page.evaluate("t('tb_pdf_failed')") in page.evaluate("window.__toasts") page.evaluate("_tbPrintOff()") finally: page.unroute("**/almanac/pdf") @@ -1267,6 +1279,7 @@ def test_print_falls_back_to_the_page_when_the_pdf_fails(page): "**/almanac/pdf", lambda route: route.fulfill(status=500, body='{"error": "render failed"}'), ) + page.evaluate(WATCH_TOASTS) page.evaluate( "() => { window.__printed = 0; window.__pr = window.print; window.__book = 0;" " window.print = () => { window.__printed++; window.__book = document.querySelectorAll('#alm-book .tb-book-page').length; }; }" @@ -1275,9 +1288,7 @@ def test_print_falls_back_to_the_page_when_the_pdf_fails(page): page.click("[data-tb-act='print']") page.wait_for_function("() => window.__printed === 1", timeout=60000) assert page.evaluate("window.__book") == 1 - assert page.evaluate( - "[...document.querySelectorAll('body > div')].some((d) => d.textContent === t('tb_pdf_failed'))" - ) + assert page.evaluate("t('tb_pdf_failed')") in page.evaluate("window.__toasts") assert not page.evaluate("readerOpen") page.evaluate("_tbPrintOff()") finally: diff --git a/tests/test_almanac_tides_browser.py b/tests/test_almanac_tides_browser.py index cfae850a1..f1641fd65 100644 --- a/tests/test_almanac_tides_browser.py +++ b/tests/test_almanac_tides_browser.py @@ -35,7 +35,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"] +GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-accelerated-2d-canvas"] VIEW = {"width": 390, "height": 844} SF = {"lat": 37.8063, "lon": -122.4659, "name": "San Francisco"} PENSACOLA = {"lat": 30.4044, "lon": -87.2112, "name": "Pensacola"} diff --git a/tests/test_apps_live_prefs_browser.py b/tests/test_apps_live_prefs_browser.py index 900522b1a..894c61747 100644 --- a/tests/test_apps_live_prefs_browser.py +++ b/tests/test_apps_live_prefs_browser.py @@ -147,13 +147,17 @@ def test_manage_maps_pane_redraws_when_the_source_changes(served, browser_ctx): "() => typeof _browseView !== 'undefined' && _browseView === 'drilldown' && manageCategoryFilter === 'maps'", timeout=WAIT_MS, ) - pg.evaluate( - "() => { window._drills = []; var real = drillCategory; drillCategory = function (k) { window._drills.push(k); }; window._realDrill = real; }" + # The account's value comes in: the shell writes it and announces it. The calls are counted in the one turn of the page + # that announces it: the catalog, the library list and the downloads redraw this same view when their own answers land + # (a runner's speed decides whether one lands between two of the test's turns), and those are not this announcement's. + drills = pg.evaluate( + """() => { + var calls = [], real = drillCategory; + drillCategory = function (k) { calls.push(k); }; + try { localStorage.setItem(SK.MAPS_SOURCE, 'streetzim'); _prefApplied([SK.MAPS_SOURCE]); } + finally { drillCategory = real; localStorage.removeItem(SK.MAPS_SOURCE); } + return calls; + }""" ) - # The account's value comes in: the shell writes it and announces it. - pg.evaluate( - "() => { localStorage.setItem(SK.MAPS_SOURCE, 'streetzim'); _prefApplied([SK.MAPS_SOURCE]); }" - ) - assert pg.evaluate("window._drills") == ["maps"] - pg.evaluate("() => { drillCategory = window._realDrill; localStorage.removeItem(SK.MAPS_SOURCE); }") + assert drills == ["maps"] pg.close() diff --git a/tests/test_games_sync_live.py b/tests/test_games_sync_live.py index 57d5407c9..8daad6cf8 100644 --- a/tests/test_games_sync_live.py +++ b/tests/test_games_sync_live.py @@ -127,6 +127,19 @@ def _sent(pg): ) +def _on_server(user, value, timeout=15): + """The account's stored stats, once the push has reached the server: the game's write lands in the shell as a + storage event, so "nothing pending" can be true before the write has been queued at all.""" + import time + + end = time.monotonic() + timeout + while True: + got = users.GAMES.load(user)["settings"].get(STATS, {}).get("v") + if got == value or time.monotonic() > end: + return got + time.sleep(0.1) + + def test_two_people_on_one_browser_each_see_their_own(served): from playwright.sync_api import sync_playwright @@ -136,7 +149,7 @@ def test_two_people_on_one_browser_each_see_their_own(served): _sign_in(pg, "kid") _game_writes(pg, STATS, KID_STATS) _sent(pg) - assert users.GAMES.load("kid")["settings"][STATS]["v"] == KID_STATS + assert _on_server("kid", KID_STATS) == KID_STATS _sign_out(pg) assert _stats(pg) is None, "Kid's games left the screen with Kid" _sign_in(pg, "mum") @@ -189,7 +202,7 @@ def test_a_browsers_games_go_to_the_first_account_quietly_and_never_to_a_second( ) _sign_in(pg, "kid") _sent(pg) - assert users.GAMES.load("kid")["settings"][STATS]["v"] == KID_STATS + assert _on_server("kid", KID_STATS) == KID_STATS assert not toasts, "an empty account takes them without a word" _sign_out(pg) _sign_in(pg, "mum") diff --git a/tests/test_home_apps_live.py b/tests/test_home_apps_live.py index c33def3d9..08e6cfd33 100644 --- a/tests/test_home_apps_live.py +++ b/tests/test_home_apps_live.py @@ -150,7 +150,6 @@ def served(tmp_path_factory): }""" # The app tiles in the row, in order, each marked so a rebuild would show. TILES = "() => Array.from(document.querySelectorAll('#output .apps-grid .app-tile')).map(a => a.dataset.app + (a.__kept ? '' : '*'))" -MARK = "() => document.querySelectorAll('#output .apps-grid .app-tile').forEach(a => { a.__kept = 1; })" SORTED = """(names) => names.every((n, i) => i === 0 || names[i - 1].localeCompare(n, undefined, {sensitivity: 'base', numeric: true}) <= 0)""" # The Apps page: each app's section, its banner and the ZIMs under it, and # how they are drawn: the banner taller than a ZIM's card and wider than the @@ -168,17 +167,31 @@ def served(tmp_path_factory): height: document.documentElement.scrollHeight })""" -def _sort(pg, key): - pg.select_option("#output .lib-sort", key) - pg.wait_for_timeout(600) - # The control names the order it is in, at once (it kept the old name - # until the page was drawn again). +def _names_the_order(pg, key): + """The control names the order it is in, at once (it kept the old name until the page was drawn again).""" assert pg.evaluate( "(k) => document.querySelector('#output .lib-sort-now').textContent === t(_LIBRARY_SORT_LABELS[k])", key, ), key +def _sort(pg, key): + pg.select_option("#output .lib-sort", key) + _names_the_order(pg, key) + + +# Choose an order and read the row in the same turn of the page, the tiles marked just before: Home redraws once more +# when its late data lands (_renderHomeSoon, a timer), and a redraw between a mark and the read is a row drawn again +# whatever the order did. The reorder is synchronous, so one turn holds what the order did and nothing else. +SORT_IN_PLACE = """(k) => { + document.querySelectorAll('#output .apps-grid .app-tile').forEach(a => { a.__kept = 1; }); + const sel = document.querySelector('#output .lib-sort'); + sel.value = k; + sel.dispatchEvent(new Event('change', { bubbles: true })); + return Array.from(document.querySelectorAll('#output .apps-grid .app-tile')).map(a => a.dataset.app + (a.__kept ? '' : '*')); +}""" + + @pytest.mark.parametrize( "size,phone", [({"width": 1440, "height": 900}, False), ({"width": 390, "height": 844}, True)], @@ -208,7 +221,6 @@ def test_the_order_governs_the_apps_and_their_title_opens_their_page( try: pg.goto(served + "/") pg.wait_for_function(HOME, timeout=30000) - pg.wait_for_timeout(500) assert pg.evaluate("document.documentElement.dir") == ( "rtl" if lang == "he" else "" ) @@ -241,13 +253,13 @@ def test_the_order_governs_the_apps_and_their_title_opens_their_page( # The apps follow the order, sliding into place: Ask Ubuntu arrived # last, CrashCourse's new build landed an hour ago. - pg.evaluate(MARK) - _sort(pg, "added") - assert pg.evaluate(TILES)[0] == "exchange", pg.evaluate(TILES) - _sort(pg, "updated") - tiles = pg.evaluate(TILES) + tiles = pg.evaluate(SORT_IN_PLACE, "added") + assert tiles[0] == "exchange", tiles + _names_the_order(pg, "added") + tiles = pg.evaluate(SORT_IN_PLACE, "updated") assert tiles[0] == "tube", "an app holding a just-updated ZIM comes first" assert all(not t.endswith("*") for t in tiles), "moved, not drawn again" + _names_the_order(pg, "updated") _sort(pg, "alpha") names = pg.evaluate( "() => Array.from(document.querySelectorAll('#output .apps-grid .app-tile .zt')).map(e => e.textContent)" @@ -257,8 +269,9 @@ def test_the_order_governs_the_apps_and_their_title_opens_their_page( # The Apps heading opens the Apps page: each app, what is inside it. mid = ((text["l"] + text["r"]) / 2, (text["t"] + text["b"]) / 2) pg.mouse.click(*mid) - pg.wait_for_function("() => homeScope && homeScope.type === 'apps'") - pg.wait_for_timeout(300) + pg.wait_for_function( + "() => homeScope && homeScope.type === 'apps' && document.querySelectorAll('#output > .app-section').length >= 5" + ) assert "scope=apps" in pg.url page = pg.evaluate(PAGE) by_app = {p["app"]: p for p in page} @@ -311,8 +324,7 @@ def test_the_order_governs_the_apps_and_their_title_opens_their_page( ], tube # And the view: tiles, the apps' doors with them. pg.locator("#output .lib-view-btn").nth(1).click() - pg.wait_for_timeout(300) - assert pg.evaluate( + pg.wait_for_function( "() => document.querySelectorAll('#output .stats-grid').length" " === document.querySelectorAll('#output .stats-grid.tiles').length" ) @@ -394,9 +406,14 @@ def test_the_dot_says_what_lit_it(served, touch): arg=dot, ).json_value() pg.mouse.move(x, y) - pg.wait_for_function("() => { const p = document.getElementById('dot-why'); return p && p.querySelector('.upd'); }", timeout=10000) - text = pg.inner_text("#dot-why") - assert "CrashCourse" in text and pg.evaluate("t('upd_updated')") in text, text + # The popover is read when it says it: a redraw of Home under a pointer that does not move opens it again, at + # "Loading…", and the first one's words are gone by the time they are read. + text = pg.wait_for_function( + "(want) => { const p = document.getElementById('dot-why'), t = p && p.innerText;" + " return t && want.every((w) => t.includes(w)) ? t : null; }", + arg=["CrashCourse", pg.evaluate("t('upd_updated')")], + timeout=10000, + ).json_value() assert not pg.evaluate("() => typeof _tubeOpen !== 'undefined' && _tubeOpen"), "the dot is not the tile" if os.environ.get("ZIMI_SHOTS"): pg.screenshot(path=os.path.join(os.environ["ZIMI_SHOTS"], "dot-why-%s.png" % ("tap" if touch else "hover"))) diff --git a/tests/test_keep_card_live.py b/tests/test_keep_card_live.py index 652790f63..6c27559ea 100644 --- a/tests/test_keep_card_live.py +++ b/tests/test_keep_card_live.py @@ -154,13 +154,34 @@ def mark(pg, zim): ) +def _wait_until_the_card_stops_moving(pg, zim): + """The card has the same place on the screen over several frames in a row. + + The page closes an open menu on any scroll of the page, so a menu opened while the card is still being brought into + view (or moved by a late layout) is closed by that movement. + """ + pg.wait_for_function( + """(z) => { + const top = document.querySelector(`.stat-card[data-zim='${z}']`).getBoundingClientRect().top; + const w = window.__cardStill = window.__cardStill && window.__cardStill.z === z ? window.__cardStill : { z: z, top: null, n: 0 }; + w.n = w.top === top ? w.n + 1 : 0; + w.top = top; + return w.n >= 5; + }""", + arg=zim, + timeout=30000, + polling="raf", + ) + pg.evaluate("() => { window.__cardStill = null; }") + + def more(pg, zim): """Tap the card's ⋯ and return the menu's lines.""" pg.evaluate( "(z) => document.querySelector(`.stat-card[data-zim='${z}']`).scrollIntoView({block: 'center'})", zim, ) - pg.wait_for_timeout(250) + _wait_until_the_card_stops_moving(pg, zim) b = pg.evaluate( "(z) => { const r = document.querySelector(`.stat-card[data-zim='${z}'] .card-more`).getBoundingClientRect(); return [r.left + r.width / 2, r.top + r.height / 2]; }", zim, @@ -174,7 +195,7 @@ def more(pg, zim): def pick(pg, action): pg.click("#zim-ctx-menu [data-action='%s']" % action) - pg.wait_for_timeout(200) + pg.wait_for_selector("#zim-ctx-menu.visible", state="hidden", timeout=5000) def keep_one(pg): @@ -196,8 +217,14 @@ def test_a_card_marks_its_state_in_its_foot_beside_its_one_control(pw, world): br, ctx, pg = library(pw, world) keep_one(pg) for view in ("list", "tiles"): - pg.evaluate("(v) => { localStorage.setItem('zimi_library_view', v); renderHome(); }", view) - pg.wait_for_timeout(500) + pg.evaluate( + "(v) => { localStorage.setItem('zimi_library_view', v); renderHome(); }", + view, + ) + pg.wait_for_function( + "(v) => { const g = document.querySelector('#output .stats-grid'); return !!g && g.classList.contains('tiles') === (v === 'tiles'); }", + arg=view, + ) # A ZIM the phone does not hold has no mark at all, and nothing on any card but ⋯ is a button. assert mark(pg, SMALL) is None kinds = pg.evaluate( @@ -215,16 +242,43 @@ def test_a_card_marks_its_state_in_its_foot_beside_its_one_control(pw, world): SMALL, ) assert 0 <= corner[0] <= 8 and 0 <= corner[1] <= 8, (view, corner) - w = pg.evaluate("(z) => document.querySelector(`.stat-card[data-zim='${z}'] .card-more`).getBoundingClientRect().width", SMALL) + w = pg.evaluate( + "(z) => document.querySelector(`.stat-card[data-zim='${z}'] .card-more`).getBoundingClientRect().width", + SMALL, + ) assert w >= (44 if view == "list" else 34), (view, w) # ⋯ opens the card's menu and goes nowhere. lines = more(pg, SMALL) - assert "Keep offline" in lines and "Add to favorites" in lines and "About this ZIM" in lines, lines + assert ( + "Keep offline" in lines + and "Add to favorites" in lines + and "About this ZIM" in lines + ), lines assert pg.evaluate("() => location.pathname") == "/" ctx.close() br.close() +def test_a_scroll_inside_the_open_menu_does_not_close_it(pw, world): + """The page closes a menu on a scroll of the page; the menu's own (an item brought into view, a line that grows) + is not the page's, and closed a menu the moment it opened.""" + br, ctx, pg = library(pw, world) + more(pg, SMALL) + scrolled = pg.evaluate("""() => new Promise((done) => { + const m = document.getElementById('zim-ctx-menu'); + m.style.maxHeight = '120px'; + m.style.overflowY = 'auto'; + m.addEventListener('scroll', () => done(m.scrollTop), { once: true }); + m.scrollTop = 40; + })""") + assert pg.evaluate( + "() => document.getElementById('zim-ctx-menu').classList.contains('visible')" + ), "closed by its own scroll" + assert scrolled > 0 + ctx.close() + br.close() + + def test_keep_offline_from_the_menu_is_the_ring_at_once(pw, world): br, ctx, pg = library(pw, world) keep_one(pg) @@ -272,7 +326,9 @@ def test_removing_a_kept_zim_asks_first(pw, world): assert "Remove from this phone" in lines, lines pick(pg, "keep-remove") pg.wait_for_selector(".pw-overlay.open", timeout=5000) - assert "wikipedia" in pg.evaluate("() => [..._keepNames]"), "nothing goes before the answer" + assert "wikipedia" in pg.evaluate( + "() => [..._keepNames]" + ), "nothing goes before the answer" pg.click("#ac-ok") pg.wait_for_function("() => !document.querySelector('.keep-ico')", timeout=15000) ctx.close() @@ -302,12 +358,15 @@ def test_a_74gb_pull_visibly_moves_in_the_menu(pw, world): assert "Pause" in lines and "Cancel download" in lines, lines note = pg.inner_text("#zim-ctx-menu .ctx-keep-note") assert "74 GB" in note and "/s" in note, note - pg.wait_for_timeout(2200) - assert pg.inner_text("#zim-ctx-menu .ctx-keep-note") != note, "the line moves while the menu is open" + pg.wait_for_function( + "(was) => document.querySelector('#zim-ctx-menu .ctx-keep-note').textContent !== was", + arg=note, + timeout=15000, + ) # the line moves while the menu is open # Pause keeps it as a ring that offers Resume. pick(pg, "keep-pause") pg.wait_for_function( - "(z) => document.querySelector(`.stat-card[data-zim='${z}'] .keep-ico`).dataset.k === 'paused'", + "(z) => { const b = document.querySelector(`.stat-card[data-zim='${z}'] .keep-ico`); return b && b.dataset.k === 'paused'; }", arg=BIG_NAME, timeout=10000, ) @@ -449,7 +508,11 @@ def test_online_on_this_phone_opens_the_categories(pw, world): "() => [...document.querySelectorAll('#output .cat-heading')].map(e => e.innerText.trim().toLowerCase())" ) # Directly below the collections, before the big library flow. - assert heads.index("mine") + 1 == heads.index("on this phone") < heads.index("encyclopedias"), heads + assert ( + heads.index("mine") + 1 + == heads.index("on this phone") + < heads.index("encyclopedias") + ), heads ctx.close() br.close() @@ -474,7 +537,11 @@ def _about_keep_note(pg, zim): def test_storage_the_browser_refuses_is_never_offered(pw, world): # Safari's Private Browsing: getDirectory is there and throws when used. - br, ctx, pg = _page_with(pw, world, "navigator.storage.getDirectory = () => Promise.reject(new DOMException('no', 'UnknownError'));") + br, ctx, pg = _page_with( + pw, + world, + "navigator.storage.getDirectory = () => Promise.reject(new DOMException('no', 'UnknownError'));", + ) pg.wait_for_function("() => _keepStorageOk === false", timeout=10000) assert not pg.query_selector(".keep-ico"), "no mark a tap cannot keep" assert "cannot keep files" in _about_keep_note(pg, SMALL) @@ -483,7 +550,9 @@ def test_storage_the_browser_refuses_is_never_offered(pw, world): def test_an_insecure_address_says_https_is_needed(pw, world): - br, ctx, pg = _page_with(pw, world, "Object.defineProperty(window, 'isSecureContext', { value: false });") + br, ctx, pg = _page_with( + pw, world, "Object.defineProperty(window, 'isSecureContext', { value: false });" + ) assert pg.evaluate("() => _keepAvailable()") is False assert "HTTPS" in _about_keep_note(pg, SMALL) ctx.close() @@ -504,9 +573,11 @@ def test_the_menu_opens_on_a_part_kept_zim_after_a_reload(pw, world): pick(pg, "keep-start") pg.wait_for_function("() => KeepStore.state().written > 2e6", timeout=20000) pg.evaluate("() => KeepStore.stop()") - pg.wait_for_timeout(1000) + pg.wait_for_function("() => KeepStore.state().phase !== 'pulling'", timeout=15000) pg.reload(wait_until="load") - pg.wait_for_selector(".stat-card[data-zim='%s'] .keep-ico.paused" % BIG_NAME, timeout=20000) + pg.wait_for_selector( + ".stat-card[data-zim='%s'] .keep-ico.paused" % BIG_NAME, timeout=20000 + ) errors = [] pg.on("pageerror", lambda e: errors.append(str(e))) lines = more(pg, BIG_NAME) @@ -519,13 +590,22 @@ def test_the_menu_opens_on_a_part_kept_zim_after_a_reload(pw, world): def test_on_a_phone_the_menu_is_a_sheet_from_the_bottom(pw, world): br, ctx, pg = library(pw, world) more(pg, SMALL) - pg.wait_for_timeout(350) + # The sheet comes up by a transition: read it where it stands. + pg.wait_for_function( + "() => { const b = document.getElementById('zim-ctx-menu').getBoundingClientRect(); return Math.abs(b.bottom - innerHeight) <= 1; }", + timeout=30000, + ) r = pg.evaluate( """() => { const m = document.getElementById('zim-ctx-menu'), b = m.getBoundingClientRect(); return { sheet: m.classList.contains('sheet'), left: b.left, right: b.right, bottom: b.bottom, w: innerWidth, h: innerHeight, head: (m.querySelector('.ctx-head') || {}).innerText || '', backdrop: !document.getElementById('ctx-backdrop').hidden }; }""" ) - assert r["sheet"] and r["left"] == 0 and r["right"] == r["w"] and abs(r["bottom"] - r["h"]) <= 1, r + assert ( + r["sheet"] + and r["left"] == 0 + and r["right"] == r["w"] + and abs(r["bottom"] - r["h"]) <= 1 + ), r assert "Wikiquote" in r["head"] and r["backdrop"], r # A submenu opens in place under its row, inside the sheet. pg.click("#zim-ctx-menu > .ctx-item:has(> .ctx-sub)") @@ -533,10 +613,15 @@ def test_on_a_phone_the_menu_is_a_sheet_from_the_bottom(pw, world): """() => { const s = document.querySelector('#zim-ctx-menu .sub-open > .ctx-sub'), b = s && s.getBoundingClientRect(); return s && { pos: getComputedStyle(s).position, left: b.left, right: b.right, w: innerWidth }; }""" ) - assert sub and sub["pos"] == "static" and sub["left"] >= 0 and sub["right"] <= sub["w"], sub + assert ( + sub and sub["pos"] == "static" and sub["left"] >= 0 and sub["right"] <= sub["w"] + ), sub # The backdrop closes it. pg.mouse.click(195, 40) - pg.wait_for_function("() => !document.getElementById('zim-ctx-menu').classList.contains('visible')", timeout=3000) + pg.wait_for_function( + "() => !document.getElementById('zim-ctx-menu').classList.contains('visible')", + timeout=3000, + ) assert pg.evaluate("() => document.getElementById('ctx-backdrop').hidden") ctx.close() br.close() diff --git a/tests/test_moon_handoff_live.py b/tests/test_moon_handoff_live.py index bf4ce131a..8dd018bb8 100644 --- a/tests/test_moon_handoff_live.py +++ b/tests/test_moon_handoff_live.py @@ -39,7 +39,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"] +GL_ARGS = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--disable-accelerated-2d-canvas"] VIEW = {"width": 390, "height": 844} DPR = 2 MAD_MAX = 3.5 diff --git a/tests/test_own_zims_kiwix_serve.py b/tests/test_own_zims_kiwix_serve.py index e411619a4..cf8d26a65 100644 --- a/tests/test_own_zims_kiwix_serve.py +++ b/tests/test_own_zims_kiwix_serve.py @@ -30,6 +30,7 @@ GL_ARGS = [ "--use-angle=swiftshader", "--enable-unsafe-swiftshader", + "--disable-accelerated-2d-canvas", "--ignore-gpu-blocklist", ] VIEW = {"width": 390, "height": 844} diff --git a/tests/test_subproc_external.py b/tests/test_subproc_external.py index 8e07ac026..04923da02 100644 --- a/tests/test_subproc_external.py +++ b/tests/test_subproc_external.py @@ -146,3 +146,54 @@ def test_a_bare_program_name_is_looked_up_on_the_childs_path_not_in_the_bundle(m assert seen[-1]["env"]["LD_LIBRARY_PATH"] == "/usr/local/lib" assert os.path.normcase(subproc._resolved("piper")) == os.path.normcase(str(outside / name)) assert not subproc._in_bundle("piper") + + +def test_a_venv_in_the_data_folder_beside_the_executable_is_not_the_bundle(monkeypatch, tmp_path): + """#151: the voices venv lives in /zims/.zimi/tools/voices, beside the executable. Its python is an + outside program, so the install command (``/bin/python -m pip``) must get the machine's environment too.""" + import json + + folder = tmp_path / "zimi-1.0-linux-arm64" + (folder / "_internal").mkdir(parents=True) + (folder / "zimi").write_text("", encoding="utf-8") + bundle = folder / "_internal" + (bundle / "libssl.so.3").write_text("not a library", encoding="utf-8") + venv = folder / "zims" / ".zimi" / "tools" / "voices" + subprocess.run([sys.executable, "-m", "venv", str(venv)], check=True, capture_output=True) + python = venv / ("Scripts/python.exe" if os.name == "nt" else "bin/python") + + monkeypatch.setattr(sys, "frozen", True, raising=False) + monkeypatch.setattr(sys, "_MEIPASS", str(bundle), raising=False) + monkeypatch.setattr(sys, "executable", str(folder / "zimi")) + monkeypatch.setenv("LD_LIBRARY_PATH", str(bundle)) + monkeypatch.setenv("LD_LIBRARY_PATH_ORIG", "/usr/local/lib") + monkeypatch.setenv("PYTHONHOME", str(bundle)) + monkeypatch.setenv("_PYI_APPLICATION_HOME_DIR", str(bundle)) + + assert not subproc._in_bundle(str(python)) + assert subproc._in_bundle(str(folder / "zimi")) and subproc._in_bundle(str(bundle / "lib" / "x.so")) + probe = "import json, os, ssl; print(json.dumps({k: v for k, v in os.environ.items() if k.startswith(('LD_', 'PYTHONHOME', '_PYI_'))}))" + child = subproc.popen([str(python), "-c", probe], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + out, err = child.communicate(timeout=60) + assert child.returncode == 0, err + seen = json.loads(out) + assert seen == {"LD_LIBRARY_PATH": "/usr/local/lib"}, seen + + +def test_doctor_probes_a_venv_python_in_the_data_folder(monkeypatch, tmp_path): + """`zimi doctor --check` in the portable smoke test: the venv python (the one that runs pip) is probed too.""" + from zimi import runtimes + from zimi import server as srv + + machine_python = sys.executable + folder = tmp_path / "app" + (folder / "_internal").mkdir(parents=True) + monkeypatch.setattr(sys, "frozen", True, raising=False) + monkeypatch.setattr(sys, "_MEIPASS", str(folder / "_internal"), raising=False) + monkeypatch.setattr(sys, "executable", str(folder / "zimi")) + monkeypatch.setattr(srv, "ZIMI_DATA_DIR", str(folder / "zimi-data")) + monkeypatch.setenv("LD_LIBRARY_PATH", str(folder / "_internal")) + assert runtimes.outside_python_problem(machine_python, venv=True) is None + assert os.listdir(folder / "zimi-data" / "tools") == [], "the probe venv is removed" + monkeypatch.setattr(subproc, "run", subprocess.run) # the old behaviour + assert "library path" in runtimes.outside_python_problem(machine_python, venv=True) diff --git a/zimi/assets/catalog-icons.tar b/zimi/assets/catalog-icons.tar index cb6b12e49..3649a15be 100644 Binary files a/zimi/assets/catalog-icons.tar and b/zimi/assets/catalog-icons.tar differ diff --git a/zimi/assets/catalog-snapshot.json.gz b/zimi/assets/catalog-snapshot.json.gz index 0055d6543..f43a43021 100644 Binary files a/zimi/assets/catalog-snapshot.json.gz and b/zimi/assets/catalog-snapshot.json.gz differ diff --git a/zimi/assets/map-regions.json b/zimi/assets/map-regions.json index 11175051c..e350df748 100644 --- a/zimi/assets/map-regions.json +++ b/zimi/assets/map-regions.json @@ -1 +1 @@ -{"built_at":"2026-10-28","kiwix":{"maps_en_afghanistan":[60.487,29.387,74.892,38.474],"maps_en_africa":[-18.0,-35.0,52.0,38.0],"maps_en_albania":[19.272,39.637,21.037,42.655],"maps_en_algeria":[-8.682,18.976,11.969,37.094],"maps_en_all":[-180.0,-90.0,180.0,90.0],"maps_en_andes":[-109.454,-55.919,-57.466,15.703],"maps_en_andorra":[1.406,42.429,1.765,42.649],"maps_en_angola":[11.669,-18.031,24.062,-4.391],"maps_en_argentina":[-73.573,-55.052,-53.662,-21.787],"maps_en_armenia":[43.436,38.864,46.603,41.29],"maps_en_asia":[25.0,-11.0,180.0,82.0],"maps_en_australia":[112.919,-54.75,159.106,-9.24],"maps_en_australia-oceania":[110.0,-50.0,-130.0,22.0],"maps_en_austria":[9.521,46.379,17.148,49.01],"maps_en_azerbaijan":[44.775,38.393,50.626,41.89],"maps_en_azores":[-31.4,36.9,-24.9,39.8],"maps_en_bahamas":[-79.594,20.912,-72.746,26.928],"maps_en_balkans":[13.365,34.815,29.7,48.275],"maps_en_bangladesh":[88.022,20.739,92.643,26.624],"maps_en_belarus":[23.166,51.235,32.72,56.157],"maps_en_belgium":[2.522,49.495,6.375,51.496],"maps_en_belize":[-89.237,15.88,-87.783,18.491],"maps_en_benin":[0.76,6.214,3.837,12.399],"maps_en_bhutan":[88.73,26.696,92.089,28.358],"maps_en_bolivia":[-69.666,-22.897,-57.466,-9.68],"maps_en_bosnia-herzegovina":[15.716,42.559,19.619,45.285],"maps_en_botswana":[19.978,-26.892,29.35,-17.782],"maps_en_brazil":[-74.018,-33.742,-28.877,5.267],"maps_en_bulgaria":[22.345,41.238,28.604,44.228],"maps_en_burkina-faso":[-5.523,9.392,2.39,15.08],"maps_en_burundi":[28.987,-4.463,30.834,-2.303],"maps_en_cambodia":[102.313,10.416,107.611,14.705],"maps_en_cameroon":[8.505,1.655,16.208,13.081],"maps_en_canada":[-141.006,41.669,-52.617,83.117],"maps_en_canary-islands":[-18.3,27.6,-13.3,29.5],"maps_en_cape-verde":[-25.36,14.804,-22.667,17.197],"maps_en_central-african-republic":[14.387,2.236,27.441,11.001],"maps_en_central-america":[-92.5,7.0,-77.0,18.5],"maps_en_chad":[13.449,7.456,23.984,23.445],"maps_en_chile":[-109.454,-55.919,-66.421,-17.507],"maps_en_china":[73.602,15.775,134.773,53.569],"maps_en_colombia":[-81.724,-4.236,-66.875,13.578],"maps_en_comores":[43.213,-12.38,44.529,-11.361],"maps_en_congo-democratic-republic-kinshasa":[12.211,-13.458,31.28,5.375],"maps_en_congo-republic-brazzaville":[11.114,-5.02,18.642,3.708],"maps_en_cook-islands":[-165.825,-21.939,-157.313,-8.947],"maps_en_costa-rica":[-87.118,5.515,-82.563,11.21],"maps_en_croatia":[13.501,42.416,19.408,46.547],"maps_en_cuba":[-84.95,19.828,-74.133,23.266],"maps_en_cyprus":[32.272,34.625,34.099,35.187],"maps_en_czech-republic":[12.076,48.558,18.837,51.04],"maps_en_denmark":[8.094,54.569,15.151,57.751],"maps_en_djibouti":[41.749,10.93,43.419,12.708],"maps_en_east-timor":[124.03,-9.501,127.313,-8.135],"maps_en_ecuador":[-92.012,-5.011,-75.227,1.664],"maps_en_egypt":[24.688,21.994,36.899,31.656],"maps_en_el-salvador":[-90.115,13.159,-87.693,14.445],"maps_en_equatorial-guinea":[5.612,-1.476,11.336,3.772],"maps_en_eritrea":[36.424,12.36,43.124,18.005],"maps_en_estonia":[21.832,57.516,28.186,59.671],"maps_en_ethiopia":[32.99,3.403,47.979,14.88],"maps_en_europe":[-25.0,34.0,45.0,72.0],"maps_en_faroe-islands":[-7.644,61.394,-6.276,62.399],"maps_en_fiji":[-180.0,-21.711,180.0,-12.475],"maps_en_france":[-61.798,-21.371,55.855,51.088],"maps_en_french-polynesia":[-154.537,-27.641,-134.943,-7.95],"maps_en_gabon":[8.696,-3.937,14.499,2.322],"maps_en_gcc-states":[34.573,16.371,59.845,32.121],"maps_en_georgia":[39.986,41.044,46.695,43.576],"maps_en_germany":[5.852,47.271,15.022,55.065],"maps_en_ghana":[-3.263,4.737,1.188,11.163],"maps_en_greece":[19.626,34.815,28.24,41.75],"maps_en_greenland":[-73.057,59.793,-11.377,83.634],"maps_en_guatemala":[-92.246,13.731,-88.221,17.816],"maps_en_guernsey-and-jersey":[-2.673,49.171,-2.008,49.731],"maps_en_guinea":[-15.081,7.19,-7.662,12.673],"maps_en_guinea-bissau":[-16.728,10.928,-13.661,12.679],"maps_en_guyana":[-61.397,1.186,-56.482,8.558],"maps_en_haiti-and-dominican-republic":[-74.489,17.546,-68.329,20.09],"maps_en_honduras":[-89.364,12.98,-83.13,17.419],"maps_en_hungary":[16.094,45.741,22.878,48.569],"maps_en_ile-de-clipperton":[-109.234,10.282,-109.21,10.311],"maps_en_indonesia-with-east-timor":[95.013,-10.923,140.978,5.91],"maps_en_iran":[44.015,25.059,63.32,39.772],"maps_en_iraq":[38.775,29.063,48.559,37.375],"maps_en_isle-of-man":[-4.79,54.057,-4.312,54.419],"maps_en_israel-and-palestine":[34.2,29.49,35.888,33.407],"maps_en_italy":[6.603,35.489,18.517,47.085],"maps_en_ivory-coast":[-8.619,4.344,-2.506,10.726],"maps_en_jamaica":[-78.375,17.703,-76.188,18.525],"maps_en_jordan":[34.949,29.19,39.292,33.372],"maps_en_kazakhstan":[46.478,40.585,87.324,55.435],"maps_en_kenya":[33.89,-4.678,41.885,5.03],"maps_en_kiribati":[-174.543,-11.461,176.851,4.723],"maps_en_kosovo":[20.025,41.844,21.773,43.263],"maps_en_kyrgyzstan":[69.226,39.189,80.258,43.262],"maps_en_laos":[100.097,13.915,107.664,22.496],"maps_en_latvia":[20.969,55.667,28.217,58.075],"maps_en_lebanon":[35.1,33.056,36.604,34.688],"maps_en_lesotho":[27.002,-30.659,29.436,-28.571],"maps_en_liberia":[-11.476,4.347,-7.384,8.565],"maps_en_libya":[9.287,19.496,25.156,33.181],"maps_en_liechtenstein":[9.476,47.052,9.616,47.263],"maps_en_luxembourg":[5.715,49.441,6.503,50.175],"maps_en_macedonia":[20.444,40.849,23.01,42.37],"maps_en_madagascar":[43.223,-25.599,50.504,-11.944],"maps_en_malawi":[32.663,-17.135,35.904,-9.381],"maps_en_malaysia-singapore-and-brunei":[99.645,0.851,119.278,7.356],"maps_en_maldives":[72.685,-0.689,73.753,7.107],"maps_en_mali":[-12.264,10.14,4.236,24.995],"maps_en_malta":[14.184,35.801,14.567,36.076],"maps_en_marshall-islands":[165.282,4.574,172.03,14.611],"maps_en_mauritania":[-17.081,14.734,-4.822,27.285],"maps_en_mauritius":[56.524,-20.517,63.494,-10.324],"maps_en_micronesia":[138.064,0.918,163.047,9.776],"maps_en_mongolia":[87.736,41.586,119.907,52.13],"maps_en_montenegro":[18.434,41.852,20.355,43.548],"maps_en_morocco":[-17.014,21.42,-1.032,35.927],"maps_en_mozambique":[30.214,-26.86,40.848,-10.469],"maps_en_myanmar-burma":[92.175,9.791,101.174,28.538],"maps_en_namibia":[11.718,-28.959,25.26,-16.951],"maps_en_nauru":[166.907,-0.552,166.958,-0.49],"maps_en_nepal":[80.03,26.344,88.169,30.417],"maps_en_netherlands":[-68.417,12.022,7.199,53.558],"maps_en_new-caledonia":[163.616,-22.671,171.344,-19.624],"maps_en_new-zealand":[-177.958,-52.6,178.844,-8.543],"maps_en_nicaragua":[-87.686,10.713,-82.726,15.031],"maps_en_niger":[0.153,11.696,15.97,23.517],"maps_en_nigeria":[2.671,4.272,14.67,13.88],"maps_en_niue":[-169.95,-19.143,-169.783,-18.964],"maps_en_nordics":[-24.54,-54.462,33.64,80.77],"maps_en_north-america":[-170.0,5.0,-50.0,84.0],"maps_en_north-korea":[124.211,37.676,130.7,43.01],"maps_en_norway":[-9.117,-54.462,33.64,80.77],"maps_en_pakistan":[60.844,23.695,77.049,37.054],"maps_en_palau":[131.131,2.949,134.727,8.097],"maps_en_panama":[-83.053,7.206,-77.163,9.629],"maps_en_papua-new-guinea":[140.849,-11.636,155.968,-1.346],"maps_en_paraguay":[-62.65,-27.587,-54.245,-19.287],"maps_en_peru":[-81.338,-18.338,-68.684,-0.029],"maps_en_philippines":[116.955,4.656,126.618,21.122],"maps_en_pitcairn-islands":[-130.753,-25.077,-124.778,-23.924],"maps_en_poland":[14.124,48.994,24.143,54.838],"maps_en_romania":[20.243,43.65,29.7,48.275],"maps_en_russia":[-180.0,41.193,180.0,81.859],"maps_en_rwanda":[28.857,-2.827,30.888,-1.059],"maps_en_samoa":[-172.783,-14.053,-171.438,-13.463],"maps_en_sao-tome-and-principe":[6.462,0.024,7.463,1.7],"maps_en_senegal-and-gambia":[-17.536,12.306,-11.378,16.691],"maps_en_serbia":[18.845,42.235,22.985,46.174],"maps_en_seychelles":[46.207,-9.756,56.287,-3.791],"maps_en_sierra-leone":[-13.301,6.919,-10.282,9.996],"maps_en_slovakia":[16.844,47.75,22.54,49.602],"maps_en_slovenia":[13.365,45.424,16.515,46.864],"maps_en_solomon-islands":[155.508,-12.291,168.826,-6.6],"maps_en_somalia":[40.965,-1.696,51.417,11.989],"maps_en_south-africa":[16.47,-46.966,37.978,-22.126],"maps_en_south-america":[-92.0,-56.5,-34.0,13.5],"maps_en_south-atlantic":[-62.0,-60.0,-5.0,-7.0],"maps_en_south-korea":[124.614,33.198,131.863,38.624],"maps_en_south-sudan":[24.122,3.49,35.921,12.216],"maps_en_southeast-asia":[92.0,-11.5,141.5,28.5],"maps_en_southern-africa":[10.0,-35.5,41.0,-8.0],"maps_en_sri-lanka":[79.656,5.924,81.89,9.83],"maps_en_sudan":[21.809,8.682,38.604,22.227],"maps_en_suriname":[-58.068,1.834,-53.986,6.012],"maps_en_swaziland":[30.783,-27.316,32.117,-25.736],"maps_en_sweden":[11.108,55.343,24.163,69.036],"maps_en_switzerland":[5.955,45.821,10.467,47.801],"maps_en_syria":[35.723,32.313,42.377,37.325],"maps_en_taiwan":[118.28,21.905,122.005,25.287],"maps_en_tajikistan":[67.343,36.679,75.164,41.04],"maps_en_tanzania":[29.321,-11.731,40.449,-0.986],"maps_en_thailand":[97.351,5.63,105.651,20.445],"maps_en_togo":[-0.166,6.1,1.782,11.135],"maps_en_tokelau":[-172.6,-9.5,-171.1,-8.5],"maps_en_tonga":[-176.219,-22.339,-173.914,-15.56],"maps_en_tunisia":[7.48,30.229,11.564,37.345],"maps_en_turkey":[25.663,35.82,44.807,42.099],"maps_en_turkmenistan":[52.438,35.141,66.646,42.791],"maps_en_tuvalu":[176.125,-9.421,179.907,-5.678],"maps_en_uganda":[29.548,-1.475,35.006,4.22],"maps_en_united-kingdom":[-13.691,49.91,1.771,60.848],"maps_en_united-states-of-america":[-179.144,18.906,179.781,71.413],"maps_en_uruguay":[-58.439,-34.973,-53.111,-30.097],"maps_en_uzbekistan":[55.976,37.185,73.149,45.559],"maps_en_vanuatu":[166.521,-20.253,169.899,-13.065],"maps_en_venezuela":[-73.391,0.649,-59.816,15.703],"maps_en_vietnam":[102.119,8.566,109.472,23.366],"maps_en_wallis-et-futuna":[-178.186,-14.319,-176.126,-13.209],"maps_en_yemen":[42.546,12.111,54.54,18.996],"maps_en_zambia":[21.98,-18.069,33.674,-8.194],"maps_en_zimbabwe":[25.219,-22.397,33.043,-15.615]},"note":"Approximate [W, S, E, N] per catalog map. Kiwix from Natural Earth admin-0 (public domain); StreetZim by hand. W > E crosses the antimeridian.","streetzim":{"osm-africa":[-18.0,-35.0,52.0,38.0],"osm-africa-light":[-18.0,-35.0,52.0,38.0],"osm-alaska":[-170.0,51.0,-129.0,72.0],"osm-argentina":[-73.6,-55.2,-53.6,-21.8],"osm-australia-nz":[112.0,-48.0,180.0,-9.0],"osm-austria-czech":[9.5,46.3,18.9,51.1],"osm-bahrain":[50.3,25.8,50.8,26.3],"osm-balkans":[13.3,39.6,23.1,46.9],"osm-baltics":[20.5,53.8,28.3,59.8],"osm-benelux":[2.5,49.4,7.3,53.6],"osm-brazil":[-74.0,-33.9,-28.6,5.3],"osm-britain-ireland":[-10.7,49.8,1.8,60.9],"osm-california":[-124.5,32.5,-114.1,42.0],"osm-california-langproto":[-124.5,32.5,-114.1,42.0],"osm-canada":[-141.0,41.7,-52.6,83.1],"osm-carolinas":[-84.4,32.0,-75.4,36.6],"osm-carpathians":[16.8,43.6,30.0,49.9],"osm-caucasus":[38.5,38.3,50.5,44.0],"osm-central-africa":[8.5,-13.5,31.5,23.5],"osm-central-america-caribbean":[-92.5,7.0,-59.0,27.5],"osm-central-asia":[46.5,35.0,87.5,55.5],"osm-central-us":[-104.1,25.8,-89.0,49.0],"osm-chicago-metro":[-88.9,41.0,-87.0,42.5],"osm-china":[73.5,18.0,134.8,53.6],"osm-colorado":[-109.1,37.0,-102.0,41.0],"osm-east-africa":[28.0,-12.0,52.0,18.0],"osm-east-coast-us":[-83.5,24.5,-66.9,47.5],"osm-east-polynesia":[-160.0,-28.0,-134.0,-7.0],"osm-egypt":[24.6,22.0,37.2,31.9],"osm-europe":[-25.0,34.0,45.0,72.0],"osm-florida":[-87.7,24.4,-79.9,31.0],"osm-france":[-5.2,41.3,9.6,51.1],"osm-germany":[5.9,47.3,15.0,55.1],"osm-greater-la":[-119.0,33.3,-116.9,34.9],"osm-greece":[19.4,34.8,29.7,41.8],"osm-hawaii":[-178.5,18.5,-154.5,28.5],"osm-himalayas":[72.0,26.0,98.0,37.0],"osm-hispaniola":[-74.5,17.5,-68.3,20.1],"osm-horn-of-africa":[33.0,-1.7,51.5,18.0],"osm-iberia":[-9.6,35.9,4.4,43.8],"osm-iceland":[-25.0,63.0,-12.8,67.4],"osm-indian-subcontinent":[60.0,5.0,98.0,37.5],"osm-iran":[44.0,24.8,63.4,39.8],"osm-italy":[6.6,35.5,18.6,47.1],"osm-japan":[122.7,24.0,146.0,45.8],"osm-korea-mongolia":[87.5,33.0,131.0,52.2],"osm-mexico":[-118.6,14.4,-86.5,32.8],"osm-midwest-us":[-104.1,36.0,-80.5,49.4],"osm-new-york-state":[-79.8,40.5,-71.8,45.1],"osm-nordics":[4.5,54.5,31.6,71.2],"osm-north-africa":[-17.1,19.5,37.0,37.6],"osm-nyc-metro":[-75.4,40.2,-72.7,41.6],"osm-pacific-islands":[130.0,-30.0,-130.0,25.0],"osm-poland":[14.1,49.0,24.2,54.9],"osm-russia":[19.6,41.2,-169.0,82.1],"osm-silicon-valley":[-122.6,36.9,-121.5,37.8],"osm-south-america":[-92.0,-56.5,-34.0,13.5],"osm-south-korea":[124.4,32.9,132.1,38.7],"osm-southeast-asia":[92.0,-11.5,141.5,28.5],"osm-southern-africa":[10.0,-35.5,41.0,-8.0],"osm-switzerland":[5.9,45.8,10.5,47.9],"osm-switzerland-border-de-ultralight":[5.9,45.8,10.5,48.0],"osm-switzerland-de":[5.9,45.8,10.5,47.8],"osm-switzerland-de-ultralight":[5.9,45.8,10.5,47.8],"osm-switzerland-light":[5.9,45.8,10.5,47.8],"osm-taiwan":[119.3,21.8,122.1,25.4],"osm-texas":[-106.7,25.8,-93.5,36.6],"osm-turkey":[25.6,35.8,44.8,42.2],"osm-ukraine":[22.1,44.2,40.3,52.4],"osm-united-states":[-125.0,24.4,-66.9,49.4],"osm-washington-dc":[-77.6,38.6,-76.6,39.2],"osm-west-africa":[-18.0,4.0,16.0,28.0],"osm-west-asia":[25.0,12.0,63.5,42.5],"osm-west-coast-us":[-125.0,32.5,-114.1,49.0]}} +{"built_at":"2026-11-13","kiwix":{"maps_en_afghanistan":[60.487,29.387,74.892,38.474],"maps_en_africa":[-18.0,-35.0,52.0,38.0],"maps_en_albania":[19.272,39.637,21.037,42.655],"maps_en_algeria":[-8.682,18.976,11.969,37.094],"maps_en_all":[-180.0,-90.0,180.0,90.0],"maps_en_andes":[-109.454,-55.919,-57.466,15.703],"maps_en_andorra":[1.406,42.429,1.765,42.649],"maps_en_angola":[11.669,-18.031,24.062,-4.391],"maps_en_argentina":[-73.573,-55.052,-53.662,-21.787],"maps_en_armenia":[43.436,38.864,46.603,41.29],"maps_en_asia":[25.0,-11.0,180.0,82.0],"maps_en_australia":[112.919,-54.75,159.106,-9.24],"maps_en_australia-oceania":[110.0,-50.0,-130.0,22.0],"maps_en_austria":[9.521,46.379,17.148,49.01],"maps_en_azerbaijan":[44.775,38.393,50.626,41.89],"maps_en_azores":[-31.4,36.9,-24.9,39.8],"maps_en_bahamas":[-79.594,20.912,-72.746,26.928],"maps_en_balkans":[13.365,34.815,29.7,48.275],"maps_en_bangladesh":[88.022,20.739,92.643,26.624],"maps_en_belarus":[23.166,51.235,32.72,56.157],"maps_en_belgium":[2.522,49.495,6.375,51.496],"maps_en_belize":[-89.237,15.88,-87.783,18.491],"maps_en_benin":[0.76,6.214,3.837,12.399],"maps_en_bhutan":[88.73,26.696,92.089,28.358],"maps_en_bolivia":[-69.666,-22.897,-57.466,-9.68],"maps_en_bosnia-herzegovina":[15.716,42.559,19.619,45.285],"maps_en_botswana":[19.978,-26.892,29.35,-17.782],"maps_en_brazil":[-74.018,-33.742,-28.877,5.267],"maps_en_bulgaria":[22.345,41.238,28.604,44.228],"maps_en_burkina-faso":[-5.523,9.392,2.39,15.08],"maps_en_burundi":[28.987,-4.463,30.834,-2.303],"maps_en_cambodia":[102.313,10.416,107.611,14.705],"maps_en_cameroon":[8.505,1.655,16.208,13.081],"maps_en_canada":[-141.006,41.669,-52.617,83.117],"maps_en_canary-islands":[-18.3,27.6,-13.3,29.5],"maps_en_cape-verde":[-25.36,14.804,-22.667,17.197],"maps_en_central-african-republic":[14.387,2.236,27.441,11.001],"maps_en_central-america":[-92.5,7.0,-77.0,18.5],"maps_en_chad":[13.449,7.456,23.984,23.445],"maps_en_chile":[-109.454,-55.919,-66.421,-17.507],"maps_en_china":[73.602,15.775,134.773,53.569],"maps_en_colombia":[-81.724,-4.236,-66.875,13.578],"maps_en_comores":[43.213,-12.38,44.529,-11.361],"maps_en_congo-democratic-republic-kinshasa":[12.211,-13.458,31.28,5.375],"maps_en_congo-republic-brazzaville":[11.114,-5.02,18.642,3.708],"maps_en_cook-islands":[-165.825,-21.939,-157.313,-8.947],"maps_en_costa-rica":[-87.118,5.515,-82.563,11.21],"maps_en_croatia":[13.501,42.416,19.408,46.547],"maps_en_cuba":[-84.95,19.828,-74.133,23.266],"maps_en_cyprus":[32.272,34.625,34.099,35.187],"maps_en_czech-republic":[12.076,48.558,18.837,51.04],"maps_en_denmark":[8.094,54.569,15.151,57.751],"maps_en_djibouti":[41.749,10.93,43.419,12.708],"maps_en_east-timor":[124.03,-9.501,127.313,-8.135],"maps_en_ecuador":[-92.012,-5.011,-75.227,1.664],"maps_en_egypt":[24.688,21.994,36.899,31.656],"maps_en_el-salvador":[-90.115,13.159,-87.693,14.445],"maps_en_equatorial-guinea":[5.612,-1.476,11.336,3.772],"maps_en_eritrea":[36.424,12.36,43.124,18.005],"maps_en_estonia":[21.832,57.516,28.186,59.671],"maps_en_ethiopia":[32.99,3.403,47.979,14.88],"maps_en_europe":[-25.0,34.0,45.0,72.0],"maps_en_faroe-islands":[-7.644,61.394,-6.276,62.399],"maps_en_fiji":[-180.0,-21.711,180.0,-12.475],"maps_en_france":[-61.798,-21.371,55.855,51.088],"maps_en_french-polynesia":[-154.537,-27.641,-134.943,-7.95],"maps_en_gabon":[8.696,-3.937,14.499,2.322],"maps_en_gcc-states":[34.573,16.371,59.845,32.121],"maps_en_georgia":[39.986,41.044,46.695,43.576],"maps_en_germany":[5.852,47.271,15.022,55.065],"maps_en_ghana":[-3.263,4.737,1.188,11.163],"maps_en_greece":[19.626,34.815,28.24,41.75],"maps_en_greenland":[-73.057,59.793,-11.377,83.634],"maps_en_guatemala":[-92.246,13.731,-88.221,17.816],"maps_en_guernsey-and-jersey":[-2.673,49.171,-2.008,49.731],"maps_en_guinea":[-15.081,7.19,-7.662,12.673],"maps_en_guinea-bissau":[-16.728,10.928,-13.661,12.679],"maps_en_guyana":[-61.397,1.186,-56.482,8.558],"maps_en_haiti-and-dominican-republic":[-74.489,17.546,-68.329,20.09],"maps_en_honduras":[-89.364,12.98,-83.13,17.419],"maps_en_hungary":[16.094,45.741,22.878,48.569],"maps_en_ile-de-clipperton":[-109.234,10.282,-109.21,10.311],"maps_en_indonesia-with-east-timor":[95.013,-10.923,140.978,5.91],"maps_en_iran":[44.015,25.059,63.32,39.772],"maps_en_iraq":[38.775,29.063,48.559,37.375],"maps_en_isle-of-man":[-4.79,54.057,-4.312,54.419],"maps_en_israel-and-palestine":[34.2,29.49,35.888,33.407],"maps_en_italy":[6.603,35.489,18.517,47.085],"maps_en_ivory-coast":[-8.619,4.344,-2.506,10.726],"maps_en_jamaica":[-78.375,17.703,-76.188,18.525],"maps_en_jordan":[34.949,29.19,39.292,33.372],"maps_en_kazakhstan":[46.478,40.585,87.324,55.435],"maps_en_kenya":[33.89,-4.678,41.885,5.03],"maps_en_kiribati":[-174.543,-11.461,176.851,4.723],"maps_en_kosovo":[20.025,41.844,21.773,43.263],"maps_en_kyrgyzstan":[69.226,39.189,80.258,43.262],"maps_en_laos":[100.097,13.915,107.664,22.496],"maps_en_latvia":[20.969,55.667,28.217,58.075],"maps_en_lebanon":[35.1,33.056,36.604,34.688],"maps_en_lesotho":[27.002,-30.659,29.436,-28.571],"maps_en_liberia":[-11.476,4.347,-7.384,8.565],"maps_en_libya":[9.287,19.496,25.156,33.181],"maps_en_liechtenstein":[9.476,47.052,9.616,47.263],"maps_en_luxembourg":[5.715,49.441,6.503,50.175],"maps_en_macedonia":[20.444,40.849,23.01,42.37],"maps_en_madagascar":[43.223,-25.599,50.504,-11.944],"maps_en_malawi":[32.663,-17.135,35.904,-9.381],"maps_en_malaysia-singapore-and-brunei":[99.645,0.851,119.278,7.356],"maps_en_maldives":[72.685,-0.689,73.753,7.107],"maps_en_mali":[-12.264,10.14,4.236,24.995],"maps_en_malta":[14.184,35.801,14.567,36.076],"maps_en_marshall-islands":[165.282,4.574,172.03,14.611],"maps_en_mauritania":[-17.081,14.734,-4.822,27.285],"maps_en_mauritius":[56.524,-20.517,63.494,-10.324],"maps_en_micronesia":[138.064,0.918,163.047,9.776],"maps_en_mongolia":[87.736,41.586,119.907,52.13],"maps_en_montenegro":[18.434,41.852,20.355,43.548],"maps_en_morocco":[-17.014,21.42,-1.032,35.927],"maps_en_mozambique":[30.214,-26.86,40.848,-10.469],"maps_en_myanmar-burma":[92.175,9.791,101.174,28.538],"maps_en_namibia":[11.718,-28.959,25.26,-16.951],"maps_en_nauru":[166.907,-0.552,166.958,-0.49],"maps_en_nepal":[80.03,26.344,88.169,30.417],"maps_en_netherlands":[-68.417,12.022,7.199,53.558],"maps_en_new-caledonia":[163.616,-22.671,171.344,-19.624],"maps_en_new-zealand":[-177.958,-52.6,178.844,-8.543],"maps_en_nicaragua":[-87.686,10.713,-82.726,15.031],"maps_en_niger":[0.153,11.696,15.97,23.517],"maps_en_nigeria":[2.671,4.272,14.67,13.88],"maps_en_niue":[-169.95,-19.143,-169.783,-18.964],"maps_en_nordics":[-24.54,-54.462,33.64,80.77],"maps_en_north-america":[-170.0,5.0,-50.0,84.0],"maps_en_north-korea":[124.211,37.676,130.7,43.01],"maps_en_norway":[-9.117,-54.462,33.64,80.77],"maps_en_pakistan":[60.844,23.695,77.049,37.054],"maps_en_palau":[131.131,2.949,134.727,8.097],"maps_en_panama":[-83.053,7.206,-77.163,9.629],"maps_en_papua-new-guinea":[140.849,-11.636,155.968,-1.346],"maps_en_paraguay":[-62.65,-27.587,-54.245,-19.287],"maps_en_peru":[-81.338,-18.338,-68.684,-0.029],"maps_en_philippines":[116.955,4.656,126.618,21.122],"maps_en_pitcairn-islands":[-130.753,-25.077,-124.778,-23.924],"maps_en_poland":[14.124,48.994,24.143,54.838],"maps_en_romania":[20.243,43.65,29.7,48.275],"maps_en_russia":[-180.0,41.193,180.0,81.859],"maps_en_rwanda":[28.857,-2.827,30.888,-1.059],"maps_en_samoa":[-172.783,-14.053,-171.438,-13.463],"maps_en_sao-tome-and-principe":[6.462,0.024,7.463,1.7],"maps_en_senegal-and-gambia":[-17.536,12.306,-11.378,16.691],"maps_en_serbia":[18.845,42.235,22.985,46.174],"maps_en_seychelles":[46.207,-9.756,56.287,-3.791],"maps_en_sierra-leone":[-13.301,6.919,-10.282,9.996],"maps_en_slovakia":[16.844,47.75,22.54,49.602],"maps_en_slovenia":[13.365,45.424,16.515,46.864],"maps_en_solomon-islands":[155.508,-12.291,168.826,-6.6],"maps_en_somalia":[40.965,-1.696,51.417,11.989],"maps_en_south-africa":[16.47,-46.966,37.978,-22.126],"maps_en_south-america":[-92.0,-56.5,-34.0,13.5],"maps_en_south-atlantic":[-62.0,-60.0,-5.0,-7.0],"maps_en_south-korea":[124.614,33.198,131.863,38.624],"maps_en_south-sudan":[24.122,3.49,35.921,12.216],"maps_en_southeast-asia":[92.0,-11.5,141.5,28.5],"maps_en_southern-africa":[10.0,-35.5,41.0,-8.0],"maps_en_sri-lanka":[79.656,5.924,81.89,9.83],"maps_en_sudan":[21.809,8.682,38.604,22.227],"maps_en_suriname":[-58.068,1.834,-53.986,6.012],"maps_en_swaziland":[30.783,-27.316,32.117,-25.736],"maps_en_sweden":[11.108,55.343,24.163,69.036],"maps_en_switzerland":[5.955,45.821,10.467,47.801],"maps_en_syria":[35.723,32.313,42.377,37.325],"maps_en_taiwan":[118.28,21.905,122.005,25.287],"maps_en_tajikistan":[67.343,36.679,75.164,41.04],"maps_en_tanzania":[29.321,-11.731,40.449,-0.986],"maps_en_thailand":[97.351,5.63,105.651,20.445],"maps_en_togo":[-0.166,6.1,1.782,11.135],"maps_en_tokelau":[-172.6,-9.5,-171.1,-8.5],"maps_en_tonga":[-176.219,-22.339,-173.914,-15.56],"maps_en_tunisia":[7.48,30.229,11.564,37.345],"maps_en_turkey":[25.663,35.82,44.807,42.099],"maps_en_turkmenistan":[52.438,35.141,66.646,42.791],"maps_en_tuvalu":[176.125,-9.421,179.907,-5.678],"maps_en_uganda":[29.548,-1.475,35.006,4.22],"maps_en_united-kingdom":[-13.691,49.91,1.771,60.848],"maps_en_united-states-of-america":[-179.144,18.906,179.781,71.413],"maps_en_uruguay":[-58.439,-34.973,-53.111,-30.097],"maps_en_uzbekistan":[55.976,37.185,73.149,45.559],"maps_en_vanuatu":[166.521,-20.253,169.899,-13.065],"maps_en_venezuela":[-73.391,0.649,-59.816,15.703],"maps_en_vietnam":[102.119,8.566,109.472,23.366],"maps_en_wallis-et-futuna":[-178.186,-14.319,-176.126,-13.209],"maps_en_yemen":[42.546,12.111,54.54,18.996],"maps_en_zambia":[21.98,-18.069,33.674,-8.194],"maps_en_zimbabwe":[25.219,-22.397,33.043,-15.615]},"note":"Approximate [W, S, E, N] per catalog map. Kiwix from Natural Earth admin-0 (public domain); StreetZim by hand. W > E crosses the antimeridian.","streetzim":{"osm-africa":[-18.0,-35.0,52.0,38.0],"osm-africa-light":[-18.0,-35.0,52.0,38.0],"osm-alaska":[-170.0,51.0,-129.0,72.0],"osm-argentina":[-73.6,-55.2,-53.6,-21.8],"osm-athens":[23.4,37.8,24.1,38.2],"osm-australia-nz":[112.0,-48.0,180.0,-9.0],"osm-austria-czech":[9.5,46.3,18.9,51.1],"osm-bahrain":[50.3,25.8,50.8,26.3],"osm-balkans":[13.3,39.6,23.1,46.9],"osm-baltics":[20.5,53.8,28.3,59.8],"osm-benelux":[2.5,49.4,7.3,53.6],"osm-brazil":[-74.0,-33.9,-28.6,5.3],"osm-britain-ireland":[-10.7,49.8,1.8,60.9],"osm-cairo":[30.9,29.8,31.6,30.3],"osm-california":[-124.5,32.5,-114.1,42.0],"osm-california-langproto":[-124.5,32.5,-114.1,42.0],"osm-canada":[-141.0,41.7,-52.6,83.1],"osm-carolinas":[-84.4,32.0,-75.4,36.6],"osm-carpathians":[16.8,43.6,30.0,49.9],"osm-caucasus":[38.5,38.3,50.5,44.0],"osm-central-africa":[8.5,-13.5,31.5,23.5],"osm-central-america-caribbean":[-92.5,7.0,-59.0,27.5],"osm-central-asia":[46.5,35.0,87.5,55.5],"osm-central-us":[-104.1,25.8,-89.0,49.0],"osm-chicago-metro":[-88.9,41.0,-87.0,42.5],"osm-china":[73.5,18.0,134.8,53.6],"osm-colorado":[-109.1,37.0,-102.0,41.0],"osm-east-africa":[28.0,-12.0,52.0,18.0],"osm-east-coast-us":[-83.5,24.5,-66.9,47.5],"osm-east-polynesia":[-160.0,-28.0,-134.0,-7.0],"osm-egypt":[24.6,22.0,37.2,31.9],"osm-europe":[-25.0,34.0,45.0,72.0],"osm-florida":[-87.7,24.4,-79.9,31.0],"osm-france":[-5.2,41.3,9.6,51.1],"osm-germany":[5.9,47.3,15.0,55.1],"osm-greater-la":[-119.0,33.3,-116.9,34.9],"osm-greece":[19.4,34.8,29.7,41.8],"osm-hawaii":[-178.5,18.5,-154.5,28.5],"osm-himalayas":[72.0,26.0,98.0,37.0],"osm-hispaniola":[-74.5,17.5,-68.3,20.1],"osm-horn-of-africa":[33.0,-1.7,51.5,18.0],"osm-iberia":[-9.6,35.9,4.4,43.8],"osm-iceland":[-25.0,63.0,-12.8,67.4],"osm-india-central":[73.5,17.5,84.5,26.9],"osm-india-central-light":[73.5,17.5,84.5,26.9],"osm-india-east":[83.0,17.8,89.9,27.3],"osm-india-east-light":[83.0,17.8,89.9,27.3],"osm-india-northeast":[89.6,21.9,97.5,29.5],"osm-india-northeast-light":[89.6,21.9,97.5,29.5],"osm-india-northwest":[68.1,23.9,81.1,37.1],"osm-india-northwest-light":[68.1,23.9,81.1,37.1],"osm-india-south-light":[74.0,8.0,85.0,19.9],"osm-india-west":[68.1,15.6,80.9,24.7],"osm-india-west-light":[68.1,15.6,80.9,24.7],"osm-indian-subcontinent":[60.0,5.0,98.0,37.5],"osm-iran":[44.0,24.8,63.4,39.8],"osm-italy":[6.6,35.5,18.6,47.1],"osm-japan":[122.7,24.0,146.0,45.8],"osm-korea-mongolia":[87.5,33.0,131.0,52.2],"osm-kyiv":[30.2,50.2,30.9,50.6],"osm-mexico":[-118.6,14.4,-86.5,32.8],"osm-midwest-us":[-104.1,36.0,-80.5,49.4],"osm-moscow":[36.8,55.1,38.0,56.0],"osm-new-york-state":[-79.8,40.5,-71.8,45.1],"osm-nordics":[4.5,54.5,31.6,71.2],"osm-north-africa":[-17.1,19.5,37.0,37.6],"osm-nyc-metro":[-75.4,40.2,-72.7,41.6],"osm-osaka":[135.1,34.4,135.8,34.9],"osm-pacific-islands":[130.0,-30.0,-130.0,25.0],"osm-poland":[14.1,49.0,24.2,54.9],"osm-russia":[19.6,41.2,-169.0,82.1],"osm-seoul":[126.7,37.4,127.2,37.7],"osm-silicon-valley":[-122.6,36.9,-121.5,37.8],"osm-south-america":[-92.0,-56.5,-34.0,13.5],"osm-south-central-us":[-109.1,25.8,-88.8,37.0],"osm-south-korea":[124.4,32.9,132.1,38.7],"osm-southeast-asia":[92.0,-11.5,141.5,28.5],"osm-southern-africa":[10.0,-35.5,41.0,-8.0],"osm-switzerland":[5.9,45.8,10.5,47.9],"osm-switzerland-border-de-ultralight":[5.9,45.8,10.5,48.0],"osm-switzerland-de":[5.9,45.8,10.5,47.8],"osm-switzerland-de-ultralight":[5.9,45.8,10.5,47.8],"osm-switzerland-light":[5.9,45.8,10.5,47.8],"osm-taipei":[121.3,24.9,121.7,25.2],"osm-taiwan":[119.3,21.8,122.1,25.4],"osm-tehran":[51.1,35.5,51.7,35.9],"osm-texas":[-106.7,25.8,-93.5,36.6],"osm-thailand":[97.3,5.6,105.7,20.5],"osm-turkey":[25.6,35.8,44.8,42.2],"osm-ukraine":[22.1,44.2,40.3,52.4],"osm-united-states":[-125.0,24.4,-66.9,49.4],"osm-washington-dc":[-77.6,38.6,-76.6,39.2],"osm-west-africa":[-18.0,4.0,16.0,28.0],"osm-west-asia":[25.0,12.0,63.5,42.5],"osm-west-coast-us":[-125.0,32.5,-114.1,49.0]}} diff --git a/zimi/assets/streetzim-snapshot.json.gz b/zimi/assets/streetzim-snapshot.json.gz index 1506aee1d..c9b62fc78 100644 Binary files a/zimi/assets/streetzim-snapshot.json.gz and b/zimi/assets/streetzim-snapshot.json.gz differ diff --git a/zimi/builtin/zimi_almanac_2026-11d.zim.source b/zimi/builtin/zimi_almanac_2026-11d.zim.source deleted file mode 100644 index c37acd649..000000000 --- a/zimi/builtin/zimi_almanac_2026-11d.zim.source +++ /dev/null @@ -1 +0,0 @@ -4e0a8cb191f981dc03c6561458994a1c897aea33afcb30d03d24482e3aaf0b3c diff --git a/zimi/builtin/zimi_almanac_2026-11d.zim b/zimi/builtin/zimi_almanac_2026-11e.zim similarity index 99% rename from zimi/builtin/zimi_almanac_2026-11d.zim rename to zimi/builtin/zimi_almanac_2026-11e.zim index 635d7a6db..bf03c6b1f 100644 Binary files a/zimi/builtin/zimi_almanac_2026-11d.zim and b/zimi/builtin/zimi_almanac_2026-11e.zim differ diff --git a/zimi/builtin/zimi_almanac_2026-11e.zim.source b/zimi/builtin/zimi_almanac_2026-11e.zim.source new file mode 100644 index 000000000..417bd9787 --- /dev/null +++ b/zimi/builtin/zimi_almanac_2026-11e.zim.source @@ -0,0 +1 @@ +8ad204d1eb8f69b7225be34903a1c1bea2e91b891c809f9f06d72e943ff21686 diff --git a/zimi/runtimes.py b/zimi/runtimes.py index 39777e88d..21af2e60a 100644 --- a/zimi/runtimes.py +++ b/zimi/runtimes.py @@ -12,6 +12,7 @@ import os import shutil import sys +import tempfile from collections import namedtuple DOCKER, DESKTOP, PORTABLE, PIP = "docker", "desktop", "portable", "pip" @@ -328,16 +329,8 @@ def format_report(rows, kind): _OUTSIDE_PROBE = "import os, ssl; print(os.environ.get('LD_LIBRARY_PATH', ''))" -def outside_python_problem(python=None): - """Frozen only: why a program that is not part of this app (the machine's - python3, which sets up voices) would not run properly from here, or None. - The bootloader's library path must not reach it (#151: its older libssl - broke pip on a Raspberry Pi).""" - if not getattr(sys, "frozen", False): - return None - python = python or shutil.which("python3") - if not python: - return None +def _probe(python): + """Run the probe with ``python`` the way the app starts any outside program; a problem as text, or None.""" from zimi import subproc try: @@ -352,6 +345,46 @@ def outside_python_problem(python=None): return None +def _venv_python_problem(python): + """The same probe through a venv python in the data folder, where voices keep theirs: beside the executable on a + portable build, which is what #151's second spawn (``/bin/python -m pip``) was. Offline: the venv has no pip.""" + from zimi import server as _srv + from zimi import subproc + + tools = os.path.join(_srv.ZIMI_DATA_DIR, "tools") + venv = None + try: + os.makedirs(tools, exist_ok=True) + venv = tempfile.mkdtemp(prefix="doctor-probe-", dir=tools) + made = subproc.run([python, "-m", "venv", "--without-pip", venv], capture_output=True, text=True, timeout=120) + if made.returncode != 0: + return f"{python} cannot make a venv: {(made.stderr or '').strip()[-200:]}" + bin_dir = "Scripts" if os.name == "nt" else "bin" + return _probe(os.path.join(venv, bin_dir, "python" + (".exe" if os.name == "nt" else ""))) + except Exception as e: + return f"{python} cannot make a venv in {tools}: {e}" + finally: + if venv: + shutil.rmtree(venv, ignore_errors=True) + + +def outside_python_problem(python=None, venv=False): + """Frozen only: why a program that is not part of this app (the machine's + python3, which sets up voices) would not run properly from here, or None. + The bootloader's library path must not reach it (#151: its older libssl + broke pip on a Raspberry Pi). With ``venv``, a venv made in the data + folder is probed too: that python is the one that runs pip.""" + if not getattr(sys, "frozen", False): + return None + python = python or shutil.which("python3") + if not python: + return None + problem = _probe(python) + if problem is None and venv: + problem = _venv_python_problem(python) + return problem + + def cli_doctor(args): """`zimi doctor [--check]`. Exit 1 under --check when a bundled feature is missing.""" @@ -363,7 +396,7 @@ def cli_doctor(args): print(f"\nnot ready, though this install should have them: {', '.join(missing)}") if args.check: raise SystemExit(1) - outside = outside_python_problem() + outside = outside_python_problem(venv=args.check) if outside: print(f"\nthe machine's Python would not run properly from here: {outside}") if args.check: diff --git a/zimi/server.py b/zimi/server.py index d362af19f..13bc8afbb 100644 --- a/zimi/server.py +++ b/zimi/server.py @@ -130,7 +130,7 @@ # SSL context using certifi CA bundle (PyInstaller bundles lack system certs) SSL_CTX = ssl.create_default_context(cafile=certifi.where()) -ZIMI_VERSION = "1.15.6" +ZIMI_VERSION = "1.15.7" def bundled(module): diff --git a/zimi/static/app.js b/zimi/static/app.js index ba4d76b25..25daf634b 100644 --- a/zimi/static/app.js +++ b/zimi/static/app.js @@ -7679,7 +7679,9 @@ function _moonSpritePlan(v, sizePx) { var N = _moonSpriteN(sizePx); var cv = document.createElement('canvas'); cv.width = cv.height = N; - var ctx = cv.getContext('2d'); + // Filled by putImageData and read out whole (toDataURL, drawImage): a canvas kept in memory, not on the GPU, whose readback + // waits on every frame the GPU is drawing (seconds on a machine whose GPU is software, with the page frozen meanwhile). + var ctx = cv.getContext('2d', { willReadFrequently: true }); var img = ctx.createImageData(N, N); var data = img.data; var mapW = _moonMapWidthFor(N); @@ -9661,8 +9663,8 @@ function _moveZimTo(zim, category) { document.addEventListener('mousedown', _ctxTrackPointer, true); document.addEventListener('wheel', function(e) { if (!menu.contains(e.target)) _ctxSelfScroll = false; }, { capture: true, passive: true }); - window.addEventListener('scroll', function() { - if (_ctxSelfScroll) return; + window.addEventListener('scroll', function(e) { + if (_ctxSelfScroll || menu.contains(e.target)) return; if (menu.classList.contains('visible')) closeCtx(); }, true); diff --git a/zimi/subproc.py b/zimi/subproc.py index b69534d05..3510e3084 100644 --- a/zimi/subproc.py +++ b/zimi/subproc.py @@ -55,8 +55,10 @@ def _bundle_dirs(): - """The frozen app's folders, as the bootloader wrote them and with symlinks resolved, each normalised for comparing.""" - raw = {getattr(sys, "_MEIPASS", None), os.path.dirname(sys.executable)} + """The frozen app itself: its unpack folder and its executable file, as the bootloader wrote them and with symlinks + resolved, each normalised for comparing. Not the folder the executable sits in: a portable build keeps its data + (zims/, zimi-data/, the voices venv) beside it, and that is no part of the app (#151).""" + raw = {getattr(sys, "_MEIPASS", None), sys.executable} raw = {d for d in raw if d} return sorted({_norm(d) for d in raw} | {_norm(os.path.realpath(d)) for d in raw}) @@ -73,7 +75,7 @@ def _under(path, root, mod=os.path): def _in_bundle(program): - """True when ``program`` is a file inside the frozen app's folder. A bare name is no path (see ``_resolved``).""" + """True when ``program`` is the frozen app's executable or a file inside its unpack folder. A bare name is no path (see ``_resolved``).""" try: if not os.path.dirname(os.fspath(program)): return False