mirror of
https://github.com/ZizzyDizzyMC/linx-server.git
synced 2026-01-23 02:14:33 +00:00
Allow changing the "selif" path name
This commit is contained in:
parent
6290f408ff
commit
c746f70c10
13 changed files with 27 additions and 16 deletions
12
server.go
12
server.go
|
|
@ -42,6 +42,7 @@ var Config struct {
|
|||
siteName string
|
||||
siteURL string
|
||||
sitePath string
|
||||
selifPath string
|
||||
certFile string
|
||||
keyFile string
|
||||
contentSecurityPolicy string
|
||||
|
|
@ -129,6 +130,11 @@ func setup() *web.Mux {
|
|||
Config.sitePath = "/"
|
||||
}
|
||||
|
||||
Config.selifPath = strings.TrimLeft(Config.selifPath, "/")
|
||||
if lastChar := Config.selifPath[len(Config.selifPath)-1:]; lastChar != "/" {
|
||||
Config.selifPath = Config.selifPath + "/"
|
||||
}
|
||||
|
||||
metaStorageBackend = localfs.NewLocalfsBackend(Config.metaDir)
|
||||
metaBackend = metajson.NewMetaJSONBackend(metaStorageBackend)
|
||||
fileBackend = localfs.NewLocalfsBackend(Config.filesDir)
|
||||
|
|
@ -150,8 +156,8 @@ func setup() *web.Mux {
|
|||
|
||||
// Routing setup
|
||||
nameRe := regexp.MustCompile("^" + Config.sitePath + `(?P<name>[a-z0-9-\.]+)$`)
|
||||
selifRe := regexp.MustCompile("^" + Config.sitePath + `selif/(?P<name>[a-z0-9-\.]+)$`)
|
||||
selifIndexRe := regexp.MustCompile("^" + Config.sitePath + `selif/$`)
|
||||
selifRe := regexp.MustCompile("^" + Config.sitePath + Config.selifPath + `(?P<name>[a-z0-9-\.]+)$`)
|
||||
selifIndexRe := regexp.MustCompile("^" + Config.sitePath + Config.selifPath + `$`)
|
||||
torrentRe := regexp.MustCompile("^" + Config.sitePath + `(?P<name>[a-z0-9-\.]+)/torrent$`)
|
||||
|
||||
if Config.authFile == "" {
|
||||
|
|
@ -211,6 +217,8 @@ func main() {
|
|||
"name of the site")
|
||||
flag.StringVar(&Config.siteURL, "siteurl", "",
|
||||
"site base url (including trailing slash)")
|
||||
flag.StringVar(&Config.selifPath, "selifpath", "selif",
|
||||
"path relative to site base url where files are accessed directly")
|
||||
flag.Int64Var(&Config.maxSize, "maxsize", 4*1024*1024*1024,
|
||||
"maximum upload file size in bytes (default 4GB)")
|
||||
flag.Uint64Var(&Config.maxExpiry, "maxexpiry", 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue