Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
9b99e8ab70 | |||
98872a8fdb | |||
ce4a295008 | |||
bc1babb5b5 |
@ -210,6 +210,8 @@ func (d *LanZou) Put(ctx context.Context, dstDir model.Obj, stream model.FileStr
|
|||||||
_, err := d._post(d.BaseUrl+"/fileup.php", func(req *resty.Request) {
|
_, err := d._post(d.BaseUrl+"/fileup.php", func(req *resty.Request) {
|
||||||
req.SetFormData(map[string]string{
|
req.SetFormData(map[string]string{
|
||||||
"task": "1",
|
"task": "1",
|
||||||
|
"vie": "2",
|
||||||
|
"ve": "2",
|
||||||
"id": "WU_FILE_0",
|
"id": "WU_FILE_0",
|
||||||
"name": stream.GetName(),
|
"name": stream.GetName(),
|
||||||
"folder_id": dstDir.GetID(),
|
"folder_id": dstDir.GetID(),
|
||||||
|
@ -51,7 +51,7 @@ func InitDB() {
|
|||||||
if !(strings.HasSuffix(database.DBFile, ".db") && len(database.DBFile) > 3) {
|
if !(strings.HasSuffix(database.DBFile, ".db") && len(database.DBFile) > 3) {
|
||||||
log.Fatalf("db name error.")
|
log.Fatalf("db name error.")
|
||||||
}
|
}
|
||||||
dB, err = gorm.Open(sqlite.Open(fmt.Sprintf("%s?_journal=WAL&_locking=EXCLUSIVE&_vacuum=incremental",
|
dB, err = gorm.Open(sqlite.Open(fmt.Sprintf("%s?_journal=WAL&_vacuum=incremental",
|
||||||
database.DBFile)), gormConfig)
|
database.DBFile)), gormConfig)
|
||||||
}
|
}
|
||||||
case "mysql":
|
case "mysql":
|
||||||
|
@ -11,8 +11,6 @@ const (
|
|||||||
const (
|
const (
|
||||||
// site
|
// site
|
||||||
VERSION = "version"
|
VERSION = "version"
|
||||||
ApiUrl = "api_url"
|
|
||||||
BasePath = "base_path"
|
|
||||||
SiteTitle = "site_title"
|
SiteTitle = "site_title"
|
||||||
Announcement = "announcement"
|
Announcement = "announcement"
|
||||||
AllowIndexed = "allow_indexed"
|
AllowIndexed = "allow_indexed"
|
||||||
|
@ -31,6 +31,8 @@ func BuildIndex(ctx context.Context, indexPaths, ignorePaths []string, maxDepth
|
|||||||
objCount uint64 = 0
|
objCount uint64 = 0
|
||||||
fi model.Obj
|
fi model.Obj
|
||||||
)
|
)
|
||||||
|
log.Infof("build index for: %+v", indexPaths)
|
||||||
|
log.Infof("ignore paths: %+v", ignorePaths)
|
||||||
Running.Store(true)
|
Running.Store(true)
|
||||||
Quit = make(chan struct{}, 1)
|
Quit = make(chan struct{}, 1)
|
||||||
indexMQ := mq.NewInMemoryMQ[ObjWithParent]()
|
indexMQ := mq.NewInMemoryMQ[ObjWithParent]()
|
||||||
|
@ -53,9 +53,10 @@ func updateIgnorePaths() {
|
|||||||
res, err := base.RestyClient.R().Get(url)
|
res, err := base.RestyClient.R().Get(url)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
allowIndexed = utils.Json.Get(res.Body(), "data", conf.AllowIndexed).ToBool()
|
allowIndexed = utils.Json.Get(res.Body(), "data", conf.AllowIndexed).ToBool()
|
||||||
|
v3Visited[addition.Address] = allowIndexed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if allowIndexed {
|
if !allowIndexed {
|
||||||
ignorePaths = append(ignorePaths, storage.GetStorage().MountPath)
|
ignorePaths = append(ignorePaths, storage.GetStorage().MountPath)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3,24 +3,27 @@ package common
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
stdpath "path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/alist-org/alist/v3/internal/conf"
|
"github.com/alist-org/alist/v3/internal/conf"
|
||||||
"github.com/alist-org/alist/v3/internal/setting"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetApiUrl(r *http.Request) string {
|
func GetApiUrl(r *http.Request) string {
|
||||||
api := conf.Conf.SiteURL
|
api := conf.Conf.SiteURL
|
||||||
if api == "" {
|
if strings.HasPrefix(api, "http") {
|
||||||
api = setting.GetStr(conf.ApiUrl)
|
return api
|
||||||
}
|
}
|
||||||
if r != nil && api == "" {
|
if r != nil && api == "" {
|
||||||
protocol := "http"
|
protocol := "http"
|
||||||
if r.TLS != nil {
|
if r.TLS != nil || r.Header.Get("X-Forwarded-Proto") == "https" {
|
||||||
protocol = "https"
|
protocol = "https"
|
||||||
}
|
}
|
||||||
api = fmt.Sprintf("%s://%s", protocol, r.Host)
|
host := r.Host
|
||||||
|
if r.Header.Get("X-Forwarded-Host") != "" {
|
||||||
|
host = r.Header.Get("X-Forwarded-Host")
|
||||||
|
}
|
||||||
|
api = fmt.Sprintf("%s://%s", protocol, stdpath.Join(host, api))
|
||||||
}
|
}
|
||||||
strings.TrimSuffix(api, "/")
|
strings.TrimSuffix(api, "/")
|
||||||
return api
|
return api
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/alist-org/alist/v3/internal/conf"
|
"github.com/alist-org/alist/v3/internal/conf"
|
||||||
"github.com/alist-org/alist/v3/internal/setting"
|
|
||||||
"github.com/alist-org/alist/v3/pkg/utils"
|
"github.com/alist-org/alist/v3/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -25,11 +24,6 @@ func getSiteConfig() SiteConfig {
|
|||||||
BasePath: u.Path,
|
BasePath: u.Path,
|
||||||
Cdn: strings.ReplaceAll(strings.TrimSuffix(conf.Conf.Cdn, "/"), "$version", conf.WebVersion),
|
Cdn: strings.ReplaceAll(strings.TrimSuffix(conf.Conf.Cdn, "/"), "$version", conf.WebVersion),
|
||||||
}
|
}
|
||||||
// try to get old config
|
|
||||||
if siteConfig.ApiURL == "" {
|
|
||||||
siteConfig.ApiURL = setting.GetStr(conf.ApiUrl)
|
|
||||||
siteConfig.BasePath = setting.GetStr(conf.BasePath)
|
|
||||||
}
|
|
||||||
if siteConfig.BasePath != "" {
|
if siteConfig.BasePath != "" {
|
||||||
siteConfig.BasePath = utils.FixAndCleanPath(siteConfig.BasePath)
|
siteConfig.BasePath = utils.FixAndCleanPath(siteConfig.BasePath)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user