v1.8.31: add Library page to admin Pages editor
This commit is contained in:
@@ -149,7 +149,7 @@ def library_ui(): return FileResponse("/opt/rag/static/library.html")
|
||||
|
||||
@app.get("/admin/pages/{page_name}")
|
||||
def get_page_content(page_name: str, _=Depends(require_admin)):
|
||||
allowed = {"privacy", "terms", "about", "index"}
|
||||
allowed = {"privacy", "terms", "about", "index", "library"}
|
||||
if page_name not in allowed:
|
||||
raise HTTPException(404, "Page not found")
|
||||
path = f"/opt/rag/static/{page_name}.html"
|
||||
@@ -160,7 +160,7 @@ def get_page_content(page_name: str, _=Depends(require_admin)):
|
||||
|
||||
@app.post("/admin/pages/{page_name}")
|
||||
def save_page_content(page_name: str, payload: dict, _=Depends(require_admin)):
|
||||
allowed = {"privacy", "terms", "about", "index"}
|
||||
allowed = {"privacy", "terms", "about", "index", "library"}
|
||||
if page_name not in allowed:
|
||||
raise HTTPException(404, "Page not found")
|
||||
content = payload.get("content", "")
|
||||
|
||||
Binary file not shown.
@@ -535,6 +535,7 @@ a[role=button]:active {
|
||||
<button onclick="pbSwitch('terms')" id="pb-tab-terms" class="pb-tab px-4 py-2 rounded-xl text-xs font-bold glass text-on-surface-variant hover:text-primary transition-all">Terms</button>
|
||||
<button onclick="pbSwitch('about')" id="pb-tab-about" class="pb-tab px-4 py-2 rounded-xl text-xs font-bold glass text-on-surface-variant hover:text-primary transition-all">About</button>
|
||||
<button onclick="pbSwitch('index')" id="pb-tab-index" class="pb-tab px-4 py-2 rounded-xl text-xs font-bold glass text-on-surface-variant hover:text-primary transition-all">Home</button>
|
||||
<button onclick="pbSwitch('library')" id="pb-tab-library" class="pb-tab px-4 py-2 rounded-xl text-xs font-bold glass text-on-surface-variant hover:text-primary transition-all">Library</button>
|
||||
</div>
|
||||
|
||||
<!-- Mode toggle -->
|
||||
@@ -2510,6 +2511,7 @@ const PB_PAGES = {
|
||||
terms: { label: 'Terms', url: '/terms' },
|
||||
about: { label: 'About', url: '/about' },
|
||||
index: { label: 'Home', url: '/' },
|
||||
library: { label: 'Library', url: '/library' },
|
||||
};
|
||||
|
||||
// -- Switch page ---------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user