Sync workspace source: rank tracker module + routes, Grid DB admin page, flaskfactory AI probe + analytics zone, nav.js v16 Blog pill, template refresh
c8c30b4 Download templates/admin_users.html from deanpowers/blind-monkeys: direct link, hf CLI and curl.
- Browser
- Download file 13.4 kB
-
https://huggingface.co/deanpowers/blind-monkeys/resolve/main/templates/admin_users.html
- Command line
-
hf download hf://deanpowers/blind-monkeys/templates/admin_users.html
-
curl -L -o admin_users.html https://huggingface.co/deanpowers/blind-monkeys/resolve/main/templates/admin_users.html
13.4 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Users — Admin</title> | |
| <link rel="stylesheet" href="/css/nav.css?v=4"> | |
| <style> | |
| * { box-sizing: border-box; } | |
| body { background: #0d1117; color: #e6edf3; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; margin: 0; } | |
| .page-content { max-width: 1100px; margin: 0 auto; padding: 32px 20px; } | |
| h1 { font-size: 24px; margin: 0 0 4px; } | |
| .sub { color: #8b949e; font-size: 14px; margin-bottom: 24px; } | |
| .card { background: #1e2329; border: 2px solid #30363d; border-radius: 12px; padding: 20px; margin-bottom: 20px; } | |
| .card h2 { font-size: 14px; color: #f0b90b; margin: 0 0 16px; letter-spacing: 1px; text-transform: uppercase; } | |
| table { width: 100%; border-collapse: collapse; } | |
| th { text-align: left; padding: 10px 8px; color: #8b949e; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid #30363d; } | |
| td { padding: 12px 8px; border-bottom: 1px solid #21262d; font-size: 14px; } | |
| tr:last-child td { border-bottom: none; } | |
| .badge { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; } | |
| .badge-pending { background: #3a2a1a; color: #f0b90b; border: 1px solid #f0b90b; } | |
| .badge-active { background: #1a3a1a; color: #4ade80; border: 1px solid #4ade80; } | |
| .badge-rejected { background: #3a1a1a; color: #f87171; border: 1px solid #f87171; } | |
| .badge-admin { background: #2a1a3a; color: #a78bfa; border: 1px solid #a78bfa; margin-left: 6px; } | |
| .btn-mini { padding: 6px 14px; border-radius: 6px; font-size: 12px; font-weight: 700; cursor: pointer; border: none; font-family: inherit; margin-right: 6px; } | |
| .btn-approve { background: #1a3a1a; color: #4ade80; border: 1px solid #4ade80; } | |
| .btn-approve:hover { background: #4ade80; color: #0d1117; } | |
| .btn-reject { background: #3a1a1a; color: #f87171; border: 1px solid #f87171; } | |
| .btn-reject:hover { background: #f87171; color: #0d1117; } | |
| .btn-del { background: transparent; color: #8b949e; border: 1px solid #30363d; } | |
| .btn-del:hover { border-color: #f87171; color: #f87171; } | |
| .empty { color: #8b949e; font-size: 14px; padding: 16px 0; text-align: center; } | |
| .mono { font-family: 'SF Mono', Monaco, monospace; font-size: 12px; color: #8b949e; } | |
| </style> | |
| <link rel="icon" type="image/svg+xml" href="/static/favicon.svg"> | |
| </head> | |
| <body> | |
| <nav class="nav-bar"> | |
| <div class="nav-brand">🙈 Blind Monkeys</div> | |
| <div class="nav-links"> | |
| <a href="/" class="nav-link">🏠 Home</a> | |
| <a href="/scan/" class="nav-link">🔍 Scan</a> | |
| <a href="/settings/" class="nav-link">⚙️ Settings</a> | |
| </div> | |
| </nav> | |
| <div class="page-content"> | |
| <h1>👥 Users</h1> | |
| <div class="sub">Approve or reject registration requests</div> | |
| <div class="card" id="pending-card" style="display:none;"> | |
| <h2>⏳ Pending Approval <span id="pending-count"></span></h2> | |
| <div id="pending-content"><div class="empty">Loading…</div></div> | |
| </div> | |
| <div class="card"> | |
| <h2>✅ Active Users</h2> | |
| <div id="active-content"><div class="empty">Loading…</div></div> | |
| </div> | |
| <div class="card"> | |
| <h2>❌ Rejected</h2> | |
| <div id="rejected-content"><div class="empty">None</div></div> | |
| </div> | |
| </div> | |
| <script> | |
| window.ALL_USERS = []; | |
| function fmtDate(ts) { | |
| if (!ts) return '—'; | |
| var d = new Date(ts * 1000); | |
| return d.toLocaleString(); | |
| } | |
| function renderUsers() { | |
| fetch('/api/admin/users').then(function(r){ return r.json(); }).then(function(d){ | |
| var users = d.users || []; | |
| window.ALL_USERS = users; | |
| var pending = users.filter(function(u){ return u.status === 'pending'; }); | |
| var active = users.filter(function(u){ return u.status === 'active'; }); | |
| var rejected = users.filter(function(u){ return u.status === 'rejected'; }); | |
| // Pending | |
| var pc = document.getElementById('pending-card'); | |
| var pcl = document.getElementById('pending-count'); | |
| var pcC = document.getElementById('pending-content'); | |
| if (pending.length > 0) { | |
| pc.style.display = 'block'; | |
| pcl.textContent = '(' + pending.length + ')'; | |
| pcC.innerHTML = renderTable(pending, 'pending'); | |
| } else { | |
| pc.style.display = 'none'; | |
| } | |
| document.getElementById('active-content').innerHTML = | |
| active.length ? renderTable(active, 'active') : '<div class="empty">No active users</div>'; | |
| document.getElementById('rejected-content').innerHTML = | |
| rejected.length ? renderTable(rejected, 'rejected') : '<div class="empty">None</div>'; | |
| }); | |
| } | |
| function renderTable(users, mode) { | |
| var html = '<table><thead><tr><th>Name</th><th>Email</th><th>Role</th><th>Status</th><th>Created</th><th></th></tr></thead><tbody>'; | |
| users.forEach(function(u){ | |
| var name = ((u.first_name || '') + ' ' + (u.last_name || '')).trim() || '—'; | |
| html += '<tr>'; | |
| html += '<td><strong>' + name + '</strong></td>'; | |
| html += '<td class="mono">' + u.email + '</td>'; | |
| html += '<td>' + (u.role === 'admin' ? '<span class="badge badge-admin">admin</span>' : 'user') + '</td>'; | |
| html += '<td><span class="badge badge-' + u.status + '">' + u.status + '</span></td>'; | |
| html += '<td class="mono">' + fmtDate(u.created_at) + '</td>'; | |
| html += '<td style="text-align:right;white-space:nowrap;">'; | |
| if (mode === 'pending') { | |
| html += '<button class="btn-mini btn-approve" onclick="approveUser(\'' + u.email + '\')">✅ Approve</button>'; | |
| html += '<button class="btn-mini btn-reject" onclick="rejectUser(\'' + u.email + '\')">❌ Reject</button>'; | |
| } else if (mode === 'rejected') { | |
| html += '<button class="btn-mini btn-approve" onclick="approveUser(\'' + u.email + '\')">♻️ Re-approve</button>'; | |
| html += '<button class="btn-mini btn-del" onclick="deleteUser(\'' + u.email + '\')">🗑</button>'; | |
| } else { | |
| html += '<button class="btn-mini btn-del" onclick="deleteUser(\'' + u.email + '\')">🗑</button>'; | |
| } | |
| html += '</td></tr>'; | |
| }); | |
| html += '</tbody></table>'; | |
| return html; | |
| } | |
| var MODAL = { | |
| email: null, | |
| action: null, | |
| userMessage: '' | |
| }; | |
| function approveUser(email) { | |
| openModal(email, 'approve'); | |
| } | |
| function rejectUser(email) { | |
| openModal(email, 'reject'); | |
| } | |
| function openModal(email, action) { | |
| var u = (ALL_USERS || []).find(function(x){ return x.email === email; }); | |
| MODAL.email = email; | |
| MODAL.action = action; | |
| MODAL.userMessage = (u && u.reg_message) ? u.reg_message : ''; | |
| var isApprove = action === 'approve'; | |
| document.getElementById('modal-title').textContent = isApprove ? '\u2705 Approve user' : '\u274C Reject user'; | |
| document.getElementById('modal-sub').innerHTML = 'Reviewing: <strong>' + email + '</strong>'; | |
| var msgWrap = document.getElementById('modal-user-msg-wrap'); | |
| if (MODAL.userMessage) { | |
| msgWrap.style.display = 'block'; | |
| document.getElementById('modal-user-msg').textContent = MODAL.userMessage; | |
| } else { | |
| msgWrap.style.display = 'none'; | |
| } | |
| var btn = document.getElementById('modal-confirm'); | |
| btn.textContent = isApprove ? 'Approve & Send' : 'Reject & Send'; | |
| btn.style.background = isApprove ? '#4ade80' : '#f87171'; | |
| document.getElementById('modal-note').value = 'Welcome to Blind Monkeys. Your account is now active. Scan coins at blindmonkeys.org/scan — no wallet required, we never hold your funds. Reply here if you have questions.'; | |
| document.getElementById('modal-note-count').textContent = document.getElementById('modal-note').value.length; | |
| document.getElementById('modal-error').style.display = 'none'; | |
| document.getElementById('review-modal').style.display = 'flex'; | |
| setTimeout(function(){ document.getElementById('modal-note').focus(); }, 50); | |
| } | |
| function closeModal() { | |
| document.getElementById('review-modal').style.display = 'none'; | |
| MODAL.email = null; | |
| MODAL.action = null; | |
| } | |
| function submitModal() { | |
| var note = document.getElementById('modal-note').value.trim(); | |
| var errEl = document.getElementById('modal-error'); | |
| if (!note) { | |
| errEl.textContent = 'A message is required.'; | |
| errEl.style.display = 'block'; | |
| return; | |
| } | |
| if (note.length > 500) { | |
| errEl.textContent = 'Message must be 500 characters or fewer.'; | |
| errEl.style.display = 'block'; | |
| return; | |
| } | |
| var url = '/api/admin/users/' + encodeURIComponent(MODAL.email) + '/' + MODAL.action; | |
| fetch(url, { | |
| method: 'POST', | |
| headers: {'Content-Type': 'application/json'}, | |
| body: JSON.stringify({note: note}) | |
| }) | |
| .then(function(r){ return r.json(); }) | |
| .then(function(d){ | |
| if (d.error) { | |
| errEl.textContent = d.error; | |
| errEl.style.display = 'block'; | |
| return; | |
| } | |
| closeModal(); | |
| renderUsers(); | |
| }) | |
| .catch(function(e){ | |
| errEl.textContent = 'Request failed: ' + e.message; | |
| errEl.style.display = 'block'; | |
| }); | |
| } | |
| document.addEventListener('DOMContentLoaded', function() { | |
| var c = document.getElementById('modal-cancel'); | |
| var cf = document.getElementById('modal-confirm'); | |
| var nt = document.getElementById('modal-note'); | |
| var nc = document.getElementById('modal-note-count'); | |
| if (c) c.addEventListener('click', closeModal); | |
| if (cf) cf.addEventListener('click', submitModal); | |
| if (nt && nc) nt.addEventListener('input', function(){ nc.textContent = this.value.length; }); | |
| var modal = document.getElementById('review-modal'); | |
| if (modal) modal.addEventListener('click', function(e){ if (e.target === modal) closeModal(); }); | |
| }); | |
| function deleteUser(email) { | |
| if (!confirm('Permanently delete ' + email + '?')) return; | |
| fetch('/api/admin/users/' + encodeURIComponent(email), {method: 'DELETE'}) | |
| .then(function(r){ return r.json(); }) | |
| .then(function(d){ | |
| if (d.error) alert(d.error); | |
| else renderUsers(); | |
| }); | |
| } | |
| document.addEventListener('DOMContentLoaded', renderUsers); | |
| </script> | |
| <script src="/css/nav.js?v=16"></script> | |
| <div id="review-modal" style="display:none;position:fixed;inset:0;background:rgba(0,0,0,0.7);z-index:1000;align-items:center;justify-content:center;padding:20px;"> | |
| <div style="background:#1e2329;border:2px solid #f0b90b;border-radius:14px;padding:24px;max-width:520px;width:100%;"> | |
| <h3 id="modal-title" style="margin:0 0 6px;color:#f0b90b;font-size:18px;">Approve user</h3> | |
| <div id="modal-sub" style="font-size:13px;color:#8b949e;margin-bottom:18px;"></div> | |
| <div id="modal-user-msg-wrap" style="display:none;margin-bottom:16px;"> | |
| <label style="display:block;font-size:11px;color:#8b949e;font-weight:700;letter-spacing:0.5px;text-transform:uppercase;margin-bottom:6px;">Message from user</label> | |
| <div id="modal-user-msg" style="background:#0d1117;border:1px solid #30363d;border-radius:8px;padding:12px 14px;font-size:14px;color:#e6edf3;line-height:1.5;white-space:pre-wrap;"></div> | |
| </div> | |
| <label style="display:block;font-size:11px;color:#8b949e;font-weight:700;letter-spacing:0.5px;text-transform:uppercase;margin-bottom:6px;">Your message <span style="color:#f87171;">*</span></label> | |
| <textarea id="modal-note" rows="3" maxlength="500" placeholder="This message will be included with the notification" style="width:100%;padding:11px 14px;background:#0d1117;border:2px solid #30363d;border-radius:8px;color:#e6edf3;font-size:14px;font-family:inherit;resize:vertical;"></textarea> | |
| <div style="text-align:right;font-size:11px;color:#8b949e;margin-top:4px;margin-bottom:16px;"><span id="modal-note-count">0</span> / 500</div> | |
| <div id="modal-error" style="display:none;background:#3a1a1a;border:1px solid #f87171;color:#f87171;padding:8px 12px;border-radius:6px;font-size:13px;margin-bottom:12px;"></div> | |
| <div style="display:flex;gap:10px;justify-content:flex-end;"> | |
| <button id="modal-cancel" style="padding:10px 18px;background:#0d1117;color:#e6edf3;border:1px solid #30363d;border-radius:8px;font-size:14px;font-weight:600;cursor:pointer;font-family:inherit;">Cancel</button> | |
| <button id="modal-confirm" style="padding:10px 18px;border:none;border-radius:8px;font-size:14px;font-weight:700;cursor:pointer;font-family:inherit;color:#0d1117;">Confirm</button> | |
| </div> | |
| </div> | |
| </div> | |
| <!--Start of Tawk.to Script--> | |
| <script type="text/javascript"> | |
| var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date(); | |
| (function(){ | |
| var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0]; | |
| s1.async=true; | |
| s1.src='https://embed.tawk.to/6ad326872ab00434d21793a2/1k54ic9h0'; | |
| s1.charset='UTF-8'; | |
| s1.setAttribute('crossorigin','*'); | |
| s0.parentNode.insertBefore(s1,s0); | |
| })(); | |
| </script> | |
| <!--End of Tawk.to Script--> | |
| </body> | |
| </html> | |