feat: bitcoin-ui CSS fix, HTTPS proxy support, deploy script improvements
Bitcoin UI: - Replace cdn.tailwindcss.com with locally bundled tailwind.css (CSP blocks external scripts) - Make all asset paths relative for nginx proxy compatibility - Add bitcoin-ui build/deploy to deploy-to-target.sh (was missing entirely) - Use --network host (bitcoin-ui proxies Bitcoin RPC at 127.0.0.1:8332) HTTPS mixed content fix: - Add HTTPS_PROXY_PATHS in AppSession.vue — when parent page is HTTPS, iframe loads through nginx proxy instead of direct HTTP port - Prevents browser blocking HTTP iframes inside HTTPS pages - All Tailscale servers use HTTPS, this was breaking all app iframes Deploy & first-boot improvements: - first-boot-containers.sh auto-detects disk size for pruning vs txindex - first-boot-containers.sh checks fallback source path for UI containers - Added mempool-electrs to APP_PORTS mapping - ElectrumX container creation in first-boot - Podman doctor/fix/uptime skills added Also includes: session persistence, identity management, LND transactions, ElectrumX status UI, nostr-provider improvements, Web5 enhancements Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ FROM docker.io/library/nginx:alpine
|
||||
|
||||
# Copy the static UI
|
||||
COPY index.html /usr/share/nginx/html/
|
||||
COPY tailwind.css /usr/share/nginx/html/
|
||||
|
||||
# Create assets directories first
|
||||
RUN mkdir -p /usr/share/nginx/html/assets/img/app-icons && \
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<meta http-equiv="Pragma" content="no-cache">
|
||||
<meta http-equiv="Expires" content="0">
|
||||
<title>Bitcoin Knots - Archipelago</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link rel="stylesheet" href="tailwind.css">
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
@@ -35,7 +35,7 @@
|
||||
.bg-layer {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image: url('/assets/img/bg-network.jpg');
|
||||
background-image: url('assets/img/bg-network.jpg');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
@@ -337,7 +337,7 @@
|
||||
<div class="flex-shrink-0">
|
||||
<div class="logo-gradient-border">
|
||||
<img
|
||||
src="/assets/img/app-icons/bitcoin-knots.webp"
|
||||
src="assets/img/app-icons/bitcoin-knots.webp"
|
||||
alt="Bitcoin Knots"
|
||||
class="w-16 h-16"
|
||||
style="object-fit: contain;"
|
||||
@@ -591,7 +591,7 @@
|
||||
console.log('[Bitcoin UI] Script loaded, initializing...');
|
||||
|
||||
// RPC Configuration - Use local Nginx proxy within container
|
||||
const RPC_ENDPOINT = '/bitcoin-rpc/';
|
||||
const RPC_ENDPOINT = 'bitcoin-rpc/';
|
||||
console.log('[Bitcoin UI] RPC Endpoint:', RPC_ENDPOINT);
|
||||
|
||||
// Make RPC call to Bitcoin node via local proxy
|
||||
|
||||
210
docker/bitcoin-ui/tailwind.css
Normal file
210
docker/bitcoin-ui/tailwind.css
Normal file
@@ -0,0 +1,210 @@
|
||||
/* Tailwind CSS utilities — manually extracted for bitcoin-ui */
|
||||
/* Replaces cdn.tailwindcss.com to comply with CSP script-src 'self' */
|
||||
|
||||
*, ::before, ::after {
|
||||
box-sizing: border-box;
|
||||
border-width: 0;
|
||||
border-style: solid;
|
||||
border-color: currentColor;
|
||||
}
|
||||
img, svg { display: block; vertical-align: middle; max-width: 100%; height: auto; }
|
||||
button { cursor: pointer; background-color: transparent; font-family: inherit; font-size: 100%; line-height: inherit; color: inherit; margin: 0; padding: 0; }
|
||||
h1, h2 { font-size: inherit; font-weight: inherit; }
|
||||
|
||||
/* Position */
|
||||
.relative { position: relative; }
|
||||
.absolute { position: absolute; }
|
||||
.fixed { position: fixed; }
|
||||
.inset-0 { inset: 0; }
|
||||
|
||||
/* Display */
|
||||
.hidden { display: none; }
|
||||
.flex { display: flex; }
|
||||
.grid { display: grid; }
|
||||
|
||||
/* Flex */
|
||||
.flex-col { flex-direction: column; }
|
||||
.flex-row { flex-direction: row; }
|
||||
.flex-1 { flex: 1 1 0%; }
|
||||
.flex-shrink-0 { flex-shrink: 0; }
|
||||
.items-center { align-items: center; }
|
||||
.items-start { align-items: flex-start; }
|
||||
.justify-between { justify-content: space-between; }
|
||||
.justify-center { justify-content: center; }
|
||||
|
||||
/* Gap */
|
||||
.gap-2 { gap: 0.5rem; }
|
||||
.gap-3 { gap: 0.75rem; }
|
||||
.gap-4 { gap: 1rem; }
|
||||
.gap-6 { gap: 1.5rem; }
|
||||
|
||||
/* Grid */
|
||||
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
|
||||
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
||||
|
||||
/* Width */
|
||||
.w-3 { width: 0.75rem; }
|
||||
.w-4 { width: 1rem; }
|
||||
.w-5 { width: 1.25rem; }
|
||||
.w-6 { width: 1.5rem; }
|
||||
.w-8 { width: 2rem; }
|
||||
.w-12 { width: 3rem; }
|
||||
.w-16 { width: 4rem; }
|
||||
.w-full { width: 100%; }
|
||||
|
||||
/* Height */
|
||||
.h-1 { height: 0.25rem; }
|
||||
.h-2 { height: 0.5rem; }
|
||||
.h-3 { height: 0.75rem; }
|
||||
.h-4 { height: 1rem; }
|
||||
.h-5 { height: 1.25rem; }
|
||||
.h-6 { height: 1.5rem; }
|
||||
.h-8 { height: 2rem; }
|
||||
.h-12 { height: 3rem; }
|
||||
.h-16 { height: 4rem; }
|
||||
.h-full { height: 100%; }
|
||||
|
||||
/* Min/Max */
|
||||
.min-w-0 { min-width: 0px; }
|
||||
.max-w-2xl { max-width: 42rem; }
|
||||
.max-w-4xl { max-width: 56rem; }
|
||||
.max-h-\[80vh\] { max-height: 80vh; }
|
||||
|
||||
/* Padding */
|
||||
.p-2 { padding: 0.5rem; }
|
||||
.p-3 { padding: 0.75rem; }
|
||||
.p-4 { padding: 1rem; }
|
||||
.p-6 { padding: 1.5rem; }
|
||||
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
|
||||
.px-4 { padding-left: 1rem; padding-right: 1rem; }
|
||||
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
|
||||
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
|
||||
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
|
||||
|
||||
/* Margin */
|
||||
.mb-1 { margin-bottom: 0.25rem; }
|
||||
.mb-2 { margin-bottom: 0.5rem; }
|
||||
.mb-4 { margin-bottom: 1rem; }
|
||||
.mb-6 { margin-bottom: 1.5rem; }
|
||||
.mb-8 { margin-bottom: 2rem; }
|
||||
.mt-2 { margin-top: 0.5rem; }
|
||||
.mt-4 { margin-top: 1rem; }
|
||||
.mx-auto { margin-left: auto; margin-right: auto; }
|
||||
|
||||
/* Typography — Size */
|
||||
.text-xs { font-size: 0.75rem; line-height: 1rem; }
|
||||
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
|
||||
.text-base { font-size: 1rem; line-height: 1.5rem; }
|
||||
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
|
||||
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
|
||||
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
|
||||
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
|
||||
|
||||
/* Typography — Weight */
|
||||
.font-medium { font-weight: 500; }
|
||||
.font-semibold { font-weight: 600; }
|
||||
.font-bold { font-weight: 700; }
|
||||
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
|
||||
.text-center { text-align: center; }
|
||||
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
|
||||
/* Typography — Color */
|
||||
.text-white { color: #ffffff; }
|
||||
.text-white\/40 { color: rgba(255, 255, 255, 0.4); }
|
||||
.text-white\/50 { color: rgba(255, 255, 255, 0.5); }
|
||||
.text-white\/60 { color: rgba(255, 255, 255, 0.6); }
|
||||
.text-white\/70 { color: rgba(255, 255, 255, 0.7); }
|
||||
.text-white\/80 { color: rgba(255, 255, 255, 0.8); }
|
||||
.text-green-400 { color: #4ade80; }
|
||||
.text-green-500 { color: #22c55e; }
|
||||
.text-orange-400 { color: #fb923c; }
|
||||
.text-orange-500 { color: #f97316; }
|
||||
.text-red-400 { color: #f87171; }
|
||||
.text-yellow-400 { color: #facc15; }
|
||||
|
||||
/* Backgrounds */
|
||||
.bg-green-400 { background-color: #4ade80; }
|
||||
.bg-green-500 { background-color: #22c55e; }
|
||||
.bg-orange-400 { background-color: #fb923c; }
|
||||
.bg-orange-500 { background-color: #f97316; }
|
||||
.bg-red-400 { background-color: #f87171; }
|
||||
.bg-orange-500\/20 { background-color: rgba(249, 115, 22, 0.2); }
|
||||
.bg-white\/5 { background-color: rgba(255, 255, 255, 0.05); }
|
||||
.bg-white\/10 { background-color: rgba(255, 255, 255, 0.1); }
|
||||
.bg-black\/20 { background-color: rgba(0, 0, 0, 0.2); }
|
||||
.bg-black\/40 { background-color: rgba(0, 0, 0, 0.4); }
|
||||
.bg-black\/60 { background-color: rgba(0, 0, 0, 0.6); }
|
||||
.bg-black\/80 { background-color: rgba(0, 0, 0, 0.8); }
|
||||
|
||||
/* Gradients */
|
||||
.bg-gradient-to-r { background-image: linear-gradient(to right, var(--tw-gradient-stops)); }
|
||||
.from-orange-500 { --tw-gradient-from: #f97316; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(249, 115, 22, 0)); }
|
||||
.from-orange-400 { --tw-gradient-from: #fb923c; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(251, 146, 60, 0)); }
|
||||
.to-yellow-400 { --tw-gradient-to: #facc15; }
|
||||
.to-orange-600 { --tw-gradient-to: #ea580c; }
|
||||
|
||||
/* Border */
|
||||
.border { border-width: 1px; }
|
||||
.border-white\/10 { border-color: rgba(255, 255, 255, 0.1); }
|
||||
.border-white\/20 { border-color: rgba(255, 255, 255, 0.2); }
|
||||
.border-orange-500\/30 { border-color: rgba(249, 115, 22, 0.3); }
|
||||
|
||||
/* Border Radius */
|
||||
.rounded { border-radius: 0.25rem; }
|
||||
.rounded-lg { border-radius: 0.5rem; }
|
||||
.rounded-xl { border-radius: 0.75rem; }
|
||||
.rounded-2xl { border-radius: 1rem; }
|
||||
.rounded-full { border-radius: 9999px; }
|
||||
|
||||
/* Overflow */
|
||||
.overflow-hidden { overflow: hidden; }
|
||||
.overflow-y-auto { overflow-y: auto; }
|
||||
|
||||
/* Opacity */
|
||||
.opacity-0 { opacity: 0; }
|
||||
.opacity-75 { opacity: 0.75; }
|
||||
.opacity-100 { opacity: 1; }
|
||||
|
||||
/* Z-Index */
|
||||
.z-10 { z-index: 10; }
|
||||
.z-50 { z-index: 50; }
|
||||
|
||||
/* Spacing utilities */
|
||||
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.5rem; }
|
||||
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.75rem; }
|
||||
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
|
||||
|
||||
/* Backdrop filter */
|
||||
.backdrop-blur-sm { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
|
||||
.backdrop-blur-md { -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
|
||||
.backdrop-blur-xl { -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); }
|
||||
|
||||
/* Transitions */
|
||||
.transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
|
||||
.transition-opacity { transition-property: opacity; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
|
||||
.duration-300 { transition-duration: 300ms; }
|
||||
.duration-500 { transition-duration: 500ms; }
|
||||
|
||||
/* Text wrapping */
|
||||
.whitespace-pre-wrap { white-space: pre-wrap; }
|
||||
.break-all { word-break: break-all; }
|
||||
|
||||
/* Cursor */
|
||||
.cursor-pointer { cursor: pointer; }
|
||||
|
||||
/* Responsive: md (768px+) */
|
||||
@media (min-width: 768px) {
|
||||
.md\:flex-row { flex-direction: row; }
|
||||
.md\:items-center { align-items: center; }
|
||||
.md\:gap-4 { gap: 1rem; }
|
||||
.md\:gap-6 { gap: 1.5rem; }
|
||||
.md\:w-auto { width: auto; }
|
||||
.md\:mt-0 { margin-top: 0; }
|
||||
.md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
||||
.md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
||||
}
|
||||
|
||||
/* Responsive: lg (1024px+) */
|
||||
@media (min-width: 1024px) {
|
||||
.lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
FROM docker.io/library/nginx:alpine
|
||||
|
||||
COPY index.html /usr/share/nginx/html/
|
||||
COPY qrcode.js /usr/share/nginx/html/
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
RUN mkdir -p /usr/share/nginx/html/assets/img
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
|
||||
<title>Electrs - Archipelago</title>
|
||||
<title>ElectrumX - Archipelago</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; min-height: 100vh; color: white; overflow-x: hidden; }
|
||||
@@ -69,6 +69,28 @@
|
||||
.md-flex-row { flex-direction: row; }
|
||||
.md-grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
|
||||
}
|
||||
|
||||
/* Connection details */
|
||||
.conn-tabs { display: flex; background: rgba(255,255,255,0.08); border-radius: 0.5rem; overflow: hidden; margin-bottom: 1.5rem; }
|
||||
.conn-tab { flex: 1; padding: 0.625rem 1rem; text-align: center; font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease; color: rgba(255,255,255,0.5); border: none; background: none; }
|
||||
.conn-tab.active { background: rgba(74, 222, 128, 0.2); color: #4ade80; }
|
||||
.conn-tab:hover:not(.active) { color: rgba(255,255,255,0.8); }
|
||||
.conn-layout { display: flex; flex-direction: column; gap: 1.5rem; }
|
||||
@media (min-width: 640px) { .conn-layout { flex-direction: row; } }
|
||||
.qr-box { flex-shrink: 0; width: 196px; background: white; border-radius: 0.75rem; padding: 0.75rem; display: flex; align-items: center; justify-content: center; }
|
||||
.qr-box img { width: 100%; height: auto; display: block; image-rendering: pixelated; }
|
||||
.conn-fields { flex: 1; display: flex; flex-direction: column; gap: 0.75rem; }
|
||||
.field-label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(255,255,255,0.45); margin-bottom: 0.25rem; }
|
||||
.field-row { display: flex; align-items: center; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 0.5rem; overflow: hidden; }
|
||||
.field-value { flex: 1; padding: 0.625rem 0.875rem; font-family: monospace; font-size: 0.9375rem; color: rgba(255,255,255,0.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.copy-btn { padding: 0.625rem 0.75rem; background: none; border: none; border-left: 1px solid rgba(255,255,255,0.1); cursor: pointer; color: rgba(255,255,255,0.4); transition: all 0.2s ease; display: flex; align-items: center; }
|
||||
.copy-btn:hover { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.05); }
|
||||
.copy-btn.copied { color: #4ade80; }
|
||||
.field-row-split { display: flex; gap: 0.75rem; }
|
||||
.field-row-split > div { flex: 1; }
|
||||
.conn-disabled { text-align: center; padding: 2rem 1rem; }
|
||||
.help-text { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid rgba(255,255,255,0.08); font-size: 0.875rem; color: rgba(255,255,255,0.5); line-height: 1.5; }
|
||||
.version-text { font-size: 0.75rem; color: rgba(255,255,255,0.4); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -76,6 +98,7 @@
|
||||
<div class="overlay"></div>
|
||||
|
||||
<div class="container">
|
||||
<!-- Header -->
|
||||
<div class="glass-card p-6 mb-6">
|
||||
<div class="flex flex-col md-flex-row items-center gap-4">
|
||||
<div class="icon-box flex-shrink-0">
|
||||
@@ -84,8 +107,11 @@
|
||||
</svg>
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<h1 class="text-2xl font-bold text-white">Electrs</h1>
|
||||
<p class="text-white-70">Bitcoin Electrum indexer for Mempool & Electrum clients</p>
|
||||
<div class="flex items-center gap-3">
|
||||
<h1 class="text-2xl font-bold text-white">ElectrumX</h1>
|
||||
<span class="version-text">v1.18.0</span>
|
||||
</div>
|
||||
<p class="text-white-70">Bitcoin Electrum server for wallet connections</p>
|
||||
</div>
|
||||
<div class="info-card flex items-center gap-3">
|
||||
<div id="statusDot" class="status-dot bg-yellow"></div>
|
||||
@@ -97,7 +123,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="glass-card p-6">
|
||||
<!-- Sync Status -->
|
||||
<div class="glass-card p-6 mb-6">
|
||||
<div class="flex items-start gap-4 mb-4">
|
||||
<div class="icon-box-sm flex-shrink-0">
|
||||
<svg id="syncIcon" style="width:1.5rem;height:1.5rem;color:#f97316" class="animate-spin-slow" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
@@ -139,17 +166,215 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Connection Details -->
|
||||
<div class="glass-card p-6">
|
||||
<h2 class="text-xl font-semibold text-white mb-1">Connect Your Wallet</h2>
|
||||
<p class="text-white-70 text-sm mb-4" id="connSubtitle">Use the following details to connect your wallet or application to ElectrumX.</p>
|
||||
|
||||
<div class="conn-tabs">
|
||||
<button class="conn-tab active" id="tabLocal" onclick="switchTab('local')">Local Network</button>
|
||||
<button class="conn-tab" id="tabTor" onclick="switchTab('tor')">Tor</button>
|
||||
</div>
|
||||
|
||||
<!-- Local Network Tab -->
|
||||
<div id="panelLocal" class="conn-layout">
|
||||
<div class="qr-box" id="qrLocalBox"></div>
|
||||
<div class="conn-fields">
|
||||
<div>
|
||||
<div class="field-label">Address</div>
|
||||
<div class="field-row">
|
||||
<span class="field-value" id="localAddress">-</span>
|
||||
<button class="copy-btn" onclick="copyField('localAddress', this)" title="Copy">
|
||||
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2" stroke-width="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" stroke-width="2"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field-row-split">
|
||||
<div>
|
||||
<div class="field-label">Port</div>
|
||||
<div class="field-row">
|
||||
<span class="field-value">50001</span>
|
||||
<button class="copy-btn" onclick="copyText('50001', this)" title="Copy">
|
||||
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2" stroke-width="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" stroke-width="2"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="field-label">SSL</div>
|
||||
<div class="field-row">
|
||||
<span class="field-value">Disabled</span>
|
||||
<button class="copy-btn" onclick="copyText('Disabled', this)" title="Copy">
|
||||
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2" stroke-width="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" stroke-width="2"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tor Tab -->
|
||||
<div id="panelTor" style="display:none">
|
||||
<div id="torAvailable" class="conn-layout" style="display:none">
|
||||
<div class="qr-box" id="qrTorBox"></div>
|
||||
<div class="conn-fields">
|
||||
<div>
|
||||
<div class="field-label">Onion Address</div>
|
||||
<div class="field-row">
|
||||
<span class="field-value" id="torAddress" style="font-size:0.75rem">-</span>
|
||||
<button class="copy-btn" onclick="copyField('torAddress', this)" title="Copy">
|
||||
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2" stroke-width="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" stroke-width="2"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field-row-split">
|
||||
<div>
|
||||
<div class="field-label">Port</div>
|
||||
<div class="field-row">
|
||||
<span class="field-value">50001</span>
|
||||
<button class="copy-btn" onclick="copyText('50001', this)" title="Copy">
|
||||
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2" stroke-width="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" stroke-width="2"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="field-label">SSL</div>
|
||||
<div class="field-row">
|
||||
<span class="field-value">Disabled</span>
|
||||
<button class="copy-btn" onclick="copyText('Disabled', this)" title="Copy">
|
||||
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2" stroke-width="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" stroke-width="2"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="torUnavailable" class="conn-disabled">
|
||||
<svg style="width:2.5rem;height:2.5rem;color:rgba(255,255,255,0.25);margin:0 auto 0.75rem" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
|
||||
</svg>
|
||||
<p class="text-white-70" style="font-size:0.9375rem">Tor hidden service not configured for ElectrumX.</p>
|
||||
<p class="text-white-60 text-sm" style="margin-top:0.375rem">Enable Tor for ElectrumX in Settings to connect remotely.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="help-text">
|
||||
Connect using <strong style="color:rgba(255,255,255,0.8)">Sparrow Wallet</strong>, <strong style="color:rgba(255,255,255,0.8)">Electrum</strong>, or any Electrum-protocol compatible wallet. Set the server to the address and port shown above with SSL disabled.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="qrcode.js"></script>
|
||||
<script>
|
||||
var currentTab = 'local';
|
||||
var torOnion = null;
|
||||
|
||||
function renderQR(containerId, text) {
|
||||
var container = document.getElementById(containerId);
|
||||
if (!container) return;
|
||||
container.innerHTML = '';
|
||||
try {
|
||||
var qr = qrcode(0, 'M');
|
||||
qr.addData(text);
|
||||
qr.make();
|
||||
container.innerHTML = qr.createImgTag(5, 0);
|
||||
} catch(e) {
|
||||
container.innerHTML = '<div style="color:#999;font-size:12px;text-align:center;padding:2rem">QR unavailable</div>';
|
||||
}
|
||||
}
|
||||
|
||||
function switchTab(tab) {
|
||||
currentTab = tab;
|
||||
document.getElementById('tabLocal').classList.toggle('active', tab === 'local');
|
||||
document.getElementById('tabTor').classList.toggle('active', tab === 'tor');
|
||||
document.getElementById('panelLocal').style.display = tab === 'local' ? '' : 'none';
|
||||
document.getElementById('panelTor').style.display = tab === 'tor' ? '' : 'none';
|
||||
}
|
||||
|
||||
var COPY_SVG = '<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2" stroke-width="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" stroke-width="2"/></svg>';
|
||||
var CHECK_SVG = '<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>';
|
||||
|
||||
function flashCopied(btn) {
|
||||
btn.classList.add('copied');
|
||||
var orig = btn.innerHTML;
|
||||
btn.innerHTML = CHECK_SVG;
|
||||
setTimeout(function() {
|
||||
btn.classList.remove('copied');
|
||||
btn.innerHTML = orig;
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
function copyField(id, btn) {
|
||||
var text = document.getElementById(id).textContent.trim();
|
||||
if (!text || text === '-') return;
|
||||
navigator.clipboard.writeText(text).then(function() { flashCopied(btn); });
|
||||
}
|
||||
|
||||
function copyText(text, btn) {
|
||||
navigator.clipboard.writeText(text).then(function() { flashCopied(btn); });
|
||||
}
|
||||
|
||||
function copyConnStr(type) {
|
||||
var id = type === 'tor' ? 'torConnStr' : 'localConnStr';
|
||||
var btn = type === 'tor' ? document.querySelector('#torAvailable .conn-string-copy') : document.getElementById('localCopyAll');
|
||||
var text = document.getElementById(id).textContent.trim();
|
||||
if (!text || text === '-') return;
|
||||
navigator.clipboard.writeText(text).then(function() {
|
||||
btn.classList.add('copied');
|
||||
var orig = btn.textContent;
|
||||
btn.textContent = 'Copied!';
|
||||
setTimeout(function() {
|
||||
btn.classList.remove('copied');
|
||||
btn.textContent = orig;
|
||||
}, 1500);
|
||||
});
|
||||
}
|
||||
|
||||
function updateConnectionInfo() {
|
||||
var host = window.location.hostname;
|
||||
document.getElementById('localAddress').textContent = host;
|
||||
renderQR('qrLocalBox', host + ':50001:t');
|
||||
|
||||
if (torOnion) {
|
||||
document.getElementById('torAvailable').style.display = '';
|
||||
document.getElementById('torUnavailable').style.display = 'none';
|
||||
document.getElementById('torAddress').textContent = torOnion;
|
||||
renderQR('qrTorBox', torOnion + ':50001:t');
|
||||
} else {
|
||||
document.getElementById('torAvailable').style.display = 'none';
|
||||
document.getElementById('torUnavailable').style.display = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchTorInfo() {
|
||||
try {
|
||||
var resp = await fetch('/rpc/v1', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
credentials: 'include',
|
||||
body: JSON.stringify({ method: 'tor.list-services', params: {} })
|
||||
});
|
||||
var data = await resp.json();
|
||||
if (data.result && data.result.services) {
|
||||
var svc = data.result.services.find(function(s) {
|
||||
return s.name === 'electrumx' || s.name === 'electrs' || s.local_port === 50001;
|
||||
});
|
||||
if (svc && svc.onion_address) {
|
||||
torOnion = svc.onion_address;
|
||||
updateConnectionInfo();
|
||||
}
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
async function updateStatus() {
|
||||
try {
|
||||
const resp = await fetch('electrs-status');
|
||||
const data = await resp.json();
|
||||
var resp = await fetch('electrs-status');
|
||||
var data = await resp.json();
|
||||
|
||||
const indexedH = data.indexed_height ?? 0;
|
||||
const networkH = data.network_height ?? 0;
|
||||
const pct = data.progress_pct ?? 0;
|
||||
var indexedH = data.indexed_height || 0;
|
||||
var networkH = data.network_height || 0;
|
||||
var pct = data.progress_pct || 0;
|
||||
|
||||
document.getElementById('indexedHeight').textContent = indexedH > 0 ? indexedH.toLocaleString() : (data.status === 'indexing' ? 'Building...' : '-');
|
||||
document.getElementById('networkHeight').textContent = networkH > 0 ? networkH.toLocaleString() : '-';
|
||||
@@ -159,35 +384,39 @@
|
||||
document.getElementById('syncPercentage').textContent = pct > 0 ? pct.toFixed(1) + '%' : '0%';
|
||||
document.getElementById('syncProgressBar').style.width = Math.max(pct, 0.5) + '%';
|
||||
|
||||
const statusText = document.getElementById('syncStatusText');
|
||||
const statusDot = document.getElementById('statusDot');
|
||||
const syncIcon = document.getElementById('syncIcon');
|
||||
var statusTextEl = document.getElementById('syncStatusText');
|
||||
var statusDot = document.getElementById('statusDot');
|
||||
var syncIcon = document.getElementById('syncIcon');
|
||||
|
||||
if (data.status === 'indexing') {
|
||||
statusText.textContent = data.error || 'Building index...';
|
||||
statusText.style.color = '#fbbf24';
|
||||
statusTextEl.textContent = data.error || 'Building index...';
|
||||
statusTextEl.style.color = '#fbbf24';
|
||||
statusDot.className = 'status-dot bg-amber animate-pulse';
|
||||
document.getElementById('statusText').textContent = 'Indexing';
|
||||
syncIcon.classList.add('animate-spin-slow');
|
||||
document.getElementById('connSubtitle').textContent = 'Connections will be available once ElectrumX has completed syncing.';
|
||||
} else if (data.status === 'error') {
|
||||
statusText.textContent = data.error || 'Unknown error';
|
||||
statusText.style.color = '#f87171';
|
||||
statusTextEl.textContent = data.error || 'Unknown error';
|
||||
statusTextEl.style.color = '#f87171';
|
||||
statusDot.className = 'status-dot bg-red';
|
||||
document.getElementById('statusText').textContent = 'Error';
|
||||
document.getElementById('connSubtitle').textContent = 'Connections will be available once ElectrumX has completed syncing.';
|
||||
} else if (data.status === 'synced') {
|
||||
statusText.textContent = 'Fully synchronized with the network';
|
||||
statusText.style.color = '#4ade80';
|
||||
statusTextEl.textContent = 'Fully synchronized with the network';
|
||||
statusTextEl.style.color = '#4ade80';
|
||||
statusDot.className = 'status-dot bg-green';
|
||||
document.getElementById('statusText').textContent = 'Synced';
|
||||
syncIcon.classList.remove('animate-spin-slow');
|
||||
syncIcon.style.color = '#4ade80';
|
||||
document.getElementById('connSubtitle').textContent = 'Use the following details to connect your wallet or application to ElectrumX.';
|
||||
} else {
|
||||
const remaining = networkH - indexedH;
|
||||
statusText.textContent = 'Syncing... ' + remaining.toLocaleString() + ' blocks remaining';
|
||||
statusText.style.color = '#fb923c';
|
||||
var remaining = networkH - indexedH;
|
||||
statusTextEl.textContent = 'Syncing... ' + remaining.toLocaleString() + ' blocks remaining';
|
||||
statusTextEl.style.color = '#fb923c';
|
||||
statusDot.className = 'status-dot bg-yellow';
|
||||
document.getElementById('statusText').textContent = 'Syncing';
|
||||
syncIcon.classList.add('animate-spin-slow');
|
||||
document.getElementById('connSubtitle').textContent = 'Connections will be available once ElectrumX has completed syncing.';
|
||||
}
|
||||
} catch (e) {
|
||||
document.getElementById('syncStatusText').textContent = 'Unable to fetch status: ' + e.message;
|
||||
@@ -196,6 +425,8 @@
|
||||
}
|
||||
|
||||
updateStatus();
|
||||
updateConnectionInfo();
|
||||
fetchTorInfo();
|
||||
setInterval(updateStatus, 5000);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
2297
docker/electrs-ui/qrcode.js
Normal file
2297
docker/electrs-ui/qrcode.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user