Make a nice splash page
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
+181
-1
@@ -1 +1,181 @@
|
||||
hi
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Zooid Relay</title>
|
||||
<link rel="icon" type="image/png" href="/static/logo.png">
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.container {
|
||||
text-align: center;
|
||||
background: white;
|
||||
padding: 3rem 2rem;
|
||||
border-radius: 1rem;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
||||
max-width: 500px;
|
||||
margin: 1rem;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 1.1rem;
|
||||
color: #7f8c8d;
|
||||
margin-bottom: 2rem;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.app-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 1rem 2rem;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
border-radius: 0.5rem;
|
||||
font-weight: 600;
|
||||
font-size: 1.1rem;
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.app-link:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
|
||||
}
|
||||
|
||||
.app-link img {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.relay-info {
|
||||
margin-top: 2rem;
|
||||
padding-top: 2rem;
|
||||
border-top: 1px solid #ecf0f1;
|
||||
font-size: 0.9rem;
|
||||
color: #95a5a6;
|
||||
}
|
||||
|
||||
.relay-url {
|
||||
font-family: 'Courier New', monospace;
|
||||
background: #ecf0f1;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 0.25rem;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
margin-top: 0.5rem;
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 0.25rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #7f8c8d;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
.copy-btn:hover {
|
||||
color: #667eea;
|
||||
}
|
||||
|
||||
.copy-btn svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.toast {
|
||||
position: fixed;
|
||||
bottom: 2rem;
|
||||
left: 50%;
|
||||
transform: translateX(-50%) translateY(100px);
|
||||
background: #2c3e50;
|
||||
color: white;
|
||||
padding: 1rem 2rem;
|
||||
border-radius: 0.5rem;
|
||||
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
|
||||
opacity: 0;
|
||||
transition: all 0.3s ease;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.toast.show {
|
||||
transform: translateX(-50%) translateY(0);
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Zooid Relay</h1>
|
||||
<p>Connect to this relay using your favorite Nostr app.</p>
|
||||
|
||||
<a href="https://app.flotilla.social/" class="app-link" id="app-link">
|
||||
<img src="/static/flotilla.png" alt="Flotilla">
|
||||
Open Flotilla
|
||||
</a>
|
||||
|
||||
<div class="relay-info">
|
||||
<div>WebSocket relay endpoint</div>
|
||||
<div class="relay-url">
|
||||
<span id="relay-url">wss://...</span>
|
||||
<button class="copy-btn" onclick="copyToClipboard()" title="Copy to clipboard">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
||||
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toast" id="toast">Copied to clipboard!</div>
|
||||
|
||||
<script>
|
||||
// Display the current relay URL
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const relayUrl = `${protocol}//${window.location.host}`;
|
||||
document.getElementById('relay-url').textContent = relayUrl;
|
||||
document.getElementById('app-link').href += 'spaces/' + window.location.host;
|
||||
|
||||
// Copy to clipboard function
|
||||
function copyToClipboard() {
|
||||
navigator.clipboard.writeText(relayUrl).then(() => {
|
||||
const toast = document.getElementById('toast');
|
||||
toast.classList.add('show');
|
||||
setTimeout(() => {
|
||||
toast.classList.remove('show');
|
||||
}, 2000);
|
||||
}).catch(err => {
|
||||
console.error('Failed to copy:', err);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -87,6 +87,9 @@ func MakeInstance(filename string) (*Instance, error) {
|
||||
instance.Relay.RejectConnection = instance.RejectConnection
|
||||
instance.Relay.PreventBroadcast = instance.PreventBroadcast
|
||||
|
||||
// Todo: when there's a new version of khatru
|
||||
// instance.Relay.StartExpirationManager()
|
||||
|
||||
// HTTP request handling
|
||||
|
||||
router := instance.Relay.Router()
|
||||
@@ -95,6 +98,8 @@ func MakeInstance(filename string) (*Instance, error) {
|
||||
http.ServeFile(w, r, "templates/index.html")
|
||||
})
|
||||
|
||||
router.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
|
||||
|
||||
// Initialize stuff
|
||||
|
||||
if err := instance.Events.Init(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user