phase 2 rework
This commit is contained in:
1 parent
20054198f3
commit
b397ea9256
44 files changed
+5528
-1377
No files matched your search
+38
-47
@@ -1,56 +1,47 @@
|
||||
<%
|
||||
const currentPage = typeof activePage === 'string' ? activePage : '';
|
||||
const pageTitle = typeof title === 'string' && title ? title : 'Proxer Downloader';
|
||||
const globalStatus = typeof global === 'object' && global ? global : {};
|
||||
const summaryKnown = typeof counts === 'object' && counts !== null;
|
||||
const downloadsPaused = globalStatus.captcha_blocked === true;
|
||||
const pendingCount = summaryKnown ? (Number(counts.queued) || 0) + (Number(counts.processing) || 0) : null;
|
||||
%>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Proxer-Downloader</title>
|
||||
<link rel="shortcut icon" href="/assets/favicon.ico" type="image/x-icon">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<meta name="color-scheme" content="dark">
|
||||
<title><%= pageTitle %><%= pageTitle === 'Proxer Downloader' ? '' : ' · Proxer Downloader' %></title>
|
||||
<link rel="icon" href="/assets/favicon.ico" type="image/x-icon">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<script src="/app.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- CAPTCHA ALERT (initially hidden, will be toggled by JS) -->
|
||||
<div id="captcha-alert" class="alert alert-danger text-center m-0" style="display: <%= (typeof global !== 'undefined' && global.captcha_blocked) ? 'block' : 'none' %>;">
|
||||
<span id="captcha-message"><%= (typeof global !== 'undefined' && global.pause_reason === 'resolution')
|
||||
? '⚠ The video link could not be resolved. Possible causes include CAPTCHA or login verification, an unavailable video, or a source change. Workers are paused for verification.'
|
||||
: '⚠ Authentication or access needs verification on Proxer. Workers are paused until verification is complete.' %></span>
|
||||
<form id="clear-captcha-form" action="/clear-captcha" method="POST" class="d-inline ms-2">
|
||||
<button class="btn btn-danger btn-sm">Resume after verification</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="container-fluid py-4" style="max-width: 2000px;">
|
||||
<!-- HEADER -->
|
||||
<header class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1>Proxer-Downloader</h1>
|
||||
<nav class="d-flex gap-2">
|
||||
<a class="btn btn-outline-light" href="/">Home</a>
|
||||
<a class="btn btn-outline-light" href="/status">Status</a>
|
||||
<a class="btn btn-outline-light" href="/pm2">PM2</a>
|
||||
<a class="skip-link" href="#main-content">Skip to content</a>
|
||||
<header class="topbar">
|
||||
<div class="topbar-inner">
|
||||
<a class="brand" href="/" aria-label="Proxer Downloader home">
|
||||
<span class="brand-mark" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none"><path d="M12 4v11m-4-4 4 4 4-4M5 17v3h14v-3" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg></span>
|
||||
<span class="brand-text">Proxer<span>Downloader</span></span>
|
||||
</a>
|
||||
<nav class="main-nav" aria-label="Main navigation">
|
||||
<a href="/" class="nav-link<%= currentPage === 'dashboard' ? ' is-active' : '' %>"<%- currentPage === 'dashboard' ? ' aria-current="page"' : '' %>>Dashboard</a>
|
||||
<a href="/download" class="nav-link<%= currentPage === 'download' ? ' is-active' : '' %>"<%- currentPage === 'download' ? ' aria-current="page"' : '' %>>New download</a>
|
||||
<a href="/status" class="nav-link<%= currentPage === 'queue' ? ' is-active' : '' %>"<%- currentPage === 'queue' ? ' aria-current="page"' : '' %>>Queue <span id="nav-queue-count" class="nav-count"<%- pendingCount === null ? ' hidden' : '' %>><%= pendingCount === null ? '' : pendingCount.toLocaleString('en') %></span></a>
|
||||
<a href="/pm2" class="nav-link<%= currentPage === 'workers' ? ' is-active' : '' %>"<%- currentPage === 'workers' ? ' aria-current="page"' : '' %>>Workers</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<script>
|
||||
async function updateCaptchaAlert() {
|
||||
try {
|
||||
const res = await fetch('/status-data', { cache: 'no-store' });
|
||||
const data = await res.json();
|
||||
const alertEl = document.getElementById('captcha-alert');
|
||||
const messageEl = document.getElementById('captcha-message');
|
||||
|
||||
if (data.global && data.global.captcha_blocked) {
|
||||
messageEl.textContent = data.global.pause_reason === 'resolution'
|
||||
? '⚠ The video link could not be resolved. Possible causes include CAPTCHA or login verification, an unavailable video, or a source change. Workers are paused for verification.'
|
||||
: '⚠ Authentication or access needs verification on Proxer. Workers are paused until verification is complete.';
|
||||
alertEl.style.display = 'block';
|
||||
} else {
|
||||
alertEl.style.display = 'none';
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error fetching status-data:', err);
|
||||
}
|
||||
}
|
||||
|
||||
// Poll every 5 seconds
|
||||
setInterval(updateCaptchaAlert, 5000);
|
||||
</script>
|
||||
<span id="global-status" class="connection-status<%= downloadsPaused ? ' is-paused' : summaryKnown ? ' is-ready' : '' %>" role="status" aria-live="polite"><span class="status-dot" aria-hidden="true"></span><span id="global-status-text"><%= downloadsPaused ? 'Downloads paused' : summaryKnown ? 'Queue ready' : 'Checking queue…' %></span></span>
|
||||
</div>
|
||||
</header>
|
||||
<div class="notice-wrap">
|
||||
<section id="captcha-alert" class="verification-notice" aria-label="Downloads need your attention"<%- downloadsPaused ? '' : ' hidden' %>>
|
||||
<div class="notice-copy"><strong>Verification needed</strong><span id="captcha-message"><%= globalStatus.pause_reason === 'resolution'
|
||||
? 'The video link could not be resolved. Possible causes include CAPTCHA or login verification, an unavailable video, or a source change. Workers are paused for verification.'
|
||||
: 'Authentication or access needs verification on Proxer. Workers are paused until verification is complete.' %></span></div>
|
||||
<form id="clear-captcha-form" action="/clear-captcha" method="POST">
|
||||
<button type="submit" class="button button-warning button-small">Resume after verification</button>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
<main id="main-content" class="app-main" data-page="<%= currentPage %>" tabindex="-1">
|
||||
Reference in new issue
Block a user