update
This commit is contained in:
@@ -1,44 +1,189 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>NIP-07 Proxy</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
padding: 20px;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
.container {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
.status-box {
|
||||
background: #f9f9f9;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
margin: 10px 0;
|
||||
border-left: 4px solid #ccc;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>NIP-07 Proxy</h1></h1>
|
||||
<p>This page acts</p> as a proxy between your native application and the NIP-07 browser extension.</p>
|
||||
<div class="status-box">
|
||||
<strong></strong>Status:</strong> <span id="nip07-proxy-status">Checking...</span>
|
||||
</div>
|
||||
<p><small></small>Keep this tab open while using your application. The page will automatically poll for requests from your native app.</small></p>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Coop — Web Signer Proxy</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@800;900&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--brand: #F8FF37;
|
||||
--ink: #111111;
|
||||
--ink-soft: #333333;
|
||||
--muted: #666666;
|
||||
--paper: #FFFFFF;
|
||||
--edge: rgba(17, 17, 17, 0.14);
|
||||
--radius-sm: 1rem;
|
||||
--radius-md: 1.5rem;
|
||||
--radius-lg: 2.5rem;
|
||||
--green: #2E8B57;
|
||||
--red: #D32F2F;
|
||||
}
|
||||
|
||||
<h3>Debug</h3> Info</h3>
|
||||
<p><small>Check</small> the browser console (F12) for detailed logs.</small></p>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
color: var(--ink);
|
||||
background: var(--brand);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: var(--paper);
|
||||
border-radius: var(--radius-md);
|
||||
padding: 2.5rem;
|
||||
max-width: 440px;
|
||||
width: 100%;
|
||||
box-shadow: 0 8px 0 rgba(17, 17, 17, 0.12), 0 2px 20px rgba(17, 17, 17, 0.06);
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
margin-bottom: 1.75rem;
|
||||
}
|
||||
|
||||
.logo__mark {
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
background: var(--ink);
|
||||
border-radius: var(--radius-sm);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-family: "Nunito", system-ui, sans-serif;
|
||||
font-weight: 900;
|
||||
font-size: 1.2rem;
|
||||
color: var(--brand);
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.logo__text {
|
||||
font-family: "Nunito", system-ui, sans-serif;
|
||||
font-weight: 900;
|
||||
font-size: 1.3rem;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.heading {
|
||||
font-family: "Nunito", system-ui, sans-serif;
|
||||
font-weight: 900;
|
||||
font-size: 1.6rem;
|
||||
letter-spacing: -0.03em;
|
||||
line-height: 1.15;
|
||||
margin: 0 0 0.6rem;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 0.95rem;
|
||||
color: var(--ink-soft);
|
||||
margin: 0 0 1.75rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 1rem 1.25rem;
|
||||
border-radius: var(--radius-sm);
|
||||
font-weight: 600;
|
||||
font-size: 0.95rem;
|
||||
transition: background 300ms ease, color 300ms ease;
|
||||
}
|
||||
|
||||
.status--checking {
|
||||
background: rgba(17, 17, 17, 0.05);
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.status--connected {
|
||||
background: rgba(46, 139, 87, 0.1);
|
||||
color: var(--green);
|
||||
}
|
||||
|
||||
.status--error {
|
||||
background: rgba(211, 47, 47, 0.08);
|
||||
color: var(--red);
|
||||
}
|
||||
|
||||
.status__dot {
|
||||
width: 0.7rem;
|
||||
height: 0.7rem;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.status--checking .status__dot {
|
||||
background: var(--muted);
|
||||
animation: pulse 1.2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.status--connected .status__dot {
|
||||
background: var(--green);
|
||||
}
|
||||
|
||||
.status--error .status__dot {
|
||||
background: var(--red);
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0%, 100% { opacity: 0.4; transform: scale(0.85); }
|
||||
50% { opacity: 1; transform: scale(1); }
|
||||
}
|
||||
|
||||
.hint {
|
||||
margin-top: 1.5rem;
|
||||
padding-top: 1.25rem;
|
||||
border-top: 1px solid var(--edge);
|
||||
font-size: 0.8rem;
|
||||
color: var(--muted);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.hint strong {
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="card">
|
||||
<div class="logo">
|
||||
<div class="logo__mark">C</div>
|
||||
<span class="logo__text">Coop</span>
|
||||
</div>
|
||||
|
||||
<script src="proxy.js"></script>
|
||||
</body>
|
||||
<h1 class="heading">Web Signer</h1>
|
||||
<p class="subtitle">
|
||||
This page connects the app to your Nostr Web Signer extension so you can sign in and use Coop securely.
|
||||
</p>
|
||||
|
||||
<div id="nip07-status" class="status status--checking">
|
||||
<div class="status__dot"></div>
|
||||
<span id="nip07-status-text">Checking extension…</span>
|
||||
</div>
|
||||
|
||||
<div class="hint">
|
||||
<strong>Keep this tab open</strong> while using the app — it automatically handles sign-in requests in the background.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="proxy.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -129,13 +129,12 @@ async function handleNip07Request(request) {
|
||||
}
|
||||
}
|
||||
|
||||
function updateStatus(message, status) {
|
||||
const statusEl = document.getElementById('nip07-proxy-status');
|
||||
if (statusEl) {
|
||||
statusEl.textContent = message;
|
||||
statusEl.style = status === "connected" ?
|
||||
"color: green; font-weight: bold;" :
|
||||
"color: red; font-weight: bold;";
|
||||
function updateStatus(message, state) {
|
||||
const container = document.getElementById('nip07-status');
|
||||
const textEl = document.getElementById('nip07-status-text');
|
||||
if (container && textEl) {
|
||||
container.className = 'status status--' + state;
|
||||
textEl.textContent = message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,10 +145,10 @@ window.addEventListener('load', () => {
|
||||
// Check if NIP-07 extension is available
|
||||
if (window.nostr) {
|
||||
console.log('NIP-07 extension detected');
|
||||
updateStatus('Connected to NIP-07 extension - Ready', 'connected');
|
||||
updateStatus('Connected — ready', 'connected');
|
||||
} else {
|
||||
console.log('NIP-07 extension not found');
|
||||
updateStatus('NIP-07 extension not found', 'error');
|
||||
updateStatus('No NIP-07 extension found', 'error');
|
||||
}
|
||||
|
||||
// Start polling every 500 ms
|
||||
|
||||
Reference in New Issue
Block a user