2020-02-21 04:23:16 +01:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/photoprism/photoprism/internal/config"
|
|
|
|
)
|
|
|
|
|
2024-01-10 09:56:46 +01:00
|
|
|
const (
|
|
|
|
WebDAVOriginals = "/originals"
|
|
|
|
WebDAVImport = "/import"
|
|
|
|
)
|
2021-01-02 18:56:15 +01:00
|
|
|
|
2024-01-10 12:46:00 +01:00
|
|
|
// registerWebDAVRoutes adds routes for handling webdav client requests.
|
2022-10-18 14:21:23 +02:00
|
|
|
func registerWebDAVRoutes(router *gin.Engine, conf *config.Config) {
|
|
|
|
if conf.DisableWebDAV() {
|
2023-02-09 13:14:56 +01:00
|
|
|
log.Info("webdav: disabled")
|
2022-10-18 14:21:23 +02:00
|
|
|
} else {
|
2023-02-09 13:14:56 +01:00
|
|
|
var info string
|
|
|
|
if conf.ReadOnly() {
|
|
|
|
info = " in read-only mode"
|
|
|
|
} else {
|
|
|
|
info = ""
|
|
|
|
}
|
|
|
|
|
2023-12-12 18:42:50 +01:00
|
|
|
WebDAV(conf.OriginalsPath(), router.Group(conf.BaseUri(WebDAVOriginals), WebDAVAuth(conf)), conf)
|
2023-02-09 13:14:56 +01:00
|
|
|
log.Infof("webdav: shared %s/%s", conf.BaseUri(WebDAVOriginals), info)
|
2022-10-18 14:21:23 +02:00
|
|
|
|
|
|
|
if conf.ImportPath() != "" {
|
2023-12-12 18:42:50 +01:00
|
|
|
WebDAV(conf.ImportPath(), router.Group(conf.BaseUri(WebDAVImport), WebDAVAuth(conf)), conf)
|
2023-02-09 13:14:56 +01:00
|
|
|
log.Infof("webdav: shared %s/%s", conf.BaseUri(WebDAVImport), info)
|
2022-10-18 14:21:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|