📝 add notes
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// init aliyun drive
|
||||
func InitAliDrive() bool {
|
||||
log.Infof("初始化阿里云盘...")
|
||||
//首先token_login
|
||||
|
@@ -7,6 +7,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// init cache
|
||||
func InitCache() {
|
||||
if conf.Conf.Cache.Enable {
|
||||
log.Infof("初始化缓存...")
|
||||
|
@@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// init request client
|
||||
func InitClient() {
|
||||
log.Infof("初始化client...")
|
||||
conf.Client=&http.Client{}
|
||||
|
@@ -16,6 +16,7 @@ func init() {
|
||||
flag.StringVar(&conf.Con,"conf","conf.yml","config file")
|
||||
}
|
||||
|
||||
// bootstrap run
|
||||
func Run() {
|
||||
flag.Parse()
|
||||
if conf.Help {
|
||||
@@ -29,6 +30,7 @@ func Run() {
|
||||
start()
|
||||
}
|
||||
|
||||
// print asc
|
||||
func printASC() {
|
||||
log.Info(`
|
||||
________ ___ ___ ________ _________
|
||||
@@ -42,6 +44,7 @@ func printASC() {
|
||||
`)
|
||||
}
|
||||
|
||||
// start server
|
||||
func start() {
|
||||
InitLog()
|
||||
printASC()
|
||||
@@ -60,6 +63,7 @@ func start() {
|
||||
server()
|
||||
}
|
||||
|
||||
// start http server
|
||||
func server() {
|
||||
baseServer:="0.0.0.0:"+conf.Conf.Server.Port
|
||||
r:=gin.Default()
|
||||
|
@@ -9,6 +9,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// read config file
|
||||
func ReadConf(config string) bool {
|
||||
log.Infof("读取配置文件...")
|
||||
if !utils.Exists(config) {
|
||||
|
@@ -8,10 +8,12 @@ import (
|
||||
|
||||
var Cron *cron.Cron
|
||||
|
||||
// refresh token func for cron
|
||||
func refreshToken() {
|
||||
alidrive.RefreshToken()
|
||||
}
|
||||
|
||||
// init cron jobs
|
||||
func InitCron() {
|
||||
log.Infof("初始化定时任务:刷新token")
|
||||
Cron=cron.New()
|
||||
|
@@ -6,6 +6,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// init logrus
|
||||
func InitLog() {
|
||||
if conf.Debug {
|
||||
log.SetLevel(log.DebugLevel)
|
||||
|
@@ -9,12 +9,14 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// github release response bean
|
||||
type GithubRelease struct {
|
||||
TagName string `json:"tag_name"`
|
||||
HtmlUrl string `json:"html_url"`
|
||||
Body string `json:"body"`
|
||||
}
|
||||
|
||||
// check updtae
|
||||
func CheckUpdate() {
|
||||
log.Infof("检查更新...")
|
||||
url:="https://api.github.com/repos/Xhofe/alist/releases/latest"
|
||||
|
Reference in New Issue
Block a user