fix: Add user_id to photo navigation arrows

Problem:
- Left/right arrows for photo navigation showed 'No preview'
- navigatePhoto() missing user_id parameter in stream API call
- img.src used old format: /api/v2/files/{file_uuid}/stream

Solution:
- Modified navigatePhoto() to include user_id
- Changed to: /api/v2/files/{user_id}/{file_uuid}/stream
- Get user_id from localStorage (tree_user)

Result:
- Photo navigation arrows now work correctly 
- Can browse through jpg/png/gif images in detail panel 
- Position indicator (1/2371) shows correct count 

Files:
- src/page.html (navigatePhoto function)
This commit is contained in:
Warren
2026-05-17 05:34:40 +08:00
parent 37cf7d3c0e
commit b5cf80e981
2 changed files with 2 additions and 1 deletions

Binary file not shown.

View File

@@ -877,12 +877,13 @@ function updatePhotoPos(fuuid){
}
function navigatePhoto(dir){
var userId=localStorage.getItem("tree_user")||"demo";
var idx=_photoList.indexOf(_photoUuid);
if(dir=="prev"&&idx>0)idx--;else if(dir=="next"&&idx<_photoList.length-1)idx++;
if(idx>=0&&idx<_photoList.length){
_photoUuid=_photoList[idx];
var img=document.getElementById("mb-preview-img");
if(img)img.src="/api/v2/files/"+_photoUuid+"/stream?_="+Date.now();
if(img)img.src="/api/v2/files/"+userId+"/"+_photoUuid+"/stream?_="+Date.now();
updatePhotoPos(_photoUuid);
}
}