From 6e1b4620d26051da4aec8b808c346d17bb1889df Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 2 Dec 2025 12:58:45 +0000 Subject: improve landing page copy and styles --- src/http/landing.rs | 519 +++++++++++++++++++++---------------------------- templates/landing.html | 236 ++++++++++++---------- 2 files changed, 356 insertions(+), 399 deletions(-) diff --git a/src/http/landing.rs b/src/http/landing.rs index ddde09a..6f2bfdd 100644 --- a/src/http/landing.rs +++ b/src/http/landing.rs @@ -3,14 +3,55 @@ /// Generates HTML landing page for the Nostr relay. use crate::config::Config; +/// Generate the common base CSS used across all pages +fn get_base_css() -> &'static str { + r#":root { + --brand: #4434FF; + --brand-light: #6b5fff; + --bg: #0a0a0f; + --surface: #12121a; + --border: #1e1e2e; + --text: #e4e4eb; + --text-muted: #a8a8bd; + --error: #ff4444; + --success: #22c55e; + } + * { margin: 0; padding: 0; box-sizing: border-box; } + body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif; + line-height: 1.6; + background: var(--bg); + color: var(--text); + min-height: 100vh; + } + a { color: var(--brand-light); text-decoration: none; } + a:hover { text-decoration: underline; } + code { + background: var(--border); + padding: 4px 8px; + border-radius: 4px; + font-family: 'SF Mono', 'Consolas', monospace; + font-size: 0.875rem; + color: var(--brand-light); + } + .footer { + margin-top: 48px; + padding-top: 24px; + border-top: 1px solid var(--border); + text-align: center; + color: var(--text-muted); + font-size: 0.875rem; + }"# +} + /// Generate the HTML landing page pub fn get_html(config: &Config) -> String { format!( include_str!("../../templates/landing.html"), + base_css = get_base_css(), relay_name = config.relay_name, relay_description = config.relay_description, domain = config.domain, - bind_address = config.bind_address, ) } @@ -19,102 +60,63 @@ pub fn get_html(config: &Config) -> String { /// Used for any path that doesn't match a known route pub fn get_generic_404_html(config: &Config, path: &str) -> String { format!( - r#" + r##" Not Found - {relay_name}
-

404

-

Not Found

+
404
+

Page Not Found

The page you're looking for doesn't exist.

-
-

Requested path: {path}

-
- - - - + ← Back to {relay_name} +
-"#, +"##, + base_css = get_base_css(), relay_name = config.relay_name, path = path, ) @@ -125,105 +127,87 @@ pub fn get_generic_404_html(config: &Config, path: &str) -> String { /// GRASP-01: "...and a 404 page for repositories it doesn't host" pub fn get_404_html(config: &Config, npub: &str, identifier: &str) -> String { format!( - r#" + r##" Repository Not Found - {relay_name}
-

404

+
404

Repository Not Found

-

The repository you're looking for doesn't exist on this GRASP server.

- +

This repository doesn't exist on this GRASP server.

-

Owner: {npub}

-

Repository: {identifier}

-
- -

This repository may not have been announced to this server, or the URL may be incorrect.

- - - - +
The repository may not have been announced to this server, or the URL may be incorrect.
+ ← Back to {relay_name} +
-"#, +"##, + base_css = get_base_css(), relay_name = config.relay_name, npub = npub, identifier = identifier, @@ -241,182 +225,129 @@ pub fn get_repo_html(config: &Config, npub: &str, identifier: &str) -> String { ); format!( - r#" + r##" {identifier} - {relay_name}
+
+ +

{identifier}

- -

📦 {identifier}

Git repository hosted on {relay_name}

- -

📋 Repository Information

-
-

Owner: {npub}

-

Repository: {identifier}

+
+
Repository Info
+
+
+ Owner + {npub} +
+
+ Identifier + {identifier} +
+
- -

🔗 Clone this Repository

-
- git clone {clone_url} +
+
Clone
+
+
+ git clone {clone_url} +
+
- -

🌐 Browse with Git Nostr Clients

-

You can browse this repository using these Git Nostr clients:

-
-
- gitworkshop.dev - Web-based repository browser - Visit → +
+
Browse with Git Nostr Clients
+
+
+ gitworkshop.dev + Web-based repository browser +
+ Visit →
-
- ngit - Command-line Git + Nostr tool - GitHub → +
+
+ ngit + Command-line Git + Nostr tool +
+ GitHub →
- -

📚 About GRASP

-

This repository is hosted using the GRASP (Git Relays Authorized via Signed-Nostr Proofs) protocol.

- - - -"#, +"##, + base_css = get_base_css(), relay_name = config.relay_name, npub = npub, identifier = identifier, clone_url = clone_url, ) -} +} \ No newline at end of file diff --git a/templates/landing.html b/templates/landing.html index 84be8ad..bc7ee4f 100644 --- a/templates/landing.html +++ b/templates/landing.html @@ -5,146 +5,172 @@ {relay_name}
-

{relay_name}

+
+ +

{relay_name}

+
+

{relay_description}

-

📡 Connection Information

-
-
Domain:
-
{domain}
- -
WebSocket:
-
ws://{bind_address}/
- -
HTTP:
-
http://{bind_address}/
+
+

Software: ngit-grasp +

+

Git hosting distributed across relays using Nostr to authorise repo creation and git push operations. An implementation of the Grasp Protocol.

-

🔌 Supported NIPs

-
-
    -
  • NIP-01 Basic protocol flow and event structure
  • -
  • NIP-11 Relay information document
  • -
  • NIP-34 Git repository events and announcements
  • -
+ + +
+
Connection
+
+
+ WebSocket + ws://{domain}/ +
+
+ HTTP + http://{domain}/ +
+
-

🎯 GRASP Features

-
-
    -
  • Repository Announcements (kind 30617) - Declare Git repositories with validation
  • -
  • Repository State (kind 30618) - Track repository state changes
  • -
  • NIP-34 Validation - Automatic validation of repository events
  • -
  • Git HTTP Backend - Coming soon in Phase 2
  • -
+
+
Supported GRASPs
+
+
GRASP-01Nostr Authorised HTTP Git Server
+
with embedded Nostr Relay
+
-

📚 Documentation

-

For more information about GRASP (Git Relays Authorized via Signed-Nostr Proofs):

- +
+
Supported NIPs
+
+
NIP-01 Basic Protocol
+
Core Nostr protocol flow and event structure
+
+
+
NIP-11 Relay Information
+
Relay metadata and capabilities document
+
+
+
NIP-34 Git Events
+
Repository announcements and state tracking
+
+
+ +
+
Documentation
+ +
-- cgit v1.2.3