* perf(upgrade): download release assets over parallel ranges
release-assets.githubusercontent.com throttles each connection on some
networks. The 9.6 MB darwin_arm64 archive took 122-171 s over one
connection but 25 s as 8 ranges, each on its own connection, with an
identical checksum. `skillshare upgrade` and the first `skillshare ui`
of a new version both waited minutes on that download.
DownloadToFile probes with `Range: bytes=0-0`; a 206 answer splits the
file into ranges fetched in parallel from the redirected URL, and a 200
answer streams the single response as before, so servers without range
support cost no extra request. Size limits and checksum verification are
unchanged.
The UI asset download is about 2 MB now, so the docs no longer say 1 MB.
* fix(upgrade): keep the caller's transport for parallel ranges
Each range built its client from http.DefaultTransport, so a caller's
custom transport (private CA, authenticated proxy, custom dialer) only
applied to the probe. The ranges then failed or bypassed the caller's
network setup even though the probe succeeded. Each range now copies the
caller's client with a clone of its *http.Transport, which keeps those
settings and still gives the range its own connection. A transport that
cannot be cloned is shared as is.
Both release downloaders removed the temp file while it was still open,
relying on the deferred Close. Windows refuses to delete an open file, so
an interrupted or oversized download could leave up to ~100 MB behind in
%TEMP%. Closing first makes the cleanup work on every platform.
Raised in review of #335; downloadToTemp in uidist had the same pattern.
* refactor(version): own the release checksum helpers
The UI asset download already verifies its tarball against the release
checksums file, but the fetch, parse, and hashing helpers were private to
`internal/uidist`, so a second caller had nothing to reuse: `internal/version`
builds the checksums URL and `internal/utils` already hashes files.
Move the parser and the fetcher next to the URL they consume, keep the same
messages, and drop uidist's private SHA-256 duplicate in favour of
`utils.FileHash`. No behavior change.
* fix(upgrade): verify the release archive before replacing the binary
`skillshare upgrade --cli` streamed the release archive straight into the
extractor and renamed the result over the live executable, so an archive that
did not match the release was installed anyway. The UI asset download in the
same product has always refused on a mismatch, and the release workflow checks
every asset against checksums.txt before publishing, so the published hashes
were the one integrity signal this path did not consult.
Stage the archive to a temp file, compare its SHA-256 with the entry for the
downloaded asset name, and extract only when they agree. A mismatch, an entry
for a different file, or an unreachable checksums.txt stops the upgrade and
leaves the running binary untouched. This guards against damaged or mismatched
downloads rather than a release whose assets and checksums were replaced
together.
Tests use a local server and build the archive each platform extracts, so all
four outcomes are covered without network access. The sudo child re-enters this
same function, so elevated upgrades are covered too.
---------
Co-authored-by: Willie <egg358358@gmail.com>
On a slow GitHub CDN the ~9MB release archive can take minutes, and a
bare spinner made upgrade look hung, prompting users to abort it.
Show bytes read / total for the CLI and UI asset downloads on a TTY.
Move GetCacheDir() from version package to config.CacheDir(), consistent
with BaseDir()/DataDir()/StateDir() pattern including Windows fallback.
Add XDG_CACHE_HOME and cache paths to website docs.
Replace the embedded SPA (go:embed + build tags) with runtime download
from GitHub Releases. The binary no longer bundles UI assets — they are
downloaded on first `skillshare ui` launch and cached at
~/.cache/skillshare/ui/<version>/.
- Delete embed.go / embed_dev.go; add spa_disk.go with placeholder handler
- Simplify ensureUIAvailable(): cache check before dev-mode fallback
- Pre-download UI assets in `skillshare upgrade` (best-effort)
- Remove Node stages from production and CI Dockerfiles
- Keep Node stage in sandbox for playground UI cache pre-population
- Remove ui-embed-check CI job and -tags dev build flag
- Update Makefile, mise.toml, GoReleaser, release workflow