Fix extension 404, simplify UDP/relay UI

- Add chrome-extension/ to Dockerfile COPY (was missing, caused 404 on download)
- Remove UDP Relay tab from admin panel (relay is server-side, no user config needed)
- Remove upload mode toggle buttons, replace with clean inline status bar
- Extension panel: drop relay port-forwarding note, simplify to 'extension required' message
- UDP hint shown inline only when extension is detected in browser

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Zac Gaetano 2026-04-06 20:32:25 -04:00
parent b393eca960
commit d0525eb718
2 changed files with 27 additions and 30 deletions

View file

@ -9,6 +9,7 @@ RUN npm install --omit=dev
COPY server.js .
COPY lib/ ./lib/
COPY public/ ./public/
COPY chrome-extension/ ./chrome-extension/
# Data volume for persistent config
VOLUME ["/data"]

View file

@ -461,18 +461,10 @@ body::before{content:'';position:fixed;inset:0;background:radial-gradient(ellips
<!-- UPLOAD PAGE -->
<div class="page active" id="page-upload">
<div style="margin-top:1.5rem">
<div class="section-title">Upload Mode</div>
<div class="mode-bar">
<button class="mode-btn active-http" id="mode-http" onclick="setMode('http')">
🔗 HTTP <span class="mode-badge">Reliable</span>
</button>
<button class="mode-btn" id="mode-udp" onclick="setMode('udp')">
⚡ UDP <span class="mode-badge">Fast WAN</span>
</button>
</div>
<div class="mode-desc" id="mode-desc">
<strong>HTTP Mode:</strong> Direct S3 presigned upload. Best for LAN and stable connections. Speeds: 50200 MB/s.
<div style="margin-top:1.5rem;margin-bottom:1.25rem">
<div class="mode-desc" id="mode-desc" style="margin-bottom:0">
<strong id="mode-label">HTTP Mode:</strong> <span id="mode-detail">Direct S3 presigned upload. Best for LAN and stable connections.</span>
<span id="udp-ext-hint" style="display:none;margin-left:.5rem;color:var(--dragon-bright);font-size:.75rem">⚡ UDP extension detected — <a href="#" onclick="setMode('udp');return false" style="color:inherit">switch to UDP</a></span>
</div>
</div>
@ -524,7 +516,6 @@ body::before{content:'';position:fixed;inset:0;background:radial-gradient(ellips
<div style="margin-top:1.5rem"></div>
<div class="admin-tabs">
<div class="admin-tab active" data-tab="s3" onclick="switchAdminTab('s3')">S3 Storage</div>
<div class="admin-tab" data-tab="relay" onclick="switchAdminTab('relay')">UDP Relay</div>
<div class="admin-tab" data-tab="ampp" onclick="switchAdminTab('ampp')">AMPP</div>
<div class="admin-tab" data-tab="extension" onclick="switchAdminTab('extension')">🧩 Extension</div>
<div class="admin-tab" data-tab="users" onclick="switchAdminTab('users')">Users</div>
@ -592,8 +583,8 @@ body::before{content:'';position:fixed;inset:0;background:radial-gradient(ellips
<!-- Extension -->
<div class="admin-panel" id="admin-extension">
<div class="section-title">Chrome Extension — UDP Upload</div>
<p style="color:var(--text-secondary);margin-bottom:1.5rem;line-height:1.6">The Dragon Wind Chrome extension enables UDP-accelerated uploads directly from your browser. Download the extension package below, then follow the steps to install it.</p>
<div class="section-title">Chrome Extension</div>
<p style="color:var(--text-secondary);margin-bottom:1.5rem;line-height:1.6">The Chrome extension is required to use fast UDP uploads. Install it once in Chrome — no other setup needed on your end.</p>
<button class="btn-primary" style="margin-bottom:2rem" onclick="downloadExtension()">⬇️ Download Extension (.zip)</button>
@ -610,7 +601,7 @@ body::before{content:'';position:fixed;inset:0;background:radial-gradient(ellips
<div class="ext-step-num">2</div>
<div class="ext-step-body">
<strong>Open Chrome Extensions</strong>
<p>In Chrome, navigate to <code>chrome://extensions</code> or open the menu → More Tools → Extensions.</p>
<p>Navigate to <code>chrome://extensions</code> or open Chrome menu → More Tools → Extensions.</p>
</div>
</div>
<div class="ext-step">
@ -624,22 +615,17 @@ body::before{content:'';position:fixed;inset:0;background:radial-gradient(ellips
<div class="ext-step-num">4</div>
<div class="ext-step-body">
<strong>Load the extension</strong>
<p>Click <strong>Load unpacked</strong>, then navigate to and select the <code>dragon-wind-extension</code> folder you unzipped in step 1.</p>
<p>Click <strong>Load unpacked</strong> and select the <code>dragon-wind-extension</code> folder you unzipped in step 1.</p>
</div>
</div>
<div class="ext-step">
<div class="ext-step-num">5</div>
<div class="ext-step-body">
<strong>Configure the extension</strong>
<p>Click the 🐉 Dragon Wind icon in Chrome's toolbar. Enter this server's URL and log in with your credentials. UDP uploads will now be available from any page.</p>
<strong>Sign in</strong>
<p>Click the extension icon in Chrome's toolbar, enter this portal's URL, and log in. UDP mode will now be available on the upload page.</p>
</div>
</div>
</div>
<div class="ext-note">
<strong>📡 UDP Port Forwarding</strong><br>
For uploads from outside your local network, make sure your UDP relay port is forwarded in your router. You can find your assigned UDP port in the <strong>.env</strong> file (<code>RELAY_UDP_PORT</code>) or check the UDP Relay tab above.
</div>
</div>
<!-- Users -->
@ -925,19 +911,29 @@ async function downloadExtension() {
// ============================================================
function setMode(mode) {
uploadMode = mode;
document.getElementById('mode-http').className = `mode-btn${mode==='http'?' active-http':''}`;
document.getElementById('mode-udp').className = `mode-btn${mode==='udp' ?' active-udp':''}`;
const btn = document.getElementById('upload-btn');
const desc = document.getElementById('mode-desc');
const label = document.getElementById('mode-label');
const detail = document.getElementById('mode-detail');
const hint = document.getElementById('udp-ext-hint');
if (mode === 'http') {
btn.className = 'btn-upload';
desc.innerHTML = '<strong>HTTP Mode:</strong> Direct S3 presigned upload. Best for LAN and stable connections. Speeds: 50200 MB/s.';
if (label) label.textContent = 'HTTP Mode:';
if (detail) detail.textContent = 'Direct S3 presigned upload. Best for LAN and stable connections.';
if (hint) hint.style.display = 'none';
} else {
btn.className = 'btn-upload udp';
desc.innerHTML = '<strong>UDP Mode:</strong> Relay-accelerated transfer. 48× faster on WAN/lossy networks. Requires relay server.';
if (label) label.textContent = 'UDP Mode:';
if (detail) detail.textContent = 'Fast relay-accelerated transfer via the Chrome extension.';
if (hint) hint.style.display = 'none';
}
updateUploadBtn();
}
function checkUdpExtension() {
// Extension injects a flag on the page when active
const extAvailable = !!(window.__dragonWindExtension || window.__dwExt);
const hint = document.getElementById('udp-ext-hint');
if (hint && extAvailable && uploadMode === 'http') hint.style.display = 'inline';
}
// ============================================================
// FOLDERS