Skip to main content

Module help_local

Module help_local 

Source
Expand description

The desktop app’s help, downloaded on the first Help press (help_local). The desktop app’s HELP, downloaded to this machine the first time Help is pressed (owner 2026-11-27). The browser build serves the help site beside the page (help/index.html); a desktop build has nothing there, so:

  1. Help with a copy for THIS app version already in <data dir>/brep-app/help/<version>/ opens its index.html in the default browser at once, offline.
  2. Otherwise the app asks the site for brep-help-<version>.json, the help bundle’s manifest (./build.sh app writes it and the archive beside the published web build, web/help-bundle/). When this version is not on the site any more it asks for brep-help-latest.json instead, opens that, and says the help is for another version.
  3. The archive (.tar.gz) is fetched over HTTPS from the same server as the updates, with progress and Cancel in a notice; it must match the manifest’s length and sha256 before anything is unpacked. It unpacks into .partial-* and only a complete tree is renamed to <version>/, so a half copy is never opened. Only plain files and folders are taken: no links, no absolute or .. paths.
  4. A failure (offline, a bad hash, no bundle) opens the newest copy already on this machine if there is one, and otherwise says why and offers the online help.

Nothing is fetched unless a desktop main turned the source on (HelpDownloader::start_site); a headless or embedded app keeps the old behaviour (the relative help URL) until a script points it at a test server (help_fixture).

Modules§

fixture
A local stand-in for the site’s web/help-bundle/, for the help download’s tests and the help_fixture command: a tiny bundle served on 127.0.0.1, never the real site. It can serve the archive halfway and HOLD there until released, so a script reads downloading and presses Cancel without a race.

Structs§

BundleManifest
What brep-help-<version>.json says about the archive beside it.
Fetched
A copy ready to open.
HelpDownloader
The Help button’s desktop half: the local copy, the download and its notice.
Progress
What a running download reports, and its cancel switch.
Source
Where a bundle comes from: the manifests’ and archive’s base URL, and the online help offered when nothing downloads.

Enums§

Phase
Where Help stands, as the notice and __brepHelp show it.

Constants§

APP_VERSION
This app’s version: the help copy it looks for.
BUNDLE_PATH
Where the published web build keeps the bundle, on the update server.
CANCELLED
The error a cancelled download ends with.
FORMAT
The first field of every bundle manifest.
ONLINE_PATH
The help site of the published web build, for when nothing downloads.

Functions§

data_dir
The per-user data directory (brep-app under it), from the environment.
data_dir_from
data_dir with the environment and system passed in: XDG_DATA_HOME, else %LOCALAPPDATA% (Windows), ~/Library/Application Support (macOS) or ~/.local/share.
fetch_bundle
Fetch, check and unpack the help for want (else the latest) from source into root. Blocking: run it off the UI thread.
file_url
A file:// URL for a local path, percent-encoded (spaces, non-ASCII), with a Windows drive path as file:///C:/….
installed
The installed copy of version under root: its index.html, when the copy is complete (unpacked whole and renamed into place).
newest_installed
The newest complete copy under root, of any version.
unpack
Unpack a checked archive into root/<version>/, whole or not at all.