feat: index page
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-04-03 14:16:40 +01:00
parent c432f603ec
commit 4dfc33bca2
2 changed files with 55 additions and 1 deletions

47
lnvps_nostr/index.html Normal file
View File

@ -0,0 +1,47 @@
<!doctype html>
<html lang="en">
<head>
<title>LNVPS</title>
<meta charset="UTF-8"/>
<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=Source+Code+Pro:ital,wght@0,200..900;1,200..900&display=swap"
rel="stylesheet"
/>
<style>
html, body {
margin: 0;
font-size: 15px;
font-family: "Source Code Pro", monospace;
color: white;
background-color: black;
}
.page {
margin-left: 4rem;
margin-right: 4rem;
}
.header {
display: flex;
gap: 2rem;
align-items: center;
justify-content: space-between;
font-size: 3rem;
margin: 2rem 0;
}
</style>
</head>
<body>
<div class="page">
<div class="header">
LNVPS
<img height="48" width="48" src="https://lnvps.net/logo.jpg" alt="logo"/>
</div>
<hr/>
<p>This domain is using LNVPS' free NIP-05 hosting, get your own at <a href="https://lnvps.net">LNVPS.net</a></p>
</div>
</body>
</html>

View File

@ -6,9 +6,10 @@ use rocket::{Request, Route, State, routes};
use serde::Serialize;
use std::collections::HashMap;
use std::sync::Arc;
use rocket::http::ContentType;
pub fn routes() -> Vec<Route> {
routes![nostr_address]
routes![get_index, nostr_address]
}
#[derive(Serialize)]
@ -32,6 +33,12 @@ impl<'r> FromRequest<'r> for HostInfo<'r> {
}
}
#[rocket::get("/", format = "html")]
fn get_index() -> (ContentType, &'static str) {
const HTML: &str = include_str!("../index.html");
(ContentType::HTML, HTML)
}
#[rocket::get("/.well-known/nostr.json?<name>")]
async fn nostr_address(
host: HostInfo<'_>,