mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Added reorderable library columns
This commit is contained in:
1 parent
d848efaf50
commit
db426e351a
8 files changed
+536
-212
No files matched your search
@@ -142,6 +142,18 @@ def collection_options() -> CollectionOptions:
|
||||
return CollectionOptions(auto=auto, recent=recent)
|
||||
|
||||
|
||||
@app.get("/api/prefs")
|
||||
def get_prefs() -> dict:
|
||||
"""The full persisted user-preferences blob (UI layout, last collection…)."""
|
||||
return prefs.load_prefs()
|
||||
|
||||
|
||||
@app.patch("/api/prefs")
|
||||
def patch_prefs(patch: dict) -> dict:
|
||||
"""Shallow-merge the given keys into the stored prefs; returns the result."""
|
||||
return prefs.update_prefs(patch)
|
||||
|
||||
|
||||
@app.get("/api/fs/list", response_model=FsListing)
|
||||
def fs_list(path: str | None = None) -> FsListing:
|
||||
"""List directories and .nml files for the in-app file browser."""
|
||||
|
||||
@@ -28,6 +28,15 @@ def save_prefs(prefs: dict) -> None:
|
||||
pass # non-fatal — prefs are a convenience, not a requirement
|
||||
|
||||
|
||||
def update_prefs(patch: dict) -> dict:
|
||||
"""Shallow-merge `patch` into the stored prefs and persist. Returns the
|
||||
full updated prefs dict."""
|
||||
prefs = load_prefs()
|
||||
prefs.update(patch)
|
||||
save_prefs(prefs)
|
||||
return prefs
|
||||
|
||||
|
||||
def get_last_collection() -> str | None:
|
||||
val = load_prefs().get("last_collection")
|
||||
return val if isinstance(val, str) else None
|
||||
|
||||
Reference in new issue
Block a user