🔨 switch fiber to gin

This commit is contained in:
微凉
2021-11-13 15:53:26 +08:00
parent 65ec4e3611
commit cf07b3921c
22 changed files with 320 additions and 252 deletions

View File

@ -5,8 +5,8 @@ import (
"github.com/Xhofe/alist/conf"
"github.com/Xhofe/alist/model"
"github.com/Xhofe/alist/utils"
"github.com/gin-gonic/gin"
"github.com/go-resty/resty/v2"
"github.com/gofiber/fiber/v2"
"github.com/robfig/cron/v3"
log "github.com/sirupsen/logrus"
"path/filepath"
@ -103,9 +103,9 @@ func (a AliDrive) Items() []Item {
}
}
func (a AliDrive) Proxy(ctx *fiber.Ctx) {
ctx.Request().Header.Del("Origin")
ctx.Request().Header.Set("Referer", "https://www.aliyundrive.com/")
func (a AliDrive) Proxy(c *gin.Context) {
c.Request.Header.Del("Origin")
c.Request.Header.Set("Referer", "https://www.aliyundrive.com/")
}
type AliRespError struct {

View File

@ -2,7 +2,7 @@ package drivers
import (
"github.com/Xhofe/alist/model"
"github.com/gofiber/fiber/v2"
"github.com/gin-gonic/gin"
)
type Driver interface {
@ -10,7 +10,7 @@ type Driver interface {
Path(path string, account *model.Account) (*model.File, []*model.File, error)
Link(path string, account *model.Account) (string, error)
Save(account *model.Account, old *model.Account) error
Proxy(ctx *fiber.Ctx)
Proxy(c *gin.Context)
Preview(path string, account *model.Account) (interface{}, error)
// TODO
//MakeDir(path string, account *model.Account) error

View File

@ -5,7 +5,7 @@ import (
"github.com/Xhofe/alist/conf"
"github.com/Xhofe/alist/model"
"github.com/Xhofe/alist/utils"
"github.com/gofiber/fiber/v2"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
"io/ioutil"
"os"
@ -31,7 +31,7 @@ func (n Native) Items() []Item {
}
}
func (n Native) Proxy(ctx *fiber.Ctx) {
func (n Native) Proxy(c *gin.Context) {
// unnecessary
}

View File

@ -5,8 +5,8 @@ import (
"github.com/Xhofe/alist/conf"
"github.com/Xhofe/alist/model"
"github.com/Xhofe/alist/utils"
"github.com/gin-gonic/gin"
"github.com/go-resty/resty/v2"
"github.com/gofiber/fiber/v2"
"github.com/robfig/cron/v3"
"path/filepath"
"time"
@ -295,7 +295,7 @@ func (o Onedrive) Save(account *model.Account, old *model.Account) error {
return nil
}
func (o Onedrive) Proxy(ctx *fiber.Ctx) {
func (o Onedrive) Proxy(c *gin.Context) {
}