Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm

custom scalar template

Changed files
+59 -4
slingshot
+2
Cargo.lock
···
"headers",
"http",
"http-body-util",
"hyper",
"hyper-util",
"mime",
"multer",
"nix",
"parking_lot",
···
"headers",
"http",
"http-body-util",
+
"httpdate",
"hyper",
"hyper-util",
"mime",
+
"mime_guess",
"multer",
"nix",
"parking_lot",
+1 -1
slingshot/Cargo.toml
···
log = "0.4.27"
metrics = "0.24.2"
metrics-exporter-prometheus = { version = "0.17.1", features = ["http-listener"] }
-
poem = { version = "3.1.12", features = ["acme"] }
poem-openapi = { version = "5.1.16", features = ["scalar"] }
reqwest = { version = "0.12.22", features = ["json"] }
rustls = "0.23.31"
···
log = "0.4.27"
metrics = "0.24.2"
metrics-exporter-prometheus = { version = "0.17.1", features = ["http-listener"] }
+
poem = { version = "3.1.12", features = ["acme", "static-files"] }
poem-openapi = { version = "5.1.16", features = ["scalar"] }
reqwest = { version = "0.12.22", features = ["json"] }
rustls = "0.23.31"
+3 -3
slingshot/src/server.rs
···
use poem::{
Endpoint, EndpointExt, Route, Server,
-
endpoint::make_sync,
http::Method,
listener::{
Listener, TcpListener,
···
));
let mut app = Route::new()
-
.nest("/", api_service.scalar())
-
.nest("/openapi.json", api_service.spec_endpoint())
.nest("/xrpc/", api_service);
if let Some(host) = host {
···
use poem::{
Endpoint, EndpointExt, Route, Server,
+
endpoint::{StaticFileEndpoint, make_sync},
http::Method,
listener::{
Listener, TcpListener,
···
));
let mut app = Route::new()
+
.at("/", StaticFileEndpoint::new("./static/index.html"))
+
.nest("/openapi", api_service.spec_endpoint())
.nest("/xrpc/", api_service);
if let Some(host) = host {
+53
slingshot/static/index.html
···
···
+
<!doctype html>
+
<html lang="en">
+
<head>
+
<meta charset="utf-8" />
+
<title>Slingshot: atproto edge record cache</title>
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
+
<meta name="description" content="API Documentation for Slingshot, a firehose-listening atproto edge record and identity cache." />
+
<style>
+
.custom-header {
+
height: 42px;
+
background-color: #221828;
+
box-shadow: inset 0 -1px 0 var(--scalar-border-color);
+
color: var(--scalar-color-1);
+
font-size: var(--scalar-font-size-3);
+
font-family: 'Iowan Old Style', 'Palatino Linotype', 'URW Palladio L', P052, serif;
+
padding: 0 18px;
+
justify-content: space-between;
+
}
+
.custom-header,
+
.custom-header nav {
+
display: flex;
+
align-items: center;
+
gap: 18px;
+
}
+
.custom-header a:hover {
+
color: var(--scalar-color-2);
+
}
+
</style>
+
</head>
+
<body>
+
<header class="custom-header scalar-app">
+
<p>
+
TODO: thing
+
</p>
+
<nav>
+
<b>a <a href="https://microcosm.blue">microcosm</a> project</b>
+
<a href="https://bsky.app/profile/microcosm.blue">@microcosm.blue</a>
+
<a href="https://github.com/at-microcosm">github</a>
+
</nav>
+
</header>
+
+
<script id="api-reference" type="application/json" data-url="/openapi"></script>
+
+
<script>
+
var configuration = {
+
theme: 'purple',
+
}
+
document.getElementById('api-reference').dataset.configuration = JSON.stringify(configuration)
+
</script>
+
+
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
+
</body>
+
</html>