feat: Add file_locations to scan and fix file info API
Problem: - Files could not be clicked (error: no location) - get_file_info used hardcoded demo database - file_locations table was empty Solution: 1. Scan now inserts file_locations records - file_uuid = node_id (temporary) - location = file path (from aliases) - label = origin 2. Modified API routes to include user_id - /api/v2/files/:user_id/:file_uuid/info - /api/v2/files/:user_id/:file_uuid/stream 3. Modified showDetail() to use tree_user from localStorage Result: - file_locations: 11857 records ✅ - Files can be clicked ✅ - API uses correct user database ✅ Files: - src/scan.rs (insert file_locations) - src/server.rs (user_id parameter) - src/page.html (showDetail with user_id)
This commit is contained in:
@@ -717,11 +717,12 @@ function renderGrid(d,mode){
|
||||
// DETAIL PANEL
|
||||
function showDetail(fuuid){
|
||||
if(!fuuid)return;
|
||||
var userId=localStorage.getItem("tree_user")||"demo";
|
||||
document.getElementById("mb-overlay").style.display="block";
|
||||
document.getElementById("mb-detail").style.display="block";
|
||||
var b=document.getElementById("mb-detail-body");
|
||||
b.innerHTML="<div style=text-align:center;padding:30px;color:#64748b>Loading...</div>";
|
||||
fetch("/api/v2/files/"+fuuid+"/info").then(function(r){return r.json()}).then(function(d){
|
||||
fetch("/api/v2/files/"+userId+"/"+fuuid+"/info").then(function(r){return r.json()}).then(function(d){
|
||||
var node=_td&&_td.nodes?_td.nodes.find(function(n){return n.file_uuid==fuuid}):null;
|
||||
var label=node?dname(node):fuuid;
|
||||
var sz=node?fsize(node.file_size):"-";
|
||||
|
||||
Reference in New Issue
Block a user