Merge remote-tracking branch 'origin/main' into feat/share-folder-browsing
# Conflicts: # static/js/views/public/publicShare.js
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
:root {
|
||||
--sidebar-width: 250px;
|
||||
|
||||
/* Backgrounds */
|
||||
--color-bg-page: #f5f7fa;
|
||||
--color-bg-surface: #ffffff;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
.path-tooltip {
|
||||
position: fixed;
|
||||
bottom: 8px;
|
||||
left: calc(var(--sidebar-width) + 8px);
|
||||
z-index: 5;
|
||||
|
||||
max-width: 120ch;
|
||||
padding: 4px 10px;
|
||||
border-radius: 3px;
|
||||
|
||||
background-color: var(--color-bg-subtle);
|
||||
border: 1px solid var(--color-border-faint);
|
||||
color: var(--color-text-muted);
|
||||
font-size: 0.75rem;
|
||||
font-family: monospace;
|
||||
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
pointer-events: none;
|
||||
|
||||
/* avoid blinking when pointer change items */
|
||||
transition: display 0.2s allow-discrete;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Sidebar */
|
||||
.sidebar {
|
||||
width: 250px;
|
||||
width: var(--sidebar-width);
|
||||
background: linear-gradient(180deg, var(--color-sidebar-bg-from) 0%, var(--color-sidebar-bg-to) 100%);
|
||||
color: var(--color-sidebar-text-active);
|
||||
display: flex;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<link rel="stylesheet" href="/css/views/photos.css">
|
||||
<link rel="stylesheet" href="/css/views/photosLightbox.css">
|
||||
<link rel="stylesheet" href="/css/views/music.css">
|
||||
<link rel="stylesheet" href="/css/components/pathTooltip.css">
|
||||
|
||||
<!-- Scripts (defer: download in parallel, execute in order, after HTML parsed) -->
|
||||
<script defer type="module" src="/js/core/i18n.js"></script>
|
||||
|
||||
@@ -182,8 +182,8 @@ async function loadFiles(options = { insertHistory: true }) {
|
||||
// not required anymore
|
||||
clearTimeout(loadingFiles);
|
||||
|
||||
if (response.status === 401 || response.status === 403) {
|
||||
console.warn('Auth error when loading files, showing empty list');
|
||||
if (response.status === 403) {
|
||||
console.warn('Forbidden when loading files');
|
||||
// FIXME: i18n
|
||||
ui.showError(`<p>Could not load files</p>`);
|
||||
return;
|
||||
|
||||
@@ -3,8 +3,13 @@
|
||||
* This file contains the core functionality, initialization and state management
|
||||
*/
|
||||
|
||||
import { installFetchInterceptor } from '../core/fetchWrapper.js';
|
||||
|
||||
installFetchInterceptor();
|
||||
|
||||
import { formatFileSize, formatQuotaSize } from '../core/formatters.js';
|
||||
import { i18n } from '../core/i18n.js';
|
||||
import { oxiIconsInit } from '../core/icons.js';
|
||||
import { Modal } from '../core/modal.js';
|
||||
import { fileOps } from '../features/files/fileOperations.js';
|
||||
import { multiSelect } from '../features/files/multiSelect.js';
|
||||
@@ -334,6 +339,8 @@ function switchSectionTo(section) {
|
||||
* Initialize the application
|
||||
*/
|
||||
function initApp() {
|
||||
oxiIconsInit();
|
||||
|
||||
// Cache DOM elements
|
||||
cacheElements();
|
||||
|
||||
|
||||
+20
-1
@@ -20,7 +20,7 @@ import { thumbnail } from '../features/thumbnail.js';
|
||||
import { sharedView } from '../views/shared/sharedView.js';
|
||||
import { loadFiles } from './filesView.js';
|
||||
import { updateHistory } from './main.js';
|
||||
import { syncViewContainers } from './navigation.js';
|
||||
import { switchToFilesSection, syncViewContainers } from './navigation.js';
|
||||
import { app } from './state.js';
|
||||
import { uiFileTypes } from './uiFileTypes.js';
|
||||
import { uiNotifications } from './uiNotifications.js';
|
||||
@@ -62,6 +62,7 @@ const ui = {
|
||||
</div>
|
||||
`;
|
||||
document.body.appendChild(folderMenu);
|
||||
i18n.translateElement(folderMenu);
|
||||
}
|
||||
|
||||
// File context menu
|
||||
@@ -82,6 +83,9 @@ const ui = {
|
||||
<div class="context-menu-item" id="download-file-option">
|
||||
<i class="fas fa-download"></i> <span data-i18n="actions.download">Download</span>
|
||||
</div>
|
||||
<div class="context-menu-item hidden" id="open-parent-folder-option">
|
||||
<i class="fas fa-folder-open"></i> <span data-i18n="actions.open_parent_folder">Go to parent folder</span>
|
||||
</div>
|
||||
<div class="context-menu-separator"></div>
|
||||
<div class="context-menu-item" id="favorite-file-option">
|
||||
<i class="fas fa-star"></i> <span data-i18n="actions.favorite">Add to favorites</span>
|
||||
@@ -105,6 +109,7 @@ const ui = {
|
||||
</div>
|
||||
`;
|
||||
document.body.appendChild(fileMenu);
|
||||
i18n.translateElement(fileMenu);
|
||||
}
|
||||
|
||||
// Rename dialog — modern
|
||||
@@ -912,6 +917,12 @@ const ui = {
|
||||
const navigateFolder = (card) => {
|
||||
const folderId = card.dataset.folderId;
|
||||
const folderName = card.dataset.folderName;
|
||||
if (app.currentSection === 'favorites' || app.currentSection === 'recent') {
|
||||
switchToFilesSection();
|
||||
app.currentPath = folderId;
|
||||
loadFiles();
|
||||
return;
|
||||
}
|
||||
app.breadcrumbPath.push({ id: folderId, name: folderName });
|
||||
app.currentPath = folderId;
|
||||
this.updateBreadcrumb();
|
||||
@@ -1012,6 +1023,9 @@ const ui = {
|
||||
if (contextMenus && typeof contextMenus.syncAddToPlaylistOption === 'function') {
|
||||
contextMenus.syncAddToPlaylistOption();
|
||||
}
|
||||
if (contextMenus && typeof contextMenus.syncOpenParentFolderOption === 'function') {
|
||||
contextMenus.syncOpenParentFolderOption();
|
||||
}
|
||||
if (menu) {
|
||||
menu.style.left = `${e.pageX}px`;
|
||||
menu.style.top = `${e.pageY}px`;
|
||||
@@ -1295,6 +1309,7 @@ const ui = {
|
||||
el.dataset.folderId = folder.id;
|
||||
el.dataset.folderName = folder.name;
|
||||
el.dataset.parentId = folder.parent_id || '';
|
||||
if (folder.path) el.dataset.path = folder.path;
|
||||
|
||||
const isFav = favorites?.isFavorite(folder.id, 'folder');
|
||||
const isShared = sharedView.isShared(folder.id, 'folder');
|
||||
@@ -1345,6 +1360,7 @@ const ui = {
|
||||
el.dataset.fileId = file.id;
|
||||
el.dataset.fileName = file.name;
|
||||
el.dataset.folderId = file.folder_id || '';
|
||||
if (file.path) el.dataset.path = file.path;
|
||||
el.setAttribute('draggable', 'true');
|
||||
|
||||
el.innerHTML = `
|
||||
@@ -1557,6 +1573,9 @@ function showContextMenuAtElement(triggerElement, menuId) {
|
||||
if (contextMenus && typeof contextMenus.syncAddToPlaylistOption === 'function') {
|
||||
contextMenus.syncAddToPlaylistOption();
|
||||
}
|
||||
if (contextMenus && typeof contextMenus.syncOpenParentFolderOption === 'function') {
|
||||
contextMenus.syncOpenParentFolderOption();
|
||||
}
|
||||
|
||||
menu.style.left = `${left}px`;
|
||||
menu.style.top = `${top}px`;
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* Global fetch interceptor for transparent 401 → token-refresh → retry.
|
||||
*
|
||||
* WHY a global interceptor instead of a per-call wrapper:
|
||||
* Every authenticated API call in the app needs the same 401 handling.
|
||||
* Replacing each `fetch(...)` call individually is error-prone (easy to
|
||||
* miss one) and creates noise across every module. Patching `window.fetch`
|
||||
* once here means all existing and future calls are covered automatically.
|
||||
*
|
||||
* WHY _originalFetch must be used everywhere inside this module:
|
||||
* `_refresh()` itself calls `/api/auth/refresh`. If it used `window.fetch`
|
||||
* (the patched version), a 401 on the refresh endpoint would call `_refresh()`
|
||||
* again, which would call `window.fetch` again — infinite recursion. The same
|
||||
* applies to the interceptor's own initial call and the retry: they must all
|
||||
* bypass the interceptor by using the captured `_originalFetch` directly.
|
||||
*
|
||||
* WHY /api/auth/ endpoints are excluded from the retry logic:
|
||||
* login, logout, refresh, and /me are the auth primitives themselves.
|
||||
* A 401 on these means credentials are genuinely invalid — retrying after
|
||||
* a refresh makes no sense and would loop.
|
||||
*
|
||||
* WHY cross-origin requests bypass the interceptor entirely:
|
||||
* A 401 from an external service (e.g. a third-party library calling its own
|
||||
* API) has nothing to do with OxiCloud's session. Attempting a token refresh
|
||||
* and redirecting to /login in response would be catastrophic. Only same-origin
|
||||
* requests go through the refresh-and-retry path.
|
||||
*
|
||||
* Call `installFetchInterceptor()` once at app startup (before any fetch).
|
||||
*/
|
||||
|
||||
import { getCsrfHeaders } from './csrf.js';
|
||||
|
||||
const REFRESH_ENDPOINT = '/api/auth/refresh';
|
||||
const USER_DATA_KEY = 'oxicloud_user';
|
||||
|
||||
/** Captured before patching — the only safe fetch inside this module. */
|
||||
let _originalFetch = window.fetch.bind(window);
|
||||
|
||||
/** Deduplicates concurrent refresh attempts into a single in-flight promise. */
|
||||
let _refreshInFlight = null;
|
||||
|
||||
async function _refresh() {
|
||||
if (_refreshInFlight) return _refreshInFlight;
|
||||
|
||||
console.log(`requesting a refresh token`);
|
||||
|
||||
// Must use _originalFetch to avoid re-entering the interceptor.
|
||||
_refreshInFlight = (async () => {
|
||||
try {
|
||||
const r = await _originalFetch(REFRESH_ENDPOINT, {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
headers: { 'Content-Type': 'application/json', ...getCsrfHeaders() },
|
||||
body: '{}'
|
||||
});
|
||||
return r.ok;
|
||||
} catch {
|
||||
return false;
|
||||
} finally {
|
||||
_refreshInFlight = null;
|
||||
}
|
||||
})();
|
||||
|
||||
return _refreshInFlight;
|
||||
}
|
||||
|
||||
function installFetchInterceptor() {
|
||||
// Capture the real fetch before overwriting it.
|
||||
_originalFetch = window.fetch.bind(window);
|
||||
|
||||
window.fetch = async (url, options) => {
|
||||
// Use _originalFetch for the actual network call — NOT window.fetch —
|
||||
// so this interceptor does not call itself recursively.
|
||||
const response = await _originalFetch(url, options);
|
||||
|
||||
if (response.status !== 401) return response;
|
||||
|
||||
const urlStr = typeof url === 'string' ? url : url instanceof URL ? url.href : (url.url ?? '');
|
||||
|
||||
// Cross-origin: a 401 from an external service is none of our business.
|
||||
// Pass it through untouched so the caller can handle it themselves.
|
||||
try {
|
||||
if (new URL(urlStr, window.location.origin).origin !== window.location.origin) {
|
||||
return response;
|
||||
}
|
||||
} catch {
|
||||
return response;
|
||||
}
|
||||
|
||||
// Auth endpoints must bypass retry: a 401 on /api/auth/* means the
|
||||
// credentials themselves are invalid; retrying would cause a loop.
|
||||
// Public share endpoints (/api/s/) use 401 to mean "password required",
|
||||
// not "session expired" — intercepting them would wrongly redirect to login.
|
||||
if (urlStr.includes('/api/auth/') || urlStr.includes('/api/s/')) return response;
|
||||
|
||||
const refreshed = await _refresh();
|
||||
if (!refreshed) {
|
||||
localStorage.removeItem(USER_DATA_KEY);
|
||||
window.location.href = '/login?source=session_expired';
|
||||
throw new Error('Session expired');
|
||||
}
|
||||
|
||||
// Retry with _originalFetch for the same reason as above.
|
||||
return _originalFetch(url, options);
|
||||
};
|
||||
}
|
||||
|
||||
export { installFetchInterceptor };
|
||||
+14
-14
@@ -15,7 +15,7 @@
|
||||
// All icons use viewBox="0 0 {width} 512" and fill="currentColor".
|
||||
// Keys use FA5 class names (without "fa-" prefix) for backward compatibility.
|
||||
|
||||
const _ICONS = {
|
||||
const OxiIcons = {
|
||||
'arrow-left': [
|
||||
448,
|
||||
'M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.2 288 416 288c17.7 0 32-14.3 32-32s-14.3-32-32-32l-306.7 0L214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z'
|
||||
@@ -430,7 +430,7 @@ const _ICONS = {
|
||||
* @returns {string} SVG markup string, or empty string if icon not found
|
||||
*/
|
||||
function oxiIcon(name, extraClass) {
|
||||
const entry = _ICONS[name];
|
||||
const entry = OxiIcons[name];
|
||||
if (!entry) return '';
|
||||
const [w, d] = entry;
|
||||
const cls = extraClass ? `oxi-icon ${extraClass}` : 'oxi-icon';
|
||||
@@ -477,13 +477,13 @@ function replaceIconsInElement(container) {
|
||||
}
|
||||
|
||||
// Use outline variant if available and element uses "far"
|
||||
if (isRegular && _ICONS[`${iconName}-outline`]) {
|
||||
if (isRegular && OxiIcons[`${iconName}-outline`]) {
|
||||
iconName = `${iconName}-outline`;
|
||||
}
|
||||
|
||||
if (!iconName || !_ICONS[iconName]) continue;
|
||||
if (!iconName || !OxiIcons[iconName]) continue;
|
||||
|
||||
const [w, d] = _ICONS[iconName];
|
||||
const [w, d] = OxiIcons[iconName];
|
||||
|
||||
// Build SVG element
|
||||
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
||||
@@ -510,14 +510,7 @@ function replaceIconsInElement(container) {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Expose globally ────────────────────────────────────────────
|
||||
export { oxiIcon, replaceIconsInElement };
|
||||
export const OxiIcons = _ICONS;
|
||||
|
||||
// ── Auto-replace: MutationObserver bridge ──────────────────────
|
||||
// Watches the DOM for new <i class="fa-..."> elements and converts them
|
||||
// to inline SVGs automatically. Debounced to at most once per frame.
|
||||
(function autoReplace() {
|
||||
function oxiIconsInit() {
|
||||
let raf = 0;
|
||||
const scan = () => {
|
||||
raf = 0;
|
||||
@@ -541,4 +534,11 @@ export const OxiIcons = _ICONS;
|
||||
}
|
||||
}
|
||||
}).observe(document.documentElement, { childList: true, subtree: true });
|
||||
})();
|
||||
}
|
||||
|
||||
// ── Expose globally ────────────────────────────────────────────
|
||||
export { OxiIcons, oxiIcon, oxiIconsInit, replaceIconsInElement };
|
||||
|
||||
// ── Auto-replace: MutationObserver bridge ──────────────────────
|
||||
// Watches the DOM for new <i class="fa-..."> elements and converts them
|
||||
// to inline SVGs automatically. Debounced to at most once per frame.
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import { resolveHomeFolder } from '../../app/authSession.js';
|
||||
import { loadFiles } from '../../app/filesView.js';
|
||||
import { switchToFilesSection } from '../../app/navigation.js';
|
||||
import { app } from '../../app/state.js';
|
||||
import { showConfirmDialog, ui } from '../../app/ui.js';
|
||||
import { getCsrfHeaders } from '../../core/csrf.js';
|
||||
@@ -64,6 +65,13 @@ const contextMenus = {
|
||||
}
|
||||
},
|
||||
|
||||
syncOpenParentFolderOption() {
|
||||
const option = document.getElementById('open-parent-folder-option');
|
||||
if (!option) return;
|
||||
const folderId = app?.contextMenuTargetFile?.folder_id;
|
||||
option.classList.toggle('hidden', !folderId);
|
||||
},
|
||||
|
||||
syncAddToPlaylistOption() {
|
||||
const option = document.getElementById('add-to-playlist-option');
|
||||
if (!option) return;
|
||||
@@ -198,6 +206,16 @@ const contextMenus = {
|
||||
ui.closeFileContextMenu();
|
||||
});
|
||||
|
||||
document.getElementById('open-parent-folder-option').addEventListener('click', () => {
|
||||
const folderId = app.contextMenuTargetFile?.folder_id;
|
||||
ui.closeFileContextMenu();
|
||||
if (folderId) {
|
||||
switchToFilesSection();
|
||||
app.currentPath = folderId;
|
||||
loadFiles();
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('favorite-file-option').addEventListener('click', async () => {
|
||||
if (app.contextMenuTargetFile) {
|
||||
const file = app.contextMenuTargetFile;
|
||||
|
||||
@@ -10,6 +10,7 @@ import { ui } from '../../app/ui.js';
|
||||
import { getCsrfHeaders } from '../../core/csrf.js';
|
||||
import { i18n } from '../../core/i18n.js';
|
||||
import { multiSelect } from '../files/multiSelect.js';
|
||||
import * as pathTooltip from '../pathTooltip.js';
|
||||
|
||||
const favorites = {
|
||||
/** @type {Map<string, object>} key = "file:<id>" | "folder:<id>" */
|
||||
@@ -64,7 +65,6 @@ const favorites = {
|
||||
|
||||
if (!response.ok) {
|
||||
console.warn(`Favorites API returned ${response.status}`);
|
||||
this._ready = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,6 @@ const favorites = {
|
||||
console.log(`Favorites cache loaded: ${this._cache.size} items`);
|
||||
} catch (err) {
|
||||
console.error('Error fetching favorites:', err);
|
||||
this._ready = true;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -161,10 +160,7 @@ const favorites = {
|
||||
*/
|
||||
async displayFavorites() {
|
||||
try {
|
||||
// Ensure cache is fresh
|
||||
if (!this._ready) {
|
||||
await this._fetchFromServer();
|
||||
}
|
||||
await this._fetchFromServer();
|
||||
|
||||
ui.resetFilesList(); // ensure also list visible & error hidden
|
||||
// wire buttons & select-all-checkbox as list header has changed in ui.resetFilesList()
|
||||
@@ -190,7 +186,8 @@ const favorites = {
|
||||
id: item.item_id,
|
||||
name: item.item_name || item.item_id,
|
||||
parent_id: item.parent_id || '',
|
||||
modified_at: item.modified_at || item.created_at
|
||||
modified_at: item.modified_at || item.created_at,
|
||||
path: item.item_path || ''
|
||||
});
|
||||
} else {
|
||||
files.push({
|
||||
@@ -203,12 +200,16 @@ const favorites = {
|
||||
category: item.category,
|
||||
size: item.item_size || 0,
|
||||
size_formatted: item.size_formatted,
|
||||
modified_at: item.modified_at || item.created_at
|
||||
modified_at: item.modified_at || item.created_at,
|
||||
path: item.item_path || ''
|
||||
});
|
||||
}
|
||||
}
|
||||
if (folders.length) ui.renderFolders(folders);
|
||||
if (files.length) ui.renderFiles(files);
|
||||
|
||||
const filesList = document.getElementById('files-list');
|
||||
if (filesList) pathTooltip.init(filesList);
|
||||
} catch (error) {
|
||||
console.error('Error displaying favorites:', error);
|
||||
if (ui?.showNotification) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import { ui } from '../../app/ui.js';
|
||||
import { getCsrfHeaders } from '../../core/csrf.js';
|
||||
import { i18n } from '../../core/i18n.js';
|
||||
import { multiSelect } from '../files/multiSelect.js';
|
||||
import * as pathTooltip from '../pathTooltip.js';
|
||||
|
||||
const recent = {
|
||||
/** Maximum items to request from the server */
|
||||
@@ -128,7 +129,8 @@ const recent = {
|
||||
id: item.item_id,
|
||||
name: item.item_name || item.item_id,
|
||||
parent_id: item.parent_id || '',
|
||||
modified_at: item.accessed_at
|
||||
modified_at: item.accessed_at,
|
||||
path: item.item_path || ''
|
||||
});
|
||||
} else {
|
||||
files.push({
|
||||
@@ -141,12 +143,14 @@ const recent = {
|
||||
category: item.category,
|
||||
size: item.item_size || 0,
|
||||
size_formatted: item.size_formatted,
|
||||
modified_at: item.accessed_at
|
||||
modified_at: item.accessed_at,
|
||||
path: item.item_path || ''
|
||||
});
|
||||
}
|
||||
}
|
||||
if (folders.length) ui.renderFolders(folders);
|
||||
if (files.length) ui.renderFiles(files);
|
||||
if (filesList) pathTooltip.init(filesList);
|
||||
} catch (error) {
|
||||
console.error('Error displaying recent files:', error);
|
||||
if (ui?.showNotification) {
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Path tooltip — shows the full path of a hovered file/folder item
|
||||
* in an overlay at the bottom-left of the content area.
|
||||
*
|
||||
* Usage: call init(container) after rendering items, destroy(container) on teardown.
|
||||
* Only file-item elements with a data-path attribute trigger the tooltip.
|
||||
*/
|
||||
|
||||
/** @type {HTMLElement|null} */
|
||||
let _tooltip = null;
|
||||
|
||||
function _getOrCreateTooltip() {
|
||||
if (_tooltip) return _tooltip;
|
||||
_tooltip = document.getElementById('path-tooltip');
|
||||
if (!_tooltip) {
|
||||
_tooltip = document.createElement('div');
|
||||
_tooltip.id = 'path-tooltip';
|
||||
_tooltip.className = 'path-tooltip hidden';
|
||||
document.querySelector('.main-content')?.appendChild(_tooltip);
|
||||
}
|
||||
return _tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MouseEvent} e
|
||||
*/
|
||||
function _onEnter(e) {
|
||||
const item = /** @type {HTMLElement} */ (e.currentTarget);
|
||||
const path = item.dataset.path;
|
||||
if (!path) return;
|
||||
|
||||
const tooltip = _getOrCreateTooltip();
|
||||
tooltip.textContent = path;
|
||||
tooltip.classList.remove('hidden');
|
||||
}
|
||||
|
||||
function _onLeave() {
|
||||
_tooltip?.classList.add('hidden');
|
||||
}
|
||||
|
||||
/** @type {WeakMap<HTMLElement, {enter: Function, leave: Function}>} */
|
||||
const _listeners = new WeakMap();
|
||||
|
||||
/**
|
||||
* Attach path tooltip listeners to all file-item elements inside container.
|
||||
* @param {HTMLElement} container
|
||||
*/
|
||||
function init(container) {
|
||||
const items = container.querySelectorAll('.file-item[data-path]');
|
||||
items.forEach((item) => {
|
||||
const el = /** @type {HTMLElement} */ (item);
|
||||
const enter = (e) => _onEnter(e);
|
||||
const leave = () => _onLeave();
|
||||
el.addEventListener('mouseenter', enter);
|
||||
el.addEventListener('mouseleave', leave);
|
||||
_listeners.set(el, { enter, leave });
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove path tooltip listeners from all file-item elements inside container.
|
||||
* @param {HTMLElement} container
|
||||
*/
|
||||
function destroy(container) {
|
||||
const items = container.querySelectorAll('.file-item');
|
||||
items.forEach((item) => {
|
||||
const el = /** @type {HTMLElement} */ (item);
|
||||
const fns = _listeners.get(el);
|
||||
if (fns) {
|
||||
el.removeEventListener('mouseenter', fns.enter);
|
||||
el.removeEventListener('mouseleave', fns.leave);
|
||||
_listeners.delete(el);
|
||||
}
|
||||
});
|
||||
_onLeave();
|
||||
}
|
||||
|
||||
export { destroy, init };
|
||||
@@ -1,6 +1,7 @@
|
||||
import { getCsrfHeaders } from '../../core/csrf.js';
|
||||
import { escapeHtml } from '../../core/formatters.js';
|
||||
import { i18n } from '../../core/i18n.js';
|
||||
import { oxiIconsInit } from '../../core/icons.js';
|
||||
|
||||
const API = '/api';
|
||||
let currentAdminId = '';
|
||||
@@ -1041,6 +1042,7 @@ async function completeMigration() {
|
||||
|
||||
async function init() {
|
||||
try {
|
||||
oxiIconsInit();
|
||||
const me = await fetch(`${API}/auth/me`, {
|
||||
headers: headers(),
|
||||
credentials: 'same-origin'
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// device-verify.js — Extracted from inline <script> in device-verify.html
|
||||
import { getCsrfHeaders } from '../../core/csrf.js';
|
||||
import { oxiIconsInit } from '../../core/icons.js';
|
||||
|
||||
(() => {
|
||||
var API_BASE = window.location.origin;
|
||||
@@ -12,6 +13,8 @@ import { getCsrfHeaders } from '../../core/csrf.js';
|
||||
var debounceTimer = null;
|
||||
var currentCode = '';
|
||||
|
||||
oxiIconsInit();
|
||||
|
||||
// Pre-fill from URL query param (?code=ABCD-1234)
|
||||
var params = new URLSearchParams(window.location.search);
|
||||
if (params.get('code')) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { getCsrfHeaders } from '../../core/csrf.js';
|
||||
import { i18n } from '../../core/i18n.js';
|
||||
import { oxiIconsInit } from '../../core/icons.js';
|
||||
|
||||
const API = '/api';
|
||||
|
||||
@@ -29,6 +30,7 @@ function timeAgo(dateStr) {
|
||||
|
||||
async function init() {
|
||||
try {
|
||||
oxiIconsInit();
|
||||
const resp = await fetch(`${API}/auth/me`, {
|
||||
headers: headers(),
|
||||
credentials: 'same-origin'
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { oxiIconsInit } from '../../core/icons';
|
||||
|
||||
/**
|
||||
* publicShare.js — client-side logic for /s/{token}.
|
||||
* Drives the password / file / folder / expired states and renders the
|
||||
@@ -27,6 +29,9 @@ import { uiFileTypes } from '../../app/uiFileTypes.js';
|
||||
const pathParts = window.location.pathname.split('/');
|
||||
const tokenIdx = pathParts.indexOf('s');
|
||||
const TOKEN = tokenIdx !== -1 ? pathParts[tokenIdx + 1] : null;
|
||||
|
||||
oxiIconsInit();
|
||||
|
||||
if (!TOKEN) {
|
||||
showState('expired');
|
||||
if ($expiredMsg) $expiredMsg.textContent = 'Invalid share link.';
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"search_btn": "بحث",
|
||||
"close": "إغلاق",
|
||||
"delete_permanently": "حذف نهائياً",
|
||||
"empty_trash": "تفريغ سلة المهملات"
|
||||
"empty_trash": "تفريغ سلة المهملات",
|
||||
"open_parent_folder": "الانتقال إلى المجلد الأصلي"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "المظهر",
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"search_btn": "Suchen",
|
||||
"close": "Schließen",
|
||||
"delete_permanently": "Endgültig löschen",
|
||||
"empty_trash": "Papierkorb leeren"
|
||||
"empty_trash": "Papierkorb leeren",
|
||||
"open_parent_folder": "Zum übergeordneten Ordner"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "Erscheinungsbild",
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"search_btn": "Search",
|
||||
"close": "Close",
|
||||
"delete_permanently": "Delete permanently",
|
||||
"empty_trash": "Empty trash"
|
||||
"empty_trash": "Empty trash",
|
||||
"open_parent_folder": "Go to parent folder"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "Appearance",
|
||||
|
||||
@@ -235,7 +235,8 @@
|
||||
"search_btn": "Buscar",
|
||||
"close": "Cerrar",
|
||||
"delete_permanently": "Eliminar permanentemente",
|
||||
"empty_trash": "Vaciar papelera"
|
||||
"empty_trash": "Vaciar papelera",
|
||||
"open_parent_folder": "Ir a la carpeta padre"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "Apariencia",
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"search_btn": "جستوجو",
|
||||
"close": "بستن",
|
||||
"delete_permanently": "Delete permanently",
|
||||
"empty_trash": "Empty trash"
|
||||
"empty_trash": "Empty trash",
|
||||
"open_parent_folder": "رفتن به پوشه والد"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "ظاهر",
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"search_btn": "Rechercher",
|
||||
"close": "Fermer",
|
||||
"delete_permanently": "Supprimer définitivement",
|
||||
"empty_trash": "Vider la corbeille"
|
||||
"empty_trash": "Vider la corbeille",
|
||||
"open_parent_folder": "Aller au dossier parent"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "Apparence",
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"search_btn": "खोजें",
|
||||
"close": "बंद करें",
|
||||
"delete_permanently": "स्थायी रूप से हटाएँ",
|
||||
"empty_trash": "रद्दी खाली करें"
|
||||
"empty_trash": "रद्दी खाली करें",
|
||||
"open_parent_folder": "मूल फ़ोल्डर पर जाएं"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "दिखावट",
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"search_btn": "Cerca",
|
||||
"close": "Chiudi",
|
||||
"delete_permanently": "Elimina definitivamente",
|
||||
"empty_trash": "Svuota il cestino"
|
||||
"empty_trash": "Svuota il cestino",
|
||||
"open_parent_folder": "Vai alla cartella padre"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "Aspetto",
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"search_btn": "検索",
|
||||
"close": "閉じる",
|
||||
"delete_permanently": "完全に削除",
|
||||
"empty_trash": "ゴミ箱を空にする"
|
||||
"empty_trash": "ゴミ箱を空にする",
|
||||
"open_parent_folder": "親フォルダへ移動"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "外観",
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"search_btn": "검색",
|
||||
"close": "닫기",
|
||||
"delete_permanently": "영구 삭제",
|
||||
"empty_trash": "휴지통 비우기"
|
||||
"empty_trash": "휴지통 비우기",
|
||||
"open_parent_folder": "상위 폴더로 이동"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "외관",
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"search_btn": "Zoeken",
|
||||
"close": "Sluiten",
|
||||
"delete_permanently": "Permanent verwijderen",
|
||||
"empty_trash": "Prullenbak legen"
|
||||
"empty_trash": "Prullenbak legen",
|
||||
"open_parent_folder": "Naar bovenliggende map"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "Weergave",
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"search_btn": "Szukaj",
|
||||
"close": "Zamknij",
|
||||
"delete_permanently": "Usuń trwale",
|
||||
"empty_trash": "Opróżnij kosz"
|
||||
"empty_trash": "Opróżnij kosz",
|
||||
"open_parent_folder": "Przejdź do folderu nadrzędnego"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "Wygląd",
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"search_btn": "Pesquisar",
|
||||
"close": "Fechar",
|
||||
"delete_permanently": "Excluir permanentemente",
|
||||
"empty_trash": "Esvaziar lixeira"
|
||||
"empty_trash": "Esvaziar lixeira",
|
||||
"open_parent_folder": "Ir para a pasta pai"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "Aparência",
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"search_btn": "Найти",
|
||||
"close": "Закрыть",
|
||||
"delete_permanently": "Удалить навсегда",
|
||||
"empty_trash": "Очистить корзину"
|
||||
"empty_trash": "Очистить корзину",
|
||||
"open_parent_folder": "Перейти в родительскую папку"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "Оформление",
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"search_btn": "搜索",
|
||||
"close": "关闭",
|
||||
"delete_permanently": "Delete permanently",
|
||||
"empty_trash": "Empty trash"
|
||||
"empty_trash": "Empty trash",
|
||||
"open_parent_folder": "转到父文件夹"
|
||||
},
|
||||
"user_menu": {
|
||||
"appearance": "外观",
|
||||
|
||||
Reference in New Issue
Block a user