mirror of
https://git.srhtnin.garden/sarah/SaraView.git
synced 2026-10-14 18:38:11 +02:00
Add graph view
This commit is contained in:
1 parent
f851ecd820
commit
57a07874ee
12 files changed
+1152
-2
No files matched your search
@@ -60,6 +60,7 @@ from Locks import (
|
||||
RequirePathAccessible,
|
||||
SetLock,
|
||||
)
|
||||
from Graph import BuildGraph
|
||||
from Preview import GetMimeType, ReadTextFile, StreamBinaryFile, TextFileTypes
|
||||
from Settings import (
|
||||
DefaultSettings,
|
||||
@@ -406,6 +407,27 @@ def GetTreeEndpoint(
|
||||
]
|
||||
|
||||
|
||||
@Application.get("/api/graph")
|
||||
def GetGraphEndpoint(
|
||||
Root: str, Path: str = "", CurrentUser: dict = Depends(GetCurrentUserOrGuest)
|
||||
) -> dict:
|
||||
"""Directories, files and the links between them under Path (see Graph.py)."""
|
||||
RequirePathAccessible(Root, Path, CurrentUser)
|
||||
UserSettings = DefaultSettings if CurrentUser["Username"] is None else LoadSettings(CurrentUser["Username"])
|
||||
|
||||
try:
|
||||
return BuildGraph(
|
||||
Root,
|
||||
Path,
|
||||
UserSettings.get("ShowHiddenFolders", False),
|
||||
UserSettings.get("ShowSvFiles", False),
|
||||
CurrentUser["Username"],
|
||||
CurrentUser.get("Groups", []),
|
||||
)
|
||||
except ValueError as Error:
|
||||
raise HTTPException(status_code=400, detail=str(Error))
|
||||
|
||||
|
||||
@Application.post("/api/note")
|
||||
def PostNoteEndpoint(Root: str, Path: str, CurrentUser: dict = Depends(GetCurrentUser)) -> dict:
|
||||
RequirePathAccessible(Root, Path, CurrentUser)
|
||||
|
||||
Reference in new issue
Block a user