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:
BIN
data/auth.sqlite
BIN
data/auth.sqlite
Binary file not shown.
@@ -877,12 +877,13 @@ function updatePhotoPos(fuuid){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function navigatePhoto(dir){
|
function navigatePhoto(dir){
|
||||||
|
var userId=localStorage.getItem("tree_user")||"demo";
|
||||||
var idx=_photoList.indexOf(_photoUuid);
|
var idx=_photoList.indexOf(_photoUuid);
|
||||||
if(dir=="prev"&&idx>0)idx--;else if(dir=="next"&&idx<_photoList.length-1)idx++;
|
if(dir=="prev"&&idx>0)idx--;else if(dir=="next"&&idx<_photoList.length-1)idx++;
|
||||||
if(idx>=0&&idx<_photoList.length){
|
if(idx>=0&&idx<_photoList.length){
|
||||||
_photoUuid=_photoList[idx];
|
_photoUuid=_photoList[idx];
|
||||||
var img=document.getElementById("mb-preview-img");
|
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);
|
updatePhotoPos(_photoUuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user