about summary refs log tree commit diff
path: root/kittybox-rs/src/frontend/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'kittybox-rs/src/frontend/mod.rs')
-rw-r--r--kittybox-rs/src/frontend/mod.rs47
1 files changed, 6 insertions, 41 deletions
diff --git a/kittybox-rs/src/frontend/mod.rs b/kittybox-rs/src/frontend/mod.rs
index 58de39d..f0f4e5a 100644
--- a/kittybox-rs/src/frontend/mod.rs
+++ b/kittybox-rs/src/frontend/mod.rs
@@ -12,7 +12,12 @@ use tracing::{debug, error};
 //pub mod login;
 pub mod onboarding;
 
-use kittybox_templates::{Entry, ErrorPage, Feed, MainPage, Template, VCard, POSTS_PER_PAGE};
+use kittybox_frontend_renderer::{
+    Entry, Feed, VCard,
+    ErrorPage, Template, MainPage,
+    POSTS_PER_PAGE
+};
+pub use kittybox_frontend_renderer::assets::statics;
 
 #[derive(Debug, Deserialize)]
 pub struct QueryParams {
@@ -266,43 +271,3 @@ pub async fn catchall<D: Storage>(
         }
     }
 }
-
-const STYLE_CSS: &[u8] = include_bytes!("./style.css");
-// XXX const path handling is ugly, and concat!() doesn't take
-// constants, only literals... how annoying!
-//
-// This might break compiling on inferior operating systems that use
-// backslashes as their path separator
-const ONBOARDING_JS: &[u8] = include_bytes!(concat!(
-    env!("OUT_DIR"), "/", "kittybox_js", "/", "onboarding.js"
-));
-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 JSLABELS_HTML: &[u8] = include_bytes!("../../javascript/jslicense.html");
-const MIME_JS: &str = "application/javascript";
-const MIME_CSS: &str = "text/css";
-const MIME_PLAIN: &str = "text/plain";
-const MIME_HTML: &str = "text/html; charset=utf-8";
-
-pub async fn statics(Path(name): Path<String>) -> impl IntoResponse {
-    use axum::http::header::CONTENT_TYPE;
-
-    match name.as_str() {
-        "style.css" => (StatusCode::OK, [(CONTENT_TYPE, MIME_CSS)], STYLE_CSS),
-        "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),
-        "jslicense.html" => (StatusCode::OK, [(CONTENT_TYPE, MIME_HTML)], JSLABELS_HTML),
-        _ => (
-            StatusCode::NOT_FOUND,
-            [(CONTENT_TYPE, MIME_PLAIN)],
-            "not found".as_bytes(),
-        ),
-    }
-}