mirror of
https://github.com/HChaZZY/alist.git
synced 2025-12-06 11:03:49 +08:00
Compare commits
4 Commits
v2.0.4
...
v2.0.4-fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bcf19f4f3e | ||
|
|
efeee0e276 | ||
|
|
e789873eca | ||
|
|
14b9b76e87 |
@@ -131,6 +131,14 @@ func InitSettings() {
|
|||||||
Access: model.PRIVATE,
|
Access: model.PRIVATE,
|
||||||
Group: model.FRONT,
|
Group: model.FRONT,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Key: "home emoji",
|
||||||
|
Value: "🏠",
|
||||||
|
Type: "text",
|
||||||
|
Description: "emoji in front of home in nav",
|
||||||
|
Access: model.PUBLIC,
|
||||||
|
Group: model.FRONT,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Key: "animation",
|
Key: "animation",
|
||||||
Value: "true",
|
Value: "true",
|
||||||
|
|||||||
@@ -13,7 +13,11 @@ type BaseResp struct {
|
|||||||
|
|
||||||
type PathResp struct {
|
type PathResp struct {
|
||||||
BaseResp
|
BaseResp
|
||||||
Data []model.File `json:"data"`
|
Data struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
//Meta Meta `json:"meta"`
|
||||||
|
Files []model.File `json:"files"`
|
||||||
|
} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PreviewResp struct {
|
type PreviewResp struct {
|
||||||
@@ -25,7 +29,7 @@ func (driver *Alist) Login(account *model.Account) error {
|
|||||||
var resp BaseResp
|
var resp BaseResp
|
||||||
_, err := base.RestyClient.R().SetResult(&resp).
|
_, err := base.RestyClient.R().SetResult(&resp).
|
||||||
SetHeader("Authorization", account.AccessToken).
|
SetHeader("Authorization", account.AccessToken).
|
||||||
Get(account.SiteUrl+"/api/admin/login")
|
Get(account.SiteUrl + "/api/admin/login")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,13 +136,13 @@ func (driver Alist) Path(path string, account *model.Account) (*model.File, []mo
|
|||||||
if resp.Code != 200 {
|
if resp.Code != 200 {
|
||||||
return nil, nil, errors.New(resp.Message)
|
return nil, nil, errors.New(resp.Message)
|
||||||
}
|
}
|
||||||
if resp.Message == "file" {
|
if resp.Data.Type == "file" {
|
||||||
return &resp.Data[0], nil, nil
|
return &resp.Data.Files[0], nil, nil
|
||||||
}
|
}
|
||||||
if len(resp.Data) > 0 {
|
if len(resp.Data.Files) > 0 {
|
||||||
_ = base.SetCache(path, resp.Data, account)
|
_ = base.SetCache(path, resp.Data.Files, account)
|
||||||
}
|
}
|
||||||
return nil, resp.Data, nil
|
return nil, resp.Data.Files, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (driver Alist) Proxy(c *gin.Context, account *model.Account) {}
|
func (driver Alist) Proxy(c *gin.Context, account *model.Account) {}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ func GetConfig() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
NoCors = strings.Trim(NoCors, ",")
|
NoCors = strings.Trim(NoCors, ",")
|
||||||
NoUpload = strings.Trim(NoUpload, ",")
|
NoUpload += "root"
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ func UploadFile(c *gin.Context) {
|
|||||||
Size: uint64(file.Size),
|
Size: uint64(file.Size),
|
||||||
ParentPath: path_,
|
ParentPath: path_,
|
||||||
Name: file.Filename,
|
Name: file.Filename,
|
||||||
MIMEType: c.GetHeader("Content-Type"),
|
MIMEType: file.Header.Get("Content-Type"),
|
||||||
}
|
}
|
||||||
err = driver.Upload(&fileStream, account)
|
err = driver.Upload(&fileStream, account)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user