Docs · Guide
Mirrors in China: faster packinggoods plugin, Bun and update downloads
From China, npm and GitHub are often slow or unreachable when installing plugins. packinggoods can have those downloads asked of a mirror in China first; the mirror's file is the very same, checked the same way.
The Plugins page's Mirrors in China
- Open the Plugins page.
- Turn on Mirrors in China.The page's downloads then ask a mirror in China first and the official address after.
- npm (plugin packages, versions and search):
registry.npmmirror.com. - Bun: npmmirror's binary mirror.
- The plugin list: jsDelivr (
cdn.jsdelivr.net/gh/chanccer/packinggoods-plugins).
What the mirror hasn't copied yet is asked of the official address. npm's weekly download counts stay npmjs's own. bun add is pointed at npmmirror too, unless BUN_CONFIG_REGISTRY or NPM_CONFIG_REGISTRY names a registry already. The switch never sends anything through a proxy such as gh-proxy.
Installs and updates through a mirror or proxy
Both the installer and packinggoods update take --proxy (http, https, socks5, socks5h; or PACKINGGOODS_PROXY, HTTPS_PROXY, ALL_PROXY) and --mirror, a GitHub download mirror put before the release's github.com URL (or PACKINGGOODS_MIRROR).
curl -fsSL https://packinggoods.com/install.sh | sh -s -- --proxy http://127.0.0.1:7890 packinggoods update --mirror https://mirror.example/ packinggoods update mirror https://mirror.example/ # every update, the app's too packinggoods update mirror off
In the app, Settings' Download source row has Use a mirror… for a Mirror address, and Remove mirror to go back. No mirror is used unless you give one. On a network that lets GitHub through and not packinggoods.com, nothing needs setting: the update comes from GitHub, its signature checked.
Download source and Update source in Settings
Two rows in the app's Settings decide where an update comes from. Neither needs changing on a network that reaches packinggoods.com.
| Setting | Choice | What the update is downloaded from |
|---|---|---|
| About › Download source | packinggoods.com (the default) | packinggoods.com, and github.com when that fails. |
| Use a mirror… | packinggoods.com, and the mirror when that fails, in place of github.com. Remove mirror goes back. | |
| About › Update source | Automatic (the default) | packinggoods.com's release list and files, and GitHub's when the site can't be reached. |
| packinggoods.com only | packinggoods.com alone, never GitHub, so a mirror is never used. | |
| GitHub only | github.com alone (through the mirror when one is set), never packinggoods.com. |
What a mirror's address is
A mirror here is a GitHub download proxy: a site that fetches any github.com link put after its own address, as in https://mirror.example/https://github.com/chanccer/packinggoods-releases/releases/download/…. Type only the part before https://github.com, a full https:// address such as https://mirror.example/. Public GitHub download proxies work this way; gh-proxy.com, the one PACKINGGOODS_MIRRORS falls back to, is one of them. packinggoods names no mirror of its own and vouches for none: whichever you use, the file is checked against packinggoods.com's checksum and the release's signature, and one that doesn't match is not installed.
When to use one
- An update stalls or fails with a timeout or
EOF, and both packinggoods.com and github.com are slow or blocked where you are (often in mainland China): set a mirror. - packinggoods.com is slow and GitHub is fast: pick GitHub only, no mirror needed.
- You have a proxy: put it in Network and sharing › App updates instead; a mirror is for when you have none.
- A download that failed through the mirror says so, and offers to download from GitHub instead, which removes the mirror.
PACKINGGOODS_MIRRORS: a mirror after a failure
Another way is off by default. With PACKINGGOODS_MIRRORS=on, the official source is tried first, and a mirror only after a network error, HTTP 429, HTTP 5xx or GitHub's rate-limit 403. The defaults are registry.npmmirror.com for npm and gh-proxy.com for GitHub; PACKINGGOODS_NPM_REGISTRY and PACKINGGOODS_GITHUB_MIRROR replace them:
PACKINGGOODS_MIRRORS=on \ PACKINGGOODS_NPM_REGISTRY=https://registry.example.com \ PACKINGGOODS_GITHUB_MIRROR=https://gh.example packinggoods serve
The official source and the mirror share one request budget, so a hanging official source doesn't make the wait twice as long.
Is a mirror safe
- packinggoods's own update files are checked against a SHA-256 from packinggoods.com, never from the mirror; a file that doesn't match is not installed.
- Bun's zip is checked against Bun's SHA-256s, and a plugin package against the integrity npm gave.
- Requests that carry credentials (
Authorization, a cookie, an API key, a token in the URL) never use a mirror; they go to the official source alone. - Skill tarballs always use the official source.
- npm metadata, plugin READMEs and search results and version checks are not checksummed; a mirror can report a different version.
FAQ
Plugins install slowly in packinggoods. What helps?
Turn on Mirrors in China on the Plugins page. The plugin list comes from jsDelivr, npm packages and Bun from npmmirror, and the official address after.
A packinggoods update fails to download. What do I do?
Run packinggoods update --mirror
Can a mirror see my API keys?
No. Requests carrying Authorization, a cookie, an API key or a URL token never use a mirror; they go to the official source alone.
How is PACKINGGOODS_MIRRORS different from the Mirrors in China switch?
The switch has the Plugins page ask a mirror in China first. PACKINGGOODS_MIRRORS=on asks the official source first and a mirror only after a network error, 429, 5xx or GitHub's rate limit.
Related: Get started, Fixing common errors: 401, 429, 502, 504 and more. Questions go to Discord.