mirror of
https://github.com/astro/buzzrelay.git
synced 2024-12-23 10:50:29 +00:00
add homepage
This commit is contained in:
parent
249764acae
commit
def1e2bf3c
4 changed files with 149 additions and 4 deletions
10
src/main.rs
10
src/main.rs
|
@ -1,12 +1,13 @@
|
|||
use axum::{
|
||||
extract::{FromRef, Path, Query},
|
||||
http::{StatusCode},
|
||||
http::StatusCode,
|
||||
response::{IntoResponse, Response},
|
||||
routing::{get}, Json, Router,
|
||||
routing::get, Json, Router,
|
||||
};
|
||||
use axum_extra::routing::SpaRouter;
|
||||
use metrics::increment_counter;
|
||||
use metrics_util::MetricKindMask;
|
||||
use metrics_exporter_prometheus::{PrometheusBuilder};
|
||||
use metrics_exporter_prometheus::PrometheusBuilder;
|
||||
use serde_json::json;
|
||||
use sigh::{PrivateKey, PublicKey};
|
||||
use std::{net::SocketAddr, sync::Arc, time::Duration, collections::HashMap};
|
||||
|
@ -287,7 +288,8 @@ async fn main() {
|
|||
hostname,
|
||||
priv_key: config.priv_key(),
|
||||
pub_key: config.pub_key(),
|
||||
});
|
||||
})
|
||||
.merge(SpaRouter::new("/", "static"));
|
||||
|
||||
let addr = SocketAddr::from(([127, 0, 0, 1], config.listen_port));
|
||||
let server = axum::Server::bind(&addr)
|
||||
|
|
72
static/index.html
Normal file
72
static/index.html
Normal file
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xml:lang="en">
|
||||
<head>
|
||||
<title>#FediBuzz Relay</title>
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="robots" content="index,follow"/>
|
||||
<meta name="description" content="The buzzing ActivityPub relay service"/>
|
||||
<meta name="keywords" content="activitypub relay fedibuzz"/>
|
||||
<meta name="language" content="en"/>
|
||||
<meta name="author" content="Astro"/>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>#FediBuzz Relay</h1>
|
||||
<p>The buzzing ActivityPub relay service</p>
|
||||
</header>
|
||||
|
||||
<section>
|
||||
<p>
|
||||
Mastodon and many other ActivityPub-compatible services live
|
||||
and breathe decentralization. Mastoadmins can still bring the
|
||||
global buzz of toots into the <b>Federated Timeline</b> of their
|
||||
small server by following <b>ActivityPub relays</b>.
|
||||
</p>
|
||||
<p>
|
||||
With this service <a href="https://fedi.buzz/">#FediBuzz</a>
|
||||
provides relay endpoints for you to customize. In Mastodon's
|
||||
<b>preferences</b> go to:
|
||||
</p>
|
||||
<ol>
|
||||
<li>Administration</li>
|
||||
<li>Relay</li>
|
||||
<li>Click the button to setup a new relay</li>
|
||||
<li>Generate a relay address below</li>
|
||||
<li>Copy & paste into Mastodon's preferences</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<section class="boxes">
|
||||
<noscript>
|
||||
<h2>
|
||||
Please enable JavaScript!
|
||||
</h2>
|
||||
</noscript>
|
||||
<article>
|
||||
<h2>Follow posts by #tag</h2>
|
||||
<div>
|
||||
<input id="tag" len="20" placeholder="tag"/>
|
||||
</div>
|
||||
<pre id="tag-url"></pre>
|
||||
</article>
|
||||
<article>
|
||||
<h2>Follow posts by instance</h2>
|
||||
<div>
|
||||
<input id="instance" len="20" placeholder="example.xyz"/>
|
||||
</div>
|
||||
<pre id="instance-url"></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
<p>
|
||||
run by <a rel="me" href="https://c3d2.social/@astro">@astro­@c3d2.social</a>
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
<script type="text/javascript" src="urlgen.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
52
static/style.css
Normal file
52
static/style.css
Normal file
|
@ -0,0 +1,52 @@
|
|||
body {
|
||||
background-color: #DFCFEF;
|
||||
color: #1F2F4F;
|
||||
font-family: sans-serif;
|
||||
margin: 0;
|
||||
}
|
||||
a {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: #9F2F1F;
|
||||
}
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 300%;
|
||||
}
|
||||
h2 {
|
||||
}
|
||||
p, ol {
|
||||
margin: 2rem auto;
|
||||
max-width: 30rem;
|
||||
padding: 0;
|
||||
line-height: 2em;
|
||||
}
|
||||
li {
|
||||
margin: 0.5rem;
|
||||
padding: 0;
|
||||
list-style-type: disclosure-closed;
|
||||
}
|
||||
|
||||
.boxes {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.boxes article {
|
||||
background-color: #EFDFFF;
|
||||
padding: 0.5rem 1rem;
|
||||
text-align: center;
|
||||
margin: 1rem 0.5rem;
|
||||
min-width: 25rem;
|
||||
}
|
||||
.boxes article pre {
|
||||
margin: 1rem 0;
|
||||
padding: 0.5rem;
|
||||
background-color: #DFCFEF;
|
||||
}
|
||||
|
||||
footer {
|
||||
margin-top: 8rem;
|
||||
text-align: center;
|
||||
}
|
19
static/urlgen.js
Normal file
19
static/urlgen.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
(function() {
|
||||
function setup(id) {
|
||||
var inputEl = document.getElementById(id);
|
||||
var preEl = document.getElementById(id + "-url");
|
||||
function onChange(ev) {
|
||||
setTimeout(function() {
|
||||
var value = encodeURIComponent(inputEl.value.replace(/^#/, ""));
|
||||
preEl.innerText = value ?
|
||||
"https://relay.fedi.buzz/" + id + "/" + value :
|
||||
"";
|
||||
}, 10);
|
||||
}
|
||||
inputEl.addEventListener('change', onChange);
|
||||
inputEl.addEventListener('keyup', onChange);
|
||||
}
|
||||
|
||||
setup("tag");
|
||||
setup("instance");
|
||||
})()
|
Loading…
Reference in a new issue