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

host page blah blah

Changed files
+27 -4
who-am-i
+14
who-am-i/demo/index.html
···
···
+
<!doctype html>
+
<style>
+
body {
+
background: #333;
+
color: #ccc;
+
font-family: sans-serif;
+
}
+
</style>
+
+
<h1>hey</h1>
+
+
<iframe src="http://127.0.0.1:9997/prompt" style="border: 2px solid #000; border-radius: 0.5em;" />
+
+
+4
who-am-i/demo/serve
···
···
+
#!/usr/bin/env bash
+
+
echo "note: you might need to access via http://127.0.0.1:8888 (not localhost) for the iframe to get its cookies"
+
python3 -m http.server 8888
+9 -4
who-am-i/src/server.rs
···
use axum::{
Router,
extract::{FromRef, Query, State},
-
response::{Html, Redirect},
routing::get,
};
-
use axum_extra::extract::cookie::{Cookie, Key, SignedCookieJar};
use serde::Deserialize;
use std::sync::Arc;
···
}
}
-
async fn prompt(jar: SignedCookieJar) -> (SignedCookieJar, Html<String>) {
let m = if let Some(did) = jar.get("did") {
format!("oh i know you: {did}")
} else {
···
panic!("failed to do client callback");
};
let did = oauth_session.did().await.expect("a did to be present");
-
let jar = jar.add(Cookie::new("did", did.to_string()));
(jar, Html(format!("sup: {did:?}")))
}
···
use axum::{
Router,
extract::{FromRef, Query, State},
+
response::{Html, IntoResponse, Redirect},
routing::get,
};
+
use axum_extra::extract::cookie::{Cookie, Key, SameSite, SignedCookieJar};
use serde::Deserialize;
use std::sync::Arc;
···
}
}
+
async fn prompt(jar: SignedCookieJar) -> impl IntoResponse {
let m = if let Some(did) = jar.get("did") {
format!("oh i know you: {did}")
} else {
···
panic!("failed to do client callback");
};
let did = oauth_session.did().await.expect("a did to be present");
+
let cookie = Cookie::build(("did", did.to_string()))
+
.http_only(true)
+
.secure(true)
+
.same_site(SameSite::None)
+
.max_age(std::time::Duration::from_secs(86_400).try_into().unwrap());
+
let jar = jar.add(cookie);
(jar, Html(format!("sup: {did:?}")))
}
who-am-i/static/prompt-anon.html

This is a binary file and will not be displayed.