fix: Add user_id to stream and probe API calls

Problem:
- JPG files showed 'no preview'
- stream API calls missing user_id parameter
- probe API calls missing user_id parameter

Solution:
- Modified page.html stream calls:
  /api/v2/files/{user_id}/{file_uuid}/stream
- Modified page.html probe calls:
  /api/v2/files/{user_id}/{file_uuid}/probe
- Modified server.rs get_file_probe to accept user_id

Result:
- JPG/PNG images now show preview 
- Video files can be played 
- All file preview APIs use correct user database 

Files:
- src/page.html (3 API calls fixed)
- src/server.rs (get_file_probe)
This commit is contained in:
Warren
2026-05-17 04:53:07 +08:00
parent 89aa4989da
commit ce4f0602c8
3 changed files with 8 additions and 4 deletions

View File

@@ -1186,7 +1186,9 @@ async fn stream_file(
}
}
async fn get_file_probe(Path(file_uuid): Path<String>) -> impl IntoResponse {
async fn get_file_probe(
Path((user_id, file_uuid)): Path<(String, String)>,
) -> impl IntoResponse {
let result = tokio::task::spawn_blocking(move || -> anyhow::Result<serde_json::Value> {
let conn = FileTree::open_user_db("demo")?;
let node: Option<(Option<String>, Option<String>)> = conn