feat: add 189cloud driver
This commit is contained in:
@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func GetApiUrl(r *http.Request) string {
|
||||
api := setting.GetByKey(conf.ApiUrl)
|
||||
api := setting.GetStr(conf.ApiUrl)
|
||||
protocol := "http"
|
||||
if r != nil {
|
||||
if r.TLS != nil {
|
||||
|
@ -130,9 +130,9 @@ func Generate2FA(c *gin.Context) {
|
||||
// to base64
|
||||
var buf bytes.Buffer
|
||||
png.Encode(&buf, img)
|
||||
base64 := base64.StdEncoding.EncodeToString(buf.Bytes())
|
||||
b64 := base64.StdEncoding.EncodeToString(buf.Bytes())
|
||||
common.SuccessResp(c, gin.H{
|
||||
"qr": "data:image/png;base64," + base64,
|
||||
"qr": "data:image/png;base64," + b64,
|
||||
"secret": key.Secret(),
|
||||
})
|
||||
}
|
||||
|
@ -2,17 +2,18 @@ package handles
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/alist-org/alist/v3/internal/conf"
|
||||
"github.com/alist-org/alist/v3/internal/setting"
|
||||
"github.com/alist-org/alist/v3/server/common"
|
||||
"github.com/gin-gonic/gin"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func Favicon(c *gin.Context) {
|
||||
c.Redirect(302, setting.GetByKey(conf.Favicon))
|
||||
c.Redirect(302, setting.GetStr(conf.Favicon))
|
||||
}
|
||||
|
||||
func Plist(c *gin.Context) {
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
// if token is empty, set user to guest
|
||||
func Auth(c *gin.Context) {
|
||||
token := c.GetHeader("Authorization")
|
||||
if token == setting.GetByKey(conf.Token) {
|
||||
if token == setting.GetStr(conf.Token) {
|
||||
admin, err := db.GetAdmin()
|
||||
if err != nil {
|
||||
common.ErrorResp(c, err, 500)
|
||||
|
@ -16,7 +16,7 @@ func Init(r *gin.Engine) {
|
||||
common.SecretKey = []byte(conf.Conf.JwtSecret)
|
||||
Cors(r)
|
||||
r.Use(middlewares.StoragesLoaded)
|
||||
WebDav(r)
|
||||
WebDav(r.Group("/dav"))
|
||||
|
||||
r.GET("/favicon.ico", handles.Favicon)
|
||||
r.GET("/i/:link/:name", handles.Plist)
|
||||
|
@ -26,12 +26,12 @@ func InitIndex() {
|
||||
|
||||
func UpdateIndex() {
|
||||
cdn := strings.TrimSuffix(conf.Conf.Cdn, "/")
|
||||
basePath := setting.GetByKey(conf.BasePath)
|
||||
apiUrl := setting.GetByKey(conf.ApiUrl)
|
||||
favicon := setting.GetByKey(conf.Favicon)
|
||||
title := setting.GetByKey(conf.SiteTitle)
|
||||
customizeHead := setting.GetByKey(conf.CustomizeHead)
|
||||
customizeBody := setting.GetByKey(conf.CustomizeBody)
|
||||
basePath := setting.GetStr(conf.BasePath)
|
||||
apiUrl := setting.GetStr(conf.ApiUrl)
|
||||
favicon := setting.GetStr(conf.Favicon)
|
||||
title := setting.GetStr(conf.SiteTitle)
|
||||
customizeHead := setting.GetStr(conf.CustomizeHead)
|
||||
customizeBody := setting.GetStr(conf.CustomizeBody)
|
||||
conf.ManageHtml = conf.RawIndexHtml
|
||||
replaceMap1 := map[string]string{
|
||||
"https://jsd.nn.ci/gh/alist-org/logo@main/logo.svg": favicon,
|
||||
|
@ -24,8 +24,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func WebDav(r *gin.Engine) {
|
||||
dav := r.Group("/dav")
|
||||
func WebDav(dav *gin.RouterGroup) {
|
||||
dav.Use(WebDAVAuth)
|
||||
dav.Any("/*path", ServeWebDAV)
|
||||
dav.Any("", ServeWebDAV)
|
||||
|
Reference in New Issue
Block a user