photoprism/internal/server/routes_webdav.go
Michael Mayer 7ef544fa53 Docs: Improve inline comments of the internal/server package #782 #3943
Signed-off-by: Michael Mayer <michael@photoprism.app>
2024-01-10 12:46:00 +01:00

33 lines
871 B
Go

package server
import (
"github.com/gin-gonic/gin"
"github.com/photoprism/photoprism/internal/config"
)
const (
WebDAVOriginals = "/originals"
WebDAVImport = "/import"
)
// registerWebDAVRoutes adds routes for handling webdav client requests.
func registerWebDAVRoutes(router *gin.Engine, conf *config.Config) {
if conf.DisableWebDAV() {
log.Info("webdav: disabled")
} else {
var info string
if conf.ReadOnly() {
info = " in read-only mode"
} else {
info = ""
}
WebDAV(conf.OriginalsPath(), router.Group(conf.BaseUri(WebDAVOriginals), WebDAVAuth(conf)), conf)
log.Infof("webdav: shared %s/%s", conf.BaseUri(WebDAVOriginals), info)
if conf.ImportPath() != "" {
WebDAV(conf.ImportPath(), router.Group(conf.BaseUri(WebDAVImport), WebDAVAuth(conf)), conf)
log.Infof("webdav: shared %s/%s", conf.BaseUri(WebDAVImport), info)
}
}
}