From 568f98589b6c30bb3f807517d28039b12dd54be3 Mon Sep 17 00:00:00 2001 From: Vika Date: Sun, 2 Oct 2022 11:54:30 +0300 Subject: companion-lite: rewrite to use IndieAuth This is a naive implementation that doesn't have some security checks. It's ok tho, should work fine... can refine it later --- kittybox-rs/src/frontend/mod.rs | 5 ++++- kittybox-rs/src/lib.rs | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'kittybox-rs/src') diff --git a/kittybox-rs/src/frontend/mod.rs b/kittybox-rs/src/frontend/mod.rs index 6b4bdae..970a09b 100644 --- a/kittybox-rs/src/frontend/mod.rs +++ b/kittybox-rs/src/frontend/mod.rs @@ -280,7 +280,9 @@ const ONBOARDING_CSS: &[u8] = include_bytes!("./onboarding.css"); const INDIEAUTH_JS: &[u8] = include_bytes!(concat!( env!("OUT_DIR"), "/", "kittybox_js", "/", "indieauth.js" )); - +const LIB_JS: &[u8] = include_bytes!(concat!( + env!("OUT_DIR"), "/", "kittybox_js", "/", "lib.js" +)); const MIME_JS: &str = "application/javascript"; const MIME_CSS: &str = "text/css"; const MIME_PLAIN: &str = "text/plain"; @@ -293,6 +295,7 @@ pub async fn statics(Path(name): Path) -> impl IntoResponse { "onboarding.js" => (StatusCode::OK, [(CONTENT_TYPE, MIME_JS)], ONBOARDING_JS), "onboarding.css" => (StatusCode::OK, [(CONTENT_TYPE, MIME_CSS)], ONBOARDING_CSS), "indieauth.js" => (StatusCode::OK, [(CONTENT_TYPE, MIME_JS)], INDIEAUTH_JS), + "lib.js" => (StatusCode::OK, [(CONTENT_TYPE, MIME_JS)], LIB_JS), _ => ( StatusCode::NOT_FOUND, [(CONTENT_TYPE, MIME_PLAIN)], diff --git a/kittybox-rs/src/lib.rs b/kittybox-rs/src/lib.rs index 97bb608..05c1ed2 100644 --- a/kittybox-rs/src/lib.rs +++ b/kittybox-rs/src/lib.rs @@ -73,6 +73,8 @@ pub mod companion { ("index.html", "text/html; charset=\"utf-8\""), ("main.js", "text/javascript"), ("micropub_api.js", "text/javascript"), + ("indieauth.js", "text/javascript"), + ("base64.js", "text/javascript"), ("style.css", "text/css") }; -- cgit 1.4.1