添加了NEON硬件编码器选项,并增加了刷新列表、清空下载缓存和清空转码缓存的按钮。
This commit is contained in:
@@ -2,7 +2,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const videoListEl = document.getElementById('video-list');
|
||||
const loadingSpinner = document.getElementById('loading-spinner');
|
||||
const refreshBtn = document.getElementById('refresh-btn');
|
||||
const resetCacheBtn = document.getElementById('reset-cache-btn');
|
||||
const clearDownloadCacheBtn = document.getElementById('clear-download-cache-btn');
|
||||
const clearTranscodeCacheBtn = document.getElementById('clear-transcode-cache-btn');
|
||||
const bucketSelect = document.getElementById('bucket-select');
|
||||
const loginScreen = document.getElementById('login-screen');
|
||||
const appContainer = document.getElementById('app-container');
|
||||
@@ -196,16 +197,38 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
};
|
||||
|
||||
const resetCache = async () => {
|
||||
if (!resetCacheBtn) return;
|
||||
resetCacheBtn.disabled = true;
|
||||
resetCacheBtn.title = 'Resetting cache...';
|
||||
const clearDownloadCache = async () => {
|
||||
if (!clearDownloadCacheBtn) return;
|
||||
clearDownloadCacheBtn.disabled = true;
|
||||
clearDownloadCacheBtn.textContent = '清空中...';
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/clear-download-cache', { method: 'POST' });
|
||||
if (!res.ok) {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
throw new Error(data.error || '清空下载缓存失败');
|
||||
}
|
||||
alert('下载缓存已清空');
|
||||
} catch (err) {
|
||||
console.error('Clear download cache failed:', err);
|
||||
alert(`清空下载缓存失败: ${err.message}`);
|
||||
} finally {
|
||||
clearDownloadCacheBtn.disabled = false;
|
||||
clearDownloadCacheBtn.textContent = '清空下载缓存';
|
||||
}
|
||||
};
|
||||
|
||||
const clearTranscodeCache = async () => {
|
||||
if (!clearTranscodeCacheBtn) return;
|
||||
clearTranscodeCacheBtn.disabled = true;
|
||||
clearTranscodeCacheBtn.textContent = '清空中...';
|
||||
|
||||
stopPolling();
|
||||
selectedKey = null;
|
||||
currentVideoKey = null;
|
||||
subscribedKey = null;
|
||||
if (transcodeBtn) {
|
||||
transcodeBtn.disabled = true;
|
||||
transcodeBtn.classList.add('hidden');
|
||||
}
|
||||
if (playBtn) {
|
||||
@@ -220,18 +243,19 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
resetProgress();
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/reset-cache', { method: 'POST' });
|
||||
const res = await fetch('/api/clear-transcode-cache', { method: 'POST' });
|
||||
if (!res.ok) {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
throw new Error(data.error || 'Reset failed');
|
||||
throw new Error(data.error || '清空转码缓存失败');
|
||||
}
|
||||
await fetchVideos();
|
||||
await fetchVideos(selectedBucket);
|
||||
alert('转码缓存已清空');
|
||||
} catch (err) {
|
||||
console.error('Reset cache failed:', err);
|
||||
alert(`Reset cache failed: ${err.message}`);
|
||||
console.error('Clear transcode cache failed:', err);
|
||||
alert(`清空转码缓存失败: ${err.message}`);
|
||||
} finally {
|
||||
resetCacheBtn.disabled = false;
|
||||
resetCacheBtn.title = 'Reset Download Cache';
|
||||
clearTranscodeCacheBtn.disabled = false;
|
||||
clearTranscodeCacheBtn.textContent = '清空转码缓存';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -481,6 +505,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
// Bind events
|
||||
refreshBtn.addEventListener('click', () => fetchVideos(selectedBucket));
|
||||
if (clearDownloadCacheBtn) {
|
||||
clearDownloadCacheBtn.addEventListener('click', clearDownloadCache);
|
||||
}
|
||||
if (clearTranscodeCacheBtn) {
|
||||
clearTranscodeCacheBtn.addEventListener('click', clearTranscodeCache);
|
||||
}
|
||||
if (loginBtn) {
|
||||
loginBtn.addEventListener('click', login);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user