support onedrive

This commit is contained in:
微凉
2021-11-02 23:53:05 +08:00
parent 510292c8b0
commit 04e89754f7
4 changed files with 357 additions and 30 deletions

View File

@ -1,7 +1,6 @@
package drivers
import (
"encoding/json"
"github.com/Xhofe/alist/model"
"github.com/gofiber/fiber/v2"
)
@ -12,7 +11,7 @@ type Driver interface {
Link(path string, account *model.Account) (string, error)
Save(account *model.Account, old *model.Account) error
Proxy(ctx *fiber.Ctx)
Preview(path string, account *model.Account) (interface{},error)
Preview(path string, account *model.Account) (interface{}, error)
// TODO
//MakeDir(path string, account *model.Account) error
//Move(src string, des string, account *model.Account) error
@ -24,10 +23,16 @@ type Item struct {
Name string `json:"name"`
Label string `json:"label"`
Type string `json:"type"`
Values string `json:"values"`
Required bool `json:"required"`
Description string `json:"description"`
}
type TokenResp struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
}
var driversMap = map[string]Driver{}
func RegisterDriver(name string, driver Driver) {
@ -48,8 +53,3 @@ func GetDrivers() map[string][]Item {
}
type Json map[string]interface{}
func JsonStr(j Json) string {
data, _ := json.Marshal(j)
return string(data)
}