Files
cista-storage/cista/protocol.py
T
LeoVasanko 123cb45daa WebDAV sync support, access tokens, REST control endpoints (#10)
Implement complete WebDAV file serving compatible with various clients from Windows File Explorer to more specialized sync tools. The old control WebSocket has been updated to part-DAV, part REST API instead. Implemented user:pass BASIC auth. Added UI and backend for creating tokens that avoid the need to use actual username and password for requests from CLI or DAV.

Reviewed-on: #10
2026-04-26 06:22:52 +01:00

58 lines
906 B
Python

from __future__ import annotations
from typing import Any
import msgspec
from cista import config
class ErrorMsg(msgspec.Struct):
error: dict[str, Any]
## Directory listings
class FileEntry(msgspec.Struct, array_like=True, frozen=True):
level: int
name: str
key: str
mtime: int
size: int
allocated: int
isfile: int
def __str__(self):
return self.key or "FileEntry()"
def __repr__(self):
return f"{self.name} ({self.size}, {self.mtime})"
class Update(msgspec.Struct, array_like=True): ...
class UpdKeep(Update, tag="k"):
count: int
class UpdDel(Update, tag="d"):
count: int
class UpdIns(Update, tag="i"):
items: list[FileEntry]
class UpdateMessage(msgspec.Struct):
update: list[UpdKeep | UpdDel | UpdIns]
class Space(msgspec.Struct):
disk: int
free: int
used: int
storage: int
allocated: int