This commit is contained in:
Lennart J. Kurzweg (Nx2)
2026-03-23 14:07:48 +01:00
parent d0b67cfbbb
commit d55fff9f4a
4 changed files with 121 additions and 37 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"log"
"net/http"
"strings"
"time"
"github.com/emersion/go-webdav/caldav"
@@ -27,6 +28,11 @@ func main() {
handler := &caldav.Handler{Backend: be}
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if strings.HasPrefix(r.URL.Path, "/public/") {
be.ServePublicICS(w, r)
return
}
user, password, ok := r.BasicAuth()
if !ok {
w.Header().Set("WWW-Authenticate", `Basic realm="CalDAV Server"`)