Commit Graph
6 Commits
Author SHA1 Message Date
Lam Wei Lun 8e08654505 Fix the updater review findings
Installing an update while the automatic prefetch was still writing the same
.part resumed it in a second process, so the digest failed, and Windows could
not even extract the helper. The manual path now waits for a download this run
started, a complete .part is taken as done, and a helper folder that is busy is
reused instead of deleted.

A release build could ship without the publisher or team id it pins, and the
helper would then accept anything the OS trusts. Configure fails for a release
build without the pin its platform needs, and the macOS package compares what
the helper was built with against the pins it ships under.

The Windows installer deleted the old tree before it wrote the new one, so a
failure left no application and no way to report it. It stages the whole tree
beside the target, verifies it, and swaps it in, reporting 1 for a missing
token, 2 for nothing written and 3 for a tree removed but not replaced. Before
handing a tree to an elevated installer the helper requires that it resolve to
the recorded path, carry no reparse point, and hold an uninstaller signed by the
pinned publisher.

The installed channel is keyed by install root like the digest, and a build
installed by hand infers its channel from its version, so a channel switch no
longer needs a previous in-app install. An inferred switch never takes a
candidate that sorts lower: a hand-installed 2.6.0-rc1 is no longer replaced by
an older stable at quit with nothing shown.

Downloads, the extracted helper and the handoff are per install, so two copies
sharing one cache stop deleting each other's artifact and overwriting each
other's job. A download whose bytes are wrong is dropped; one that cannot be read
is set aside rather than failing every start.

A declined dialog disarms the quit-time install, a check that finds nothing
clears the candidate, and flavours that cannot install in place are told about a
release instead of being ignored. A macOS swap exchanges the bundle in one step
where the filesystem allows it, and a cleanup this user cannot perform is logged
instead of retried forever.
2026-11-15 01:21:30 +08:00
Lam Wei Lun d9692bcf30 Install updates without a dialog, from a per-user installer
The background check no longer opens the update dialog. What to do with a
candidate is a pure decision now (update_action), so it can be tested: an
automatic check prefetches, a check the user started keeps its dialog and
installs at once, and a skipped version stays quiet unless the user asked.

The helper downloads while the application runs and exits; a second run at
quit installs from the verified file. Prefetch therefore takes no lock and
installs nothing, so it cannot race the run that follows it, and the install
that runs after a quit does not start the application again. A failure leaves
update_failed.txt, which the next start shows as a notification: an update
that asks nothing has no other way to report itself. The artifact a prefetch
left behind is now kept by prepare_download_dir instead of being swept and
downloaded again.

The Windows installer is no longer CPack's. CPack hardcodes
RequestExecutionLevel admin and installs to Program Files, so every update
needed a UAC prompt. packaging/windows/orca-slicer.nsi requests the user's
own level and picks the scope at start: a machine-wide install recorded in
the HKLM uninstall key is replaced under Program Files by the elevated helper
it already runs as, and a fresh install goes to LOCALAPPDATA, where an update
needs no elevation at all. The helper now decides that elevation by probing
the install root, and only asks for it when the tree is not writable. Both
registry views are checked, because installers built before this were 32-bit.

A failed install now sets an error level: a silent update reads the exit code,
and an Abort without one looked like success.
2026-11-13 17:15:38 +08:00
Lam Wei Lun 4d794edc0b Fix the updater review findings: helper startup, Windows apply, recovery
The helper exited before reading its handoff because wx's command-line
parser rejected --handoff. Windows portable updates failed on tar.exe
lookup, a working directory inside the install, and the nightly zip's
top-level folder. The AppImage helper now ships with its own libraries.

- Restrict downloads to https GitHub release URLs, verify TLS on the
  version check, set CA certificates and FAILONERROR in the downloader.
- Rename the verified download to its asset name, hold it open on
  Windows, and relaunch the app when an update fails before the swap.
- Use nowide paths in the helper for non-ASCII Windows user names.
- Roll back by renaming the new tree aside; stage Linux copies beside
  the target; drop the predictable macOS marker file.
- Require $APPDIR for AppImage detection; reject read-only macOS volumes.
- Check for updates once after Preferences closes, and drop stale results.
- Offer releases without a matching asset, key Nightly skips by version,
  and let Pre-Release offer a newer final release.
- Find pending.json from a .backup copy and keep the backup unless the
  new build is running from the target.
- Move the build timestamp into its own generated header so it no
  longer invalidates ccache on every CI run.
2026-11-12 12:31:44 +08:00
Lam Wei Lun 857a42c2d5 Add the includes clang-tidy's include check asks for
Every file the updater touches now names the headers for the symbols it
uses, instead of relying on a transitive include.
2026-11-11 17:20:22 +08:00
Lam Wei Lun e87a9833f2 Keep the updater cache in the OS cache and clean up after an install
The updater wrote everything it needed under the data directory: the
cache, its records, the downloaded artifact and the extracted helper.
Move the whole root to the OS cache directory, and give a portable
Windows install a suffixed folder there instead of %TEMP%, so a temp
sweep cannot strand a partial download.

Now that a finished install leaves nothing to resume, the next start
deletes the download and each helper run starts a fresh log, so neither
grows by one copy per update.

A partial download is resumed only for the build it was started for: the
digest is recorded beside it, and a .part already as large as the
release is verified again instead of being fetched a second time.

The download preparation lives in libslic3r so it can be tested, with
cases for a matching build, another build, a missing record, an
oversized file, a complete file and a sibling artifact.
2026-11-11 17:19:09 +08:00
Lam Wei Lun ae1735000d Initial Commit of Auto Updater 2026-11-10 21:36:47 +08:00