File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -240,7 +240,7 @@ func appSpecs() []appSpec {
240240 latest : & latestVersionSource {
241241 baseURL : "https://csgclaw.opencsg.com/releases/latest" ,
242242 envVar : "CSGHUB_LITE_CSGCLAW_LATEST_URL" ,
243- format : "version-json " ,
243+ format : "github-release " ,
244244 },
245245 unix : & scriptSource {
246246 mirrorURL : "https://csgclaw.opencsg.com/install.sh" ,
Original file line number Diff line number Diff line change @@ -275,8 +275,9 @@ func TestAppUpdateAvailableComparesVersionOrder(t *testing.T) {
275275
276276func TestFetchLatestVersionParsesGitHubReleaseTag (t * testing.T ) {
277277 server := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
278- if r .URL .Path != "/repos/OpenCSGs/csgclaw/releases/latest" {
279- t .Fatalf ("latest path = %q, want /repos/OpenCSGs/csgclaw/releases/latest" , r .URL .Path )
278+ // Mirrors https://csgclaw.opencsg.com/releases/latest (GitHub-compatible JSON).
279+ if r .URL .Path != "/releases/latest" {
280+ t .Fatalf ("latest path = %q, want /releases/latest" , r .URL .Path )
280281 }
281282 w .Header ().Set ("Content-Type" , "application/json" )
282283 _ , _ = w .Write ([]byte (`{"tag_name":"v0.2.8"}` ))
@@ -287,7 +288,7 @@ func TestFetchLatestVersionParsesGitHubReleaseTag(t *testing.T) {
287288 latest , err := mgr .fetchLatestVersion (context .Background (), appSpec {
288289 id : "csgclaw" ,
289290 latest : & latestVersionSource {
290- baseURL : server .URL + "/repos/OpenCSGs/csgclaw/ releases/latest" ,
291+ baseURL : server .URL + "/releases/latest" ,
291292 format : "github-release" ,
292293 },
293294 })
Original file line number Diff line number Diff line change 22set -euo pipefail
33
44APP=" ${APP:- csgclaw} "
5- REPO=" ${REPO:- OpenCSGs/ csgclaw} "
65VERSION=" ${VERSION:- ${1:- latest} } "
76INSTALL_DIR=" ${INSTALL_DIR:- $HOME / .local/ bin} "
87LIB_DIR=" ${LIB_DIR:- $HOME / .local/ lib/ ${APP} } "
@@ -66,8 +65,11 @@ ensure_supported_platform() {
6665}
6766
6867resolve_latest_version () {
69- local api_url tag
70- api_url=" https://api.github.com/repos/${REPO} /releases/latest"
68+ local api_url tag base
69+ # Mirror serves GitHub-compatible JSON at ${BASE_URL}/latest (tag_name, assets, ...).
70+ base=" ${BASE_URL:- https:// csgclaw.opencsg.com/ releases} "
71+ while [[ " $base " == * / ]]; do base=" ${base%/ } " ; done
72+ api_url=" ${base} /latest"
7173 tag=" $( curl -fsSL " $api_url " | sed -n ' s/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n 1) "
7274 if [[ -z " $tag " ]]; then
7375 log " ERROR: failed to resolve latest release from ${api_url} "
You can’t perform that action at this time.
0 commit comments