📝 add notes

This commit is contained in:
微凉
2021-02-04 10:02:34 +08:00
parent 3b2a729dc6
commit e146054679
26 changed files with 91 additions and 28 deletions

View File

@@ -6,6 +6,7 @@ import (
log "github.com/sirupsen/logrus"
)
// init aliyun drive
func InitAliDrive() bool {
log.Infof("初始化阿里云盘...")
//首先token_login

View File

@@ -7,6 +7,7 @@ import (
"time"
)
// init cache
func InitCache() {
if conf.Conf.Cache.Enable {
log.Infof("初始化缓存...")

View File

@@ -6,6 +6,7 @@ import (
"net/http"
)
// init request client
func InitClient() {
log.Infof("初始化client...")
conf.Client=&http.Client{}

View File

@@ -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()

View File

@@ -9,6 +9,7 @@ import (
"strings"
)
// read config file
func ReadConf(config string) bool {
log.Infof("读取配置文件...")
if !utils.Exists(config) {

View File

@@ -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()

View File

@@ -6,6 +6,7 @@ import (
log "github.com/sirupsen/logrus"
)
// init logrus
func InitLog() {
if conf.Debug {
log.SetLevel(log.DebugLevel)

View File

@@ -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"