feat: fix content sharing — nginx proxy, file path resolution, catalog filtering
- Add /content and /dwn proxy locations to nginx config (both HTTP and HTTPS) so peer requests reach the backend instead of the SPA catch-all - Update content_file_path() to check FileBrowser data dir as fallback when files aren't in the dedicated content/files/ directory - Populate size_bytes from actual file metadata in content.add - Filter out availability:nobody items from the public catalog endpoint Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
8c3c2104b2
commit
fc8e3f2d39
@@ -89,8 +89,26 @@ pub async fn save_catalog(data_dir: &Path, catalog: &ContentCatalog) -> Result<(
|
||||
}
|
||||
|
||||
/// Get the full filesystem path for a content item.
|
||||
/// Checks the dedicated content/files/ directory first, then falls back to the
|
||||
/// FileBrowser data directory (where users manage files via the web UI).
|
||||
pub fn content_file_path(data_dir: &Path, item: &ContentItem) -> PathBuf {
|
||||
data_dir.join(CONTENT_DIR).join(&item.filename)
|
||||
// Strip leading slash from filename for path joining
|
||||
let clean_name = item.filename.trim_start_matches('/');
|
||||
|
||||
// Primary: dedicated content directory
|
||||
let primary = data_dir.join(CONTENT_DIR).join(clean_name);
|
||||
if primary.exists() {
|
||||
return primary;
|
||||
}
|
||||
|
||||
// Fallback: FileBrowser data directory (users share files managed via FileBrowser)
|
||||
let fb_path = data_dir.join("filebrowser").join(clean_name);
|
||||
if fb_path.exists() {
|
||||
return fb_path;
|
||||
}
|
||||
|
||||
// Return primary path even if it doesn't exist (caller checks existence)
|
||||
primary
|
||||
}
|
||||
|
||||
/// Add a content item to the catalog.
|
||||
|
||||
Reference in New Issue
Block a user