mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
refactor<Version>: check latest release from api.github.com instead
This commit is contained in:
parent
dcf53c31cc
commit
18f176a66b
1 changed files with 2 additions and 2 deletions
|
@ -52,13 +52,13 @@ namespace SourceGit.Models {
|
||||||
try {
|
try {
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
var req = new HttpClient();
|
var req = new HttpClient();
|
||||||
var rsp = await req.GetAsync("https://gitee.com/api/v5/repos/sourcegit/sourcegit/releases/latest");
|
var rsp = await req.GetAsync("https://api.github.com/repos/sourcegit-scm/sourcegit/releases/latest");
|
||||||
rsp.EnsureSuccessStatusCode();
|
rsp.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
var raw = await rsp.Content.ReadAsStringAsync();
|
var raw = await rsp.Content.ReadAsStringAsync();
|
||||||
#else
|
#else
|
||||||
var web = new WebClient() { Encoding = Encoding.UTF8 };
|
var web = new WebClient() { Encoding = Encoding.UTF8 };
|
||||||
var raw = await web.DownloadStringTaskAsync("https://gitee.com/api/v5/repos/sourcegit/sourcegit/releases/latest");
|
var raw = await web.DownloadStringTaskAsync("https://api.github.com/repos/sourcegit-scm/sourcegit/releases/latest");
|
||||||
#endif
|
#endif
|
||||||
var ver = JsonSerializer.Deserialize<Version>(raw);
|
var ver = JsonSerializer.Deserialize<Version>(raw);
|
||||||
var cur = Assembly.GetExecutingAssembly().GetName().Version;
|
var cur = Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
|
|
Loading…
Reference in a new issue