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)
Problem 1: File Tree demo/demo123 login failed
- demo user password hash was incorrect
- PostgreSQL users.password was empty or invalid
- SQLite sftpgo_users.password_hash was empty or invalid
Solution 1:
- Generated correct bcrypt hash for 'demo123'
- Updated PostgreSQL users table (60 chars)
- Updated SQLite sftpgo_users table (60 chars)
- CLI test: demo/demo123 login now returns token ✅
Problem 2: Tree modal eye icon position too high
- Password container had no height specified
- Eye icon used top:50% transform, but container height undefined
- Icon appeared misaligned
Solution 2:
- Added height:40px to password container
- Eye icon now positioned correctly at vertical center
Files:
- src/page.html (eye icon container fix)
- data/auth.sqlite (demo password hash)
Problem:
- Close button (✕) only removed 'active' class
- Modal display was set via style.display='block'
- Button didn't change display property, so modal stayed visible
Solution:
- Updated onclick to: this.parentElement.style.display='none'
- Also removes 'active' class for consistency
- Modal now properly hides when clicking ✕ button
Files:
- src/page.html (line ~850)
UX improvement:
- Password input now accepts Enter key to submit
- Added onkeypress=handleAdminKeyPress(event) to input field
- New function handleAdminKeyPress(e) checks for Enter key
- Enter key triggers submitAdminLogin()
Implementation:
- Modified showAdminLoginModal() to add onkeypress handler
- Added handleAdminKeyPress(e) function
- Supports both e.key==='Enter' and e.keyCode===13 (cross-browser)
User workflow:
1. Open Settings → Password modal appears
2. Type password: admin123
3. Press Enter → Login submits (no need to click button)
4. Or click Login button → Both methods work
Files changed: src/page.html (+8 lines)
UX: Faster login, keyboard-friendly interface
Security enhancement:
- Admin must re-enter password if Settings closed >10 seconds
- localStorage stores admin_close_time when closing Settings
- toggleSettings() checks elapsed time since last close
- If elapsed >10s: clear token, show login modal
- If elapsed <=10s: open Settings directly (no password)
Implementation:
- Added localStorage.admin_close_time tracking
- Modified toggleSettings() to check timeout
- Clear close_time when opening Settings
- Clear close_time on new login
- Clear close_time when token removed
User workflow:
1. Login → Settings open
2. Close Settings → record close_time
3. Re-open immediately (<10s) → direct access
4. Re-open after 10s → password required
Files changed: src/page.html (+15 lines in toggleSettings, +1 line in submitAdminLogin)
Security: Prevents unauthorized access if admin leaves Settings open and returns later