|
@@ -1,6 +1,7 @@
|
|
from fastapi import APIRouter, UploadFile, File, BackgroundTasks
|
|
from fastapi import APIRouter, UploadFile, File, BackgroundTasks
|
|
from fastapi import Depends, HTTPException, status
|
|
from fastapi import Depends, HTTPException, status
|
|
-from starlette.responses import StreamingResponse
|
|
|
|
|
|
+from starlette.responses import StreamingResponse, FileResponse
|
|
|
|
+
|
|
|
|
|
|
from pydantic import BaseModel
|
|
from pydantic import BaseModel
|
|
|
|
|
|
@@ -9,6 +10,8 @@ import os
|
|
import aiohttp
|
|
import aiohttp
|
|
import json
|
|
import json
|
|
|
|
|
|
|
|
+
|
|
|
|
+from utils.utils import get_admin_user
|
|
from utils.misc import calculate_sha256, get_gravatar_url
|
|
from utils.misc import calculate_sha256, get_gravatar_url
|
|
|
|
|
|
from config import OLLAMA_API_BASE_URL, DATA_DIR, UPLOAD_DIR
|
|
from config import OLLAMA_API_BASE_URL, DATA_DIR, UPLOAD_DIR
|
|
@@ -172,3 +175,13 @@ async def get_gravatar(
|
|
email: str,
|
|
email: str,
|
|
):
|
|
):
|
|
return get_gravatar_url(email)
|
|
return get_gravatar_url(email)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@router.get("/db/download")
|
|
|
|
+async def download_db(user=Depends(get_admin_user)):
|
|
|
|
+
|
|
|
|
+ return FileResponse(
|
|
|
|
+ f"{DATA_DIR}/webui.db",
|
|
|
|
+ media_type="application/octet-stream",
|
|
|
|
+ filename="webui.db",
|
|
|
|
+ )
|