-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
84 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package bootstrap | ||
|
||
import ( | ||
"encoding/json" | ||
"github.com/Xhofe/alist/conf" | ||
log "github.com/sirupsen/logrus" | ||
"io/ioutil" | ||
"net/http" | ||
) | ||
|
||
type GithubRelease struct { | ||
TagName string `json:"tag_name"` | ||
HtmlUrl string `json:"html_url"` | ||
Body string `json:"body"` | ||
} | ||
|
||
func CheckUpdate() { | ||
url:="https://api.github.com/repos/Xhofe/alist/releases/latest" | ||
resp,err:=http.Get(url) | ||
if err!=nil { | ||
log.Warnf("检查更新失败:%s",err.Error()) | ||
return | ||
} | ||
body,err:=ioutil.ReadAll(resp.Body) | ||
if err!=nil { | ||
log.Warnf("读取更新内容失败:%s",err.Error()) | ||
return | ||
} | ||
var release GithubRelease | ||
err = json.Unmarshal(body,&release) | ||
if err!=nil { | ||
log.Warnf("解析更新失败:%s",err.Error()) | ||
return | ||
} | ||
if conf.VERSION == release.TagName { | ||
log.Infof("当前已是最新版本:%s",release.TagName) | ||
}else { | ||
log.Infof("发现新版本:%s",release.TagName) | ||
log.Infof("请至'%s'获取更新.",release.HtmlUrl) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters