feat: implement WebDAV protocol support with WsgiDAV + account management API
All checks were successful
Test / test (push) Successful in 2m14s
All checks were successful
Test / test (push) Successful in 2m14s
Add complete WebDAV support: management REST API (CRUD accounts at /api/v1/webdav/accounts) and DAV protocol endpoint (/dav) using WsgiDAV + a2wsgi bridge for client access via HTTP Basic Auth. Includes Redis+TTLCache auth caching and integration tests (24 cases). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
35
routers/dav/__init__.py
Normal file
35
routers/dav/__init__.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""
|
||||
WebDAV 协议入口
|
||||
|
||||
使用 WsgiDAV + a2wsgi 提供 WebDAV 协议支持。
|
||||
WsgiDAV 在 a2wsgi 的线程池中运行,不阻塞 FastAPI 事件循环。
|
||||
"""
|
||||
from a2wsgi import WSGIMiddleware
|
||||
from wsgidav.wsgidav_app import WsgiDAVApp
|
||||
|
||||
from .domain_controller import DiskNextDomainController
|
||||
from .provider import DiskNextDAVProvider
|
||||
|
||||
_wsgidav_config: dict[str, object] = {
|
||||
"provider_mapping": {
|
||||
"/": DiskNextDAVProvider(),
|
||||
},
|
||||
"http_authenticator": {
|
||||
"domain_controller": DiskNextDomainController,
|
||||
"accept_basic": True,
|
||||
"accept_digest": False,
|
||||
"default_to_digest": False,
|
||||
},
|
||||
"verbose": 1,
|
||||
# 使用 WsgiDAV 内置的内存锁管理器
|
||||
"lock_storage": True,
|
||||
# 禁用 WsgiDAV 的目录浏览器(纯 DAV 协议)
|
||||
"dir_browser": {
|
||||
"enable": False,
|
||||
},
|
||||
}
|
||||
|
||||
_wsgidav_app = WsgiDAVApp(_wsgidav_config)
|
||||
|
||||
dav_app = WSGIMiddleware(_wsgidav_app, workers=10)
|
||||
"""ASGI 应用,挂载到 /dav 路径"""
|
||||
Reference in New Issue
Block a user