fix: fixed issues related to missing wvd
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
.status-running { background: #1a3a2a; color: var(--accent); }
|
||||
.status-completed { background: #1a3a1a; color: #4caf50; }
|
||||
.status-failed { background: #3a1a1a; color: var(--danger); }
|
||||
.status-cancelled { background: #3a3a1a; color: var(--warning); }
|
||||
|
||||
.job-card { background: var(--surface); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
|
||||
.job-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
|
||||
@@ -218,6 +219,18 @@
|
||||
<br><br>
|
||||
<button class="btn btn-sm btn-secondary" onclick="uploadCookies()">Upload</button>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h2>Widevine Device</h2>
|
||||
<div class="cookie-status" id="wvd-status">
|
||||
<div class="dot dot-red"></div>
|
||||
<span>Checking...</span>
|
||||
</div>
|
||||
<br>
|
||||
<label>Upload device.wvd (required for AAC quality)</label>
|
||||
<input type="file" id="wvd-file" accept=".wvd" style="margin-top:8px">
|
||||
<br><br>
|
||||
<button class="btn btn-sm btn-secondary" onclick="uploadWvd()">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -235,7 +248,7 @@
|
||||
|
||||
if (name === 'jobs') loadJobs();
|
||||
if (name === 'files') loadFiles("");
|
||||
if (name === 'settings') checkCookies();
|
||||
if (name === 'settings') { checkCookies(); checkWvd(); }
|
||||
|
||||
if (jobPollInterval) clearInterval(jobPollInterval);
|
||||
if (name === 'jobs') jobPollInterval = setInterval(loadJobs, 3000);
|
||||
@@ -358,6 +371,7 @@
|
||||
${progressHtml}
|
||||
${logHtml}
|
||||
<div class="job-actions">
|
||||
${job.status === 'running' ? `<button class="btn btn-sm btn-danger" onclick="cancelJob('${job.id}')">Cancel</button>` : ''}
|
||||
${job.status !== 'running' ? `<button class="btn btn-sm btn-danger" onclick="deleteJob('${job.id}')">Remove</button>` : ''}
|
||||
</div>
|
||||
</div>`;
|
||||
@@ -375,6 +389,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function cancelJob(id) {
|
||||
await fetch('/api/jobs/' + id + '/cancel', { method: 'POST' });
|
||||
loadJobs();
|
||||
}
|
||||
|
||||
async function deleteJob(id) {
|
||||
expandedJobs.delete(id);
|
||||
await fetch('/api/jobs/' + id, { method: 'DELETE' });
|
||||
@@ -485,6 +504,40 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function checkWvd() {
|
||||
try {
|
||||
const res = await fetch('/api/wvd');
|
||||
const data = await res.json();
|
||||
const el = document.getElementById('wvd-status');
|
||||
if (data.exists) {
|
||||
el.innerHTML = '<div class="dot dot-green"></div><span>device.wvd found</span>';
|
||||
} else {
|
||||
el.innerHTML = '<div class="dot dot-red"></div><span>device.wvd not found</span>';
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async function uploadWvd() {
|
||||
const file = document.getElementById('wvd-file').files[0];
|
||||
if (!file) { alert('Select a file first'); return; }
|
||||
const form = new FormData();
|
||||
form.append('file', file);
|
||||
try {
|
||||
const res = await fetch('/api/wvd', { method: 'POST', body: form });
|
||||
if (res.ok) {
|
||||
alert('WVD file uploaded successfully');
|
||||
checkWvd();
|
||||
} else {
|
||||
const data = await res.json();
|
||||
alert(data.error || 'Upload failed');
|
||||
}
|
||||
} catch (e) {
|
||||
alert('Error: ' + e.message);
|
||||
}
|
||||
}
|
||||
|
||||
function formatSize(bytes) {
|
||||
if (!bytes) return '';
|
||||
const units = ['B', 'KB', 'MB', 'GB'];
|
||||
@@ -531,6 +584,7 @@
|
||||
|
||||
loadSettings();
|
||||
checkCookies();
|
||||
checkWvd();
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('/sw.js')
|
||||
|
||||
Reference in New Issue
Block a user