3.0 KiB
3.0 KiB
COS Extension Update Design
Goal
Use COS as the release source for extension updates. When the popup opens, it checks a public latest.json on COS. If the COS version is newer than the installed extension version, the popup shows an update card with download actions for the ZIP and the PDF guide, plus manual reload instructions.
Confirmed Scope
- Update prompt appears only in the extension popup.
- No star chart page banner in this change.
- The user keeps the current manual install flow: download, unzip, replace the folder, then reload in
chrome://extensions.
Reusable Implementation
The current repo already has most of the flow:
src/shared/update-check.tsparses the manifest and compares versions.src/popup/index.tschecks for updates when the popup boots.src/popup/view.tsrenders the update status and download actions.src/background/index.tsdownloads the ZIP/PDF throughchrome.downloads.scripts/write-latest-manifest.mjsgeneratesrelease/latest.json.
This change is mostly activation and configuration, not a rewrite.
Manifest Contract
The public COS manifest must keep these fields:
latestVersionminSupportedVersionpublishedAtreleaseNoteszipUrlguideUrl
Rules:
- All asset URLs must be public HTTPS URLs.
- Version comparison stays numeric dotted comparison.
- Popup logic only needs
latestVersionto decide whether to show the update card. minSupportedVersionstays in the manifest for forward compatibility.
COS Layout
Use a fixed release layout like:
https://<cos-domain>/star-chart-search-enhancer/releases/<version>/latest.jsonhttps://<cos-domain>/star-chart-search-enhancer/releases/<version>/star-chart-search-enhancer-internal.ziphttps://<cos-domain>/star-chart-search-enhancer/releases/<version>/星图增强插件-超简单安装使用指南.pdf
User Flow
- User opens the popup.
- Popup reads the current extension version.
- Popup fetches COS
latest.jsonwithno-store. - If
latestVersionis not newer, show “当前已是最新版本”. - If
latestVersionis newer, show “发现新版本” plus release notes. - User clicks:
下载更新包for the ZIP下载使用说明for the PDF
- Popup shows the manual upgrade instructions after download starts.
Error Handling
- If the manifest is missing, invalid, or unreachable, the popup should show a non-blocking update error.
- If download fails, the popup should show a download error and keep the plugin usable.
- Update check failures must not block auth or normal plugin behavior.
Release Process
- Build the release package.
- Package the internal ZIP.
- Generate
latest.jsonwith the real COS base URL. - Upload
latest.json, the ZIP, and the PDF to the COS folder. - Replace the placeholder manifest URL in
src/shared/update-config.ts. - Rebuild and verify the popup update card.
Out of Scope
- Automatic in-place extension updates.
- Auto-reload after download.
- Star chart page update prompts.
- Chrome Web Store publishing.