1 Commits

Author SHA1 Message Date
kone 4eb9877082 fix: use Gitea API for version check instead of GitHub 2026-06-06 04:29:48 +08:00
2 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -1 +1 @@
0.1.144
0.1.140
@@ -76,13 +76,14 @@ func (c *githubReleaseClientError) FetchChecksumFile(ctx context.Context, url st
}
func (c *githubReleaseClient) FetchLatestRelease(ctx context.Context, repo string) (*service.GitHubRelease, error) {
url := fmt.Sprintf("https://api.github.com/repos/%s/releases/latest", repo)
// 使用 Gitea API(兼容 GitHub Release API 格式)
url := fmt.Sprintf("http://git.jianshixingqiu.com/api/v1/repos/%s/releases/latest", repo)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
return nil, err
}
req.Header.Set("Accept", "application/vnd.github.v3+json")
req.Header.Set("Accept", "application/json")
req.Header.Set("User-Agent", "Sub2API-Updater")
resp, err := c.httpClient.Do(req)
@@ -92,7 +93,7 @@ func (c *githubReleaseClient) FetchLatestRelease(ctx context.Context, repo strin
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("GitHub API returned %d", resp.StatusCode)
return nil, fmt.Errorf("Gitea API returned %d", resp.StatusCode)
}
var release service.GitHubRelease