mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🧑💻 Kernel serve CardDAV service on path /carddav/ (#12895)
* 🎨 add CardDAV server * 🎨 change CardDAV principals path * 🎨 implement load contacts feature * 🎨 implement save contacts feature * 🎨 implement address books CURD * 🐛 fix CardDAV method `OPTIONS` * 🎨 implement addresses CURD * 🎨 implement CardDAV `REPORT` method * 🎨 parse *.vcf file with multiple vCard
This commit is contained in:
parent
96194f7dae
commit
c110b9ff13
6 changed files with 1020 additions and 19 deletions
|
|
@ -34,6 +34,11 @@ import (
|
|||
"github.com/steambap/captcha"
|
||||
)
|
||||
|
||||
var (
|
||||
BasicAuthHeaderKey = "WWW-Authenticate"
|
||||
BasicAuthHeaderValue = "Basic realm=\"SiYuan Authorization Require\", charset=\"UTF-8\""
|
||||
)
|
||||
|
||||
func LogoutAuth(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
@ -300,8 +305,8 @@ func CheckAuth(c *gin.Context) {
|
|||
}
|
||||
|
||||
// WebDAV BasicAuth Authenticate
|
||||
if strings.HasPrefix(c.Request.RequestURI, "/webdav") {
|
||||
c.Header("WWW-Authenticate", "Basic realm=Authorization Required")
|
||||
if strings.HasPrefix(c.Request.RequestURI, "/webdav") || strings.HasPrefix(c.Request.RequestURI, "/carddav") {
|
||||
c.Header(BasicAuthHeaderKey, BasicAuthHeaderValue)
|
||||
c.AbortWithStatus(http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue