diff options
author | Vika <vika@fireburn.ru> | 2022-09-29 22:39:28 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2022-09-29 22:39:28 +0300 |
commit | b7d4e5c4686bc8aac41d832567190002542a1743 (patch) | |
tree | 6a42a990fbb06057a64de5f68175f94c3637c2c7 /kittybox-rs/src | |
parent | b3508ccb146648950ed392b517d12354203c4347 (diff) | |
download | kittybox-b7d4e5c4686bc8aac41d832567190002542a1743.tar.zst |
companion-lite: port to TypeScript
Diffstat (limited to 'kittybox-rs/src')
-rw-r--r-- | kittybox-rs/src/frontend/mod.rs | 13 | ||||
-rw-r--r-- | kittybox-rs/src/lib.rs | 6 |
2 files changed, 14 insertions, 5 deletions
diff --git a/kittybox-rs/src/frontend/mod.rs b/kittybox-rs/src/frontend/mod.rs index 43a2824..6b4bdae 100644 --- a/kittybox-rs/src/frontend/mod.rs +++ b/kittybox-rs/src/frontend/mod.rs @@ -268,9 +268,18 @@ pub async fn catchall<D: Storage>( } const STYLE_CSS: &[u8] = include_bytes!("./style.css"); -const ONBOARDING_JS: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/onboarding.js")); +// 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"), "/indieauth.js")); +const INDIEAUTH_JS: &[u8] = include_bytes!(concat!( + env!("OUT_DIR"), "/", "kittybox_js", "/", "indieauth.js" +)); const MIME_JS: &str = "application/javascript"; const MIME_CSS: &str = "text/css"; diff --git a/kittybox-rs/src/lib.rs b/kittybox-rs/src/lib.rs index 7084601..97bb608 100644 --- a/kittybox-rs/src/lib.rs +++ b/kittybox-rs/src/lib.rs @@ -55,13 +55,13 @@ pub mod companion { let mut map = HashMap::new(); macro_rules! register_resource { - ($map:ident, $prefix:literal, ($filename:literal, $mime:literal)) => {{ + ($map:ident, $prefix:expr, ($filename:literal, $mime:literal)) => {{ $map.insert($filename, Resource { data: include_bytes!(concat!($prefix, $filename)), mime: $mime }) }}; - ($map:ident, $prefix:literal, ($filename:literal, $mime:literal), $( ($f:literal, $m:literal) ),+) => {{ + ($map:ident, $prefix:expr, ($filename:literal, $mime:literal), $( ($f:literal, $m:literal) ),+) => {{ register_resource!($map, $prefix, ($filename, $mime)); register_resource!($map, $prefix, $(($f, $m)),+); }}; @@ -69,7 +69,7 @@ pub mod companion { register_resource! { map, - "../companion-lite/", + concat!(env!("OUT_DIR"), "/", "companion", "/"), ("index.html", "text/html; charset=\"utf-8\""), ("main.js", "text/javascript"), ("micropub_api.js", "text/javascript"), |