sub cache
@@ -182,7 +182,7 @@
182
182
## public/shared-video-player.js
183
183
- applyDefaultTextTrackPrefs() - Writes the default Video.js caption override settings (transparent background, uniform edge style) so all streamed players start from the same text-track baseline.
184
184
- bindTrackPrefs(player, prefs, savePrefs) - Restores subtitle/audio track selections by track name and persists later track changes; shared by the authenticated player and the share page so both resolve track matches the same way.
185
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Adds the shared IM button/menu/overlay for bitmap subtitle tracks, restores saved image-subtitle selections, fetches rendered frames through a caller-supplied request builder, keeps a separate rolling lookahead-prefetch worker alive across timeupdates (including gaps where no subtitle is currently visible), extends prefetch target to at least the latest buffered video end (not only fixed lookahead seconds), coalesces overlapping current-frame refreshes into a single in-flight fetch (only force-refresh paths abort/restart), applies per-request timeouts (`currentRequestTimeoutMs`, `prefetchRequestTimeoutMs`) so hung subtitle frame requests cannot stall updates indefinitely, paces prefetch polling (`prefetchRequestIntervalMs`) to reduce request bursts, logs current and prefetch subtitle request/send/receive/not-available timing to the browser console and optional batch sink, updates seek-bar bracket markers only after responses resolve (no in-flight jump-back flicker), shows a merged `[]` marker when requested and received positions match, advances markers even when responses are 204/no-frame, and disables the track after the first hard failure.
185
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Adds the shared IM button/menu/overlay for bitmap subtitle tracks, restores saved image-subtitle selections, fetches rendered frames through a caller-supplied request builder, keeps a separate rolling lookahead-prefetch worker alive across timeupdates (including gaps where no subtitle is currently visible), extends prefetch target to at least the latest buffered video end (not only fixed lookahead seconds), coalesces overlapping current-frame refreshes into a single in-flight fetch (only force-refresh paths abort/restart), applies per-request timeouts (`currentRequestTimeoutMs`, `prefetchRequestTimeoutMs`) so hung subtitle frame requests cannot stall updates indefinitely, paces prefetch polling (`prefetchRequestIntervalMs`) to reduce request bursts, logs current and prefetch subtitle request/send/receive/not-available timing to the browser console and optional batch sink, caches received subtitle PNG frames client-side for the lifetime of the player session (including prefetched frames) so rewind playback can render from local cache even after server-side purge, updates seek-bar bracket markers only after responses resolve (no in-flight jump-back flicker), keeps both marker positions forward-only (never regressing to earlier times), allows the two bracket glyphs to overlap naturally when positions match, advances markers even when responses are 204/no-frame, and disables the track after the first hard failure.
186
186
- configureVideoJsBuffering(videojs, opts) - Applies the long forward-buffer settings used for file playback when VHS exposes those knobs.
187
187
- ensureVideoPlaybackUi(player, durationSeconds) - Forces file streams into VOD UI mode, normalises the reported duration, stops live-tracker state, and hides the live badge when present.
188
188
@@ -244,6 +244,7 @@
244
244
- openGlobalFaviconPicker() - Opens a debounced, server-backed image-search modal across all accessible roots and sets/clears global favicon via `/files/global-favicon`.
245
245
- refreshGlobalFavicon() - Reads `/files/global-favicon`, updates admin-panel favicon preview button, and applies/removes the page `<link rel="icon">` URL.
246
246
- refreshAdminOrphanUserFolders() - Fetches `/admin/orphan-userfolders`, conditionally renders orphaned folder rows, and wires "Open folder" navigation for admins.
247
- openAdminModal() / refreshAdminConfig() / refreshAdminUsers() / refreshAdminOrphanUserFolders() - Admin modal refresh chain now captures stable DOM references and exits safely when the document is torn down, preventing async teardown races from throwing post-close errors in tests or quick navigation flows.
247
248
- refreshAfterIconChange(item) - Resets and reloads the folder icon in both the grid tile and sidebar after set/clear operations.
248
249
- disconnectFolderIconObserver() - Disconnects and clears the folder icon IntersectionObserver on grid rebuild.
249
250
- getThumbnailKind(name) - Classifies files into image/text/badge thumbnail strategies.
@@ -182,7 +182,7 @@182
## public/shared-video-player.js
182
## public/shared-video-player.js
183
- applyDefaultTextTrackPrefs() - Writes the default Video.js caption override settings (transparent background, uniform edge style) so all streamed players start from the same text-track baseline.
183
- applyDefaultTextTrackPrefs() - Writes the default Video.js caption override settings (transparent background, uniform edge style) so all streamed players start from the same text-track baseline.
184
- bindTrackPrefs(player, prefs, savePrefs) - Restores subtitle/audio track selections by track name and persists later track changes; shared by the authenticated player and the share page so both resolve track matches the same way.
184
- bindTrackPrefs(player, prefs, savePrefs) - Restores subtitle/audio track selections by track name and persists later track changes; shared by the authenticated player and the share page so both resolve track matches the same way.
185
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Adds the shared IM button/menu/overlay for bitmap subtitle tracks, restores saved image-subtitle selections, fetches rendered frames through a caller-supplied request builder, keeps a separate rolling lookahead-prefetch worker alive across timeupdates (including gaps where no subtitle is currently visible), extends prefetch target to at least the latest buffered video end (not only fixed lookahead seconds), coalesces overlapping current-frame refreshes into a single in-flight fetch (only force-refresh paths abort/restart), applies per-request timeouts (`currentRequestTimeoutMs`, `prefetchRequestTimeoutMs`) so hung subtitle frame requests cannot stall updates indefinitely, paces prefetch polling (`prefetchRequestIntervalMs`) to reduce request bursts, logs current and prefetch subtitle request/send/receive/not-available timing to the browser console and optional batch sink, updates seek-bar bracket markers only after responses resolve (no in-flight jump-back flicker), shows a merged `[]` marker when requested and received positions match, advances markers even when responses are 204/no-frame, and disables the track after the first hard failure.
185
- bindImageSubtitleOverlay(player, videojs, prefs, session, opts) - Adds the shared IM button/menu/overlay for bitmap subtitle tracks, restores saved image-subtitle selections, fetches rendered frames through a caller-supplied request builder, keeps a separate rolling lookahead-prefetch worker alive across timeupdates (including gaps where no subtitle is currently visible), extends prefetch target to at least the latest buffered video end (not only fixed lookahead seconds), coalesces overlapping current-frame refreshes into a single in-flight fetch (only force-refresh paths abort/restart), applies per-request timeouts (`currentRequestTimeoutMs`, `prefetchRequestTimeoutMs`) so hung subtitle frame requests cannot stall updates indefinitely, paces prefetch polling (`prefetchRequestIntervalMs`) to reduce request bursts, logs current and prefetch subtitle request/send/receive/not-available timing to the browser console and optional batch sink, caches received subtitle PNG frames client-side for the lifetime of the player session (including prefetched frames) so rewind playback can render from local cache even after server-side purge, updates seek-bar bracket markers only after responses resolve (no in-flight jump-back flicker), keeps both marker positions forward-only (never regressing to earlier times), allows the two bracket glyphs to overlap naturally when positions match, advances markers even when responses are 204/no-frame, and disables the track after the first hard failure.
186
- configureVideoJsBuffering(videojs, opts) - Applies the long forward-buffer settings used for file playback when VHS exposes those knobs.
186
- configureVideoJsBuffering(videojs, opts) - Applies the long forward-buffer settings used for file playback when VHS exposes those knobs.
187
- ensureVideoPlaybackUi(player, durationSeconds) - Forces file streams into VOD UI mode, normalises the reported duration, stops live-tracker state, and hides the live badge when present.
187
- ensureVideoPlaybackUi(player, durationSeconds) - Forces file streams into VOD UI mode, normalises the reported duration, stops live-tracker state, and hides the live badge when present.
188
188
@@ -244,6 +244,7 @@244
- openGlobalFaviconPicker() - Opens a debounced, server-backed image-search modal across all accessible roots and sets/clears global favicon via `/files/global-favicon`.
244
- openGlobalFaviconPicker() - Opens a debounced, server-backed image-search modal across all accessible roots and sets/clears global favicon via `/files/global-favicon`.
245
- refreshGlobalFavicon() - Reads `/files/global-favicon`, updates admin-panel favicon preview button, and applies/removes the page `<link rel="icon">` URL.
245
- refreshGlobalFavicon() - Reads `/files/global-favicon`, updates admin-panel favicon preview button, and applies/removes the page `<link rel="icon">` URL.
246
- refreshAdminOrphanUserFolders() - Fetches `/admin/orphan-userfolders`, conditionally renders orphaned folder rows, and wires "Open folder" navigation for admins.
246
- refreshAdminOrphanUserFolders() - Fetches `/admin/orphan-userfolders`, conditionally renders orphaned folder rows, and wires "Open folder" navigation for admins.
247
- openAdminModal() / refreshAdminConfig() / refreshAdminUsers() / refreshAdminOrphanUserFolders() - Admin modal refresh chain now captures stable DOM references and exits safely when the document is torn down, preventing async teardown races from throwing post-close errors in tests or quick navigation flows.
247
- refreshAfterIconChange(item) - Resets and reloads the folder icon in both the grid tile and sidebar after set/clear operations.
248
- refreshAfterIconChange(item) - Resets and reloads the folder icon in both the grid tile and sidebar after set/clear operations.
248
- disconnectFolderIconObserver() - Disconnects and clears the folder icon IntersectionObserver on grid rebuild.
249
- disconnectFolderIconObserver() - Disconnects and clears the folder icon IntersectionObserver on grid rebuild.
249
- getThumbnailKind(name) - Classifies files into image/text/badge thumbnail strategies.
250
- getThumbnailKind(name) - Classifies files into image/text/badge thumbnail strategies.
@@ -5585,7 +5585,10 @@ function pulseAdminUpdateButton ()
5585
5585
5586
5586
async function openAdminModal ()
5587
5587
{
5588
document.getElementById('admin-modal').classList.remove('hidden');
5588
if (typeof document === 'undefined' || typeof document.getElementById !== 'function') return;
5589
const adminModal = document.getElementById('admin-modal');
5590
if (!adminModal) return;
5591
adminModal.classList.remove('hidden');
5589
5592
await refreshGlobalFavicon();
5590
5593
await refreshAdminConfig();
5591
5594
await refreshAdminUsers();
@@ -5594,11 +5597,14 @@ async function openAdminModal ()
5594
5597
5595
5598
async function refreshAdminConfig ()
5596
5599
{
5600
if (typeof document === 'undefined' || typeof document.getElementById !== 'function') return;
5601
const doc = document;
5597
5602
const data = await api('GET', '/admin/config');
5598
5603
if (!data) return;
5604
if (!doc.defaultView || doc.defaultView.closed) return;
5599
5605
5600
const userPathInput = document.getElementById('admin-user-path');
5601
const sizeInput = document.getElementById('admin-user-size-limit');
5606
const userPathInput = doc.getElementById('admin-user-path');
5607
const sizeInput = doc.getElementById('admin-user-size-limit');
5602
5608
if (userPathInput) userPathInput.value = data.userPath || '';
5603
5609
if (sizeInput)
5604
5610
{
@@ -5606,11 +5612,12 @@ async function refreshAdminConfig ()
5606
5612
updateAdminSizeFeedback(sizeInput.value);
5607
5613
}
5608
5614
5609
const container = document.getElementById('admin-paths');
5615
const container = doc.getElementById('admin-paths');
5616
if (!container) return;
5610
5617
container.innerHTML = '';
5611
5618
for (const p of data.paths)
5612
5619
{
5613
const row = document.createElement('div');
5620
const row = doc.createElement('div');
5614
5621
row.className = 'path-row';
5615
5622
row.innerHTML = `<span>${p}</span><button data-path="${p}" title="Remove">✕</button>`;
5616
5623
row.querySelector('button').addEventListener('click', () =>
@@ -5624,19 +5631,22 @@ async function refreshAdminConfig ()
5624
5631
async function refreshAdminUsers ()
5625
5632
{
5626
5633
if (typeof document === 'undefined' || typeof document.getElementById !== 'function') return;
5634
const doc = document;
5627
5635
const data = await api('GET', '/admin/users');
5628
5636
if (!data) return;
5629
const container = document.getElementById('admin-users-list');
5637
if (!doc.defaultView || doc.defaultView.closed) return;
5638
const container = doc.getElementById('admin-users-list');
5630
5639
if (!container) return;
5631
5640
container.innerHTML = '';
5632
5641
5633
5642
// Need paths for permission rows
5634
5643
const cfg = await api('GET', '/admin/config');
5644
if (!doc.defaultView || doc.defaultView.closed) return;
5635
5645
const paths = cfg ? (cfg.effectivePaths || []) : [];
5636
5646
5637
5647
for (const u of data.users)
5638
5648
{
5639
const row = document.createElement('div');
5649
const row = doc.createElement('div');
5640
5650
row.className = 'user-row';
5641
5651
row.innerHTML = `
5642
5652
<span class="user-name">${u.username}</span>
@@ -5666,8 +5676,9 @@ async function refreshAdminUsers ()
5666
5676
async function refreshAdminOrphanUserFolders ()
5667
5677
{
5668
5678
if (typeof document === 'undefined' || typeof document.getElementById !== 'function') return;
5669
const section = document.getElementById('admin-orphan-userfolders-section');
5670
const list = document.getElementById('admin-orphan-userfolders-list');
5679
const doc = document;
5680
const section = doc.getElementById('admin-orphan-userfolders-section');
5681
const list = doc.getElementById('admin-orphan-userfolders-list');
5671
5682
if (!section || !list) return;
5672
5683
5673
5684
let data = null;
@@ -5680,6 +5691,7 @@ async function refreshAdminOrphanUserFolders ()
5680
5691
list.innerHTML = '';
5681
5692
return;
5682
5693
}
5694
if (!doc.defaultView || doc.defaultView.closed) return;
5683
5695
5684
5696
const folders = Array.isArray(data && data.folders) ? data.folders : [];
5685
5697
if (!folders.length)
@@ -5694,19 +5706,19 @@ async function refreshAdminOrphanUserFolders ()
5694
5706
5695
5707
for (const folder of folders)
5696
5708
{
5697
const row = document.createElement('div');
5709
const row = doc.createElement('div');
5698
5710
row.className = 'user-row orphan-folder-row';
5699
5711
5700
const name = document.createElement('span');
5712
const name = doc.createElement('span');
5701
5713
name.className = 'user-name';
5702
5714
name.textContent = folder.folderName || 'Unknown folder';
5703
5715
5704
const info = document.createElement('span');
5716
const info = doc.createElement('span');
5705
5717
info.className = 'orphan-folder-meta';
5706
5718
const itemCount = Number(folder.itemCount) || 0;
5707
5719
info.textContent = `${itemCount} item${itemCount === 1 ? '' : 's'}`;
5708
5720
5709
const openBtn = document.createElement('button');
5721
const openBtn = doc.createElement('button');
5710
5722
openBtn.dataset.action = 'open-orphan-folder';
5711
5723
openBtn.textContent = 'Open folder';
5712
5724
openBtn.addEventListener('click', async () =>
@@ -5725,7 +5737,8 @@ async function refreshAdminOrphanUserFolders ()
5725
5737
isOrphanUserFolder: true,
5726
5738
};
5727
5739
await navigateTo(targetPath, syntheticRoot);
5728
document.getElementById('admin-modal').classList.add('hidden');
5740
const adminModal = doc.getElementById('admin-modal');
5741
if (adminModal) adminModal.classList.add('hidden');
5729
5742
} catch (err)
5730
5743
{
5731
5744
toast(err.message || 'Failed to open folder.', 'err');
@@ -5585,7 +5585,10 @@ function pulseAdminUpdateButton ()5585
5585
5586
async function openAdminModal ()5586
async function openAdminModal ()5587
{5587
{5588
document.getElementById('admin-modal').classList.remove('hidden');5588
if (typeof document === 'undefined' || typeof document.getElementById !== 'function') return;5589
const adminModal = document.getElementById('admin-modal');5590
if (!adminModal) return;5591
adminModal.classList.remove('hidden');5589
await refreshGlobalFavicon();5592
await refreshGlobalFavicon();5590
await refreshAdminConfig();5593
await refreshAdminConfig();5591
await refreshAdminUsers();5594
await refreshAdminUsers();@@ -5594,11 +5597,14 @@ async function openAdminModal ()5594
5597
5595
async function refreshAdminConfig ()5598
async function refreshAdminConfig ()5596
{5599
{5600
if (typeof document === 'undefined' || typeof document.getElementById !== 'function') return;5601
const doc = document;5597
const data = await api('GET', '/admin/config');5602
const data = await api('GET', '/admin/config');5598
if (!data) return;5603
if (!data) return;5604
if (!doc.defaultView || doc.defaultView.closed) return;5599
5605
5600
const userPathInput = document.getElementById('admin-user-path');5606
const userPathInput = doc.getElementById('admin-user-path');5601
const sizeInput = document.getElementById('admin-user-size-limit');5607
const sizeInput = doc.getElementById('admin-user-size-limit');5602
if (userPathInput) userPathInput.value = data.userPath || '';5608
if (userPathInput) userPathInput.value = data.userPath || '';5603
if (sizeInput)5609
if (sizeInput)5604
{5610
{@@ -5606,11 +5612,12 @@ async function refreshAdminConfig ()5606
updateAdminSizeFeedback(sizeInput.value);5612
updateAdminSizeFeedback(sizeInput.value);5607
}5613
}5608
5614
5609
const container = document.getElementById('admin-paths');5615
const container = doc.getElementById('admin-paths');5616
if (!container) return;5610
container.innerHTML = '';5617
container.innerHTML = '';5611
for (const p of data.paths)5618
for (const p of data.paths)5612
{5619
{5613
const row = document.createElement('div');5620
const row = doc.createElement('div');5614
row.className = 'path-row';5621
row.className = 'path-row';5615
row.innerHTML = `<span>${p}</span><button data-path="${p}" title="Remove">✕</button>`;5622
row.innerHTML = `<span>${p}</span><button data-path="${p}" title="Remove">✕</button>`;5616
row.querySelector('button').addEventListener('click', () =>5623
row.querySelector('button').addEventListener('click', () =>@@ -5624,19 +5631,22 @@ async function refreshAdminConfig ()5624
async function refreshAdminUsers ()5631
async function refreshAdminUsers ()5625
{5632
{5626
if (typeof document === 'undefined' || typeof document.getElementById !== 'function') return;5633
if (typeof document === 'undefined' || typeof document.getElementById !== 'function') return;5634
const doc = document;5627
const data = await api('GET', '/admin/users');5635
const data = await api('GET', '/admin/users');5628
if (!data) return;5636
if (!data) return;5629
const container = document.getElementById('admin-users-list');5637
if (!doc.defaultView || doc.defaultView.closed) return;5638
const container = doc.getElementById('admin-users-list');5630
if (!container) return;5639
if (!container) return;5631
container.innerHTML = '';5640
container.innerHTML = '';5632
5641
5633
// Need paths for permission rows5642
// Need paths for permission rows5634
const cfg = await api('GET', '/admin/config');5643
const cfg = await api('GET', '/admin/config');5644
if (!doc.defaultView || doc.defaultView.closed) return;5635
const paths = cfg ? (cfg.effectivePaths || []) : [];5645
const paths = cfg ? (cfg.effectivePaths || []) : [];5636
5646
5637
for (const u of data.users)5647
for (const u of data.users)5638
{5648
{5639
const row = document.createElement('div');5649
const row = doc.createElement('div');5640
row.className = 'user-row';5650
row.className = 'user-row';5641
row.innerHTML = `5651
row.innerHTML = `5642
<span class="user-name">${u.username}</span>5652
<span class="user-name">${u.username}</span>@@ -5666,8 +5676,9 @@ async function refreshAdminUsers ()5666
async function refreshAdminOrphanUserFolders ()5676
async function refreshAdminOrphanUserFolders ()5667
{5677
{5668
if (typeof document === 'undefined' || typeof document.getElementById !== 'function') return;5678
if (typeof document === 'undefined' || typeof document.getElementById !== 'function') return;5669
const section = document.getElementById('admin-orphan-userfolders-section');5679
const doc = document;5670
const list = document.getElementById('admin-orphan-userfolders-list');5680
const section = doc.getElementById('admin-orphan-userfolders-section');5681
const list = doc.getElementById('admin-orphan-userfolders-list');5671
if (!section || !list) return;5682
if (!section || !list) return;5672
5683
5673
let data = null;5684
let data = null;@@ -5680,6 +5691,7 @@ async function refreshAdminOrphanUserFolders ()5680
list.innerHTML = '';5691
list.innerHTML = '';5681
return;5692
return;5682
}5693
}5694
if (!doc.defaultView || doc.defaultView.closed) return;5683
5695
5684
const folders = Array.isArray(data && data.folders) ? data.folders : [];5696
const folders = Array.isArray(data && data.folders) ? data.folders : [];5685
if (!folders.length)5697
if (!folders.length)@@ -5694,19 +5706,19 @@ async function refreshAdminOrphanUserFolders ()5694
5706
5695
for (const folder of folders)5707
for (const folder of folders)5696
{5708
{5697
const row = document.createElement('div');5709
const row = doc.createElement('div');5698
row.className = 'user-row orphan-folder-row';5710
row.className = 'user-row orphan-folder-row';5699
5711
5700
const name = document.createElement('span');5712
const name = doc.createElement('span');5701
name.className = 'user-name';5713
name.className = 'user-name';5702
name.textContent = folder.folderName || 'Unknown folder';5714
name.textContent = folder.folderName || 'Unknown folder';5703
5715
5704
const info = document.createElement('span');5716
const info = doc.createElement('span');5705
info.className = 'orphan-folder-meta';5717
info.className = 'orphan-folder-meta';5706
const itemCount = Number(folder.itemCount) || 0;5718
const itemCount = Number(folder.itemCount) || 0;5707
info.textContent = `${itemCount} item${itemCount === 1 ? '' : 's'}`;5719
info.textContent = `${itemCount} item${itemCount === 1 ? '' : 's'}`;5708
5720
5709
const openBtn = document.createElement('button');5721
const openBtn = doc.createElement('button');5710
openBtn.dataset.action = 'open-orphan-folder';5722
openBtn.dataset.action = 'open-orphan-folder';5711
openBtn.textContent = 'Open folder';5723
openBtn.textContent = 'Open folder';5712
openBtn.addEventListener('click', async () =>5724
openBtn.addEventListener('click', async () =>@@ -5725,7 +5737,8 @@ async function refreshAdminOrphanUserFolders ()5725
isOrphanUserFolder: true,5737
isOrphanUserFolder: true,5726
};5738
};5727
await navigateTo(targetPath, syntheticRoot);5739
await navigateTo(targetPath, syntheticRoot);5728
document.getElementById('admin-modal').classList.add('hidden');5740
const adminModal = doc.getElementById('admin-modal');5741
if (adminModal) adminModal.classList.add('hidden');5729
} catch (err)5742
} catch (err)5730
{5743
{5731
toast(err.message || 'Failed to open folder.', 'err');5744
toast(err.message || 'Failed to open folder.', 'err');