Frontend optimizations: SVG icons, remove updateFileIcons, unify rendering, scope translatePage

- Replace Font Awesome CDN with inline SVG system (icons.js + MutationObserver)
- Remove updateFileIcons() (~140 lines) - redundant with backend icon_class + MutationObserver
- Migrate favorites.js and recent.js to use shared ui.renderFolders/renderFiles (eliminate ~260 lines of duplicate rendering + per-item event listeners)
- Add view-mode aware click delegation for favorites/recent views
- Fix _createFileCard to apply icon_special_class
- Add translateElement(root) for scoped i18n translation
- Replace full-page translatePage() calls with scoped translateElement() or inline t()
- Remove redundant translatePage() calls in shared.js and auth.js
- Remove Alpine.js from Service Worker cache
This commit is contained in:
Dionisio
2026-02-16 21:51:53 +01:00
parent a4709426d9
commit 1ceae0ce94
28 changed files with 486 additions and 1707 deletions
+9 -4
View File
@@ -66,15 +66,20 @@ const fileSharing = {
},
/**
* Get shared links for a specific item
* Get shared links for a specific item (server-side filtered)
* @param {string} itemId
* @param {string} itemType - 'file' or 'folder'
* @returns {Promise<Array>} Filtered shares
* @returns {Promise<Array>} Shares for this item
*/
async getSharedLinksForItem(itemId, itemType) {
try {
const all = await this.getSharedLinks();
return all.filter(s => s.item_id === itemId && s.item_type === itemType);
const params = new URLSearchParams({ item_id: itemId, item_type: itemType });
const res = await fetch(`/api/shares?${params}`, {
headers: this._headers(false)
});
if (!res.ok) return [];
const data = await res.json();
return Array.isArray(data) ? data : (data.items || []);
} catch (error) {
console.error('Error getting shared links for item:', error);
return [];