aboutsummaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/assets.rs9
-rw-r--r--server/src/main.rs4
2 files changed, 8 insertions, 5 deletions
diff --git a/server/src/assets.rs b/server/src/assets.rs
index cf6ccb1..7195fbf 100644
--- a/server/src/assets.rs
+++ b/server/src/assets.rs
@@ -15,8 +15,8 @@ macro_rules! s_file {
#[cfg(debug_assertions)]
#[macro_export]
macro_rules! s_asset_dir {
- () => {
- warp::fs::dir("../client-web/public/assets")
+ ($path: literal) => {
+ warp::fs::dir(concat!("../", $path))
};
}
@@ -37,9 +37,9 @@ macro_rules! s_file {
#[cfg(not(debug_assertions))]
#[macro_export]
macro_rules! s_asset_dir {
- () => {{
+ ($path:literal) => {{
use include_dir::{include_dir, Dir};
- const DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/../client-web/public/assets");
+ const DIR: Dir = include_dir!(concat!("$CARGO_MANIFEST_DIR/../", $path));
warp::path::tail().and_then(|t: warp::path::Tail| async move {
let path = t.as_str();
let content_type = match &path {
@@ -47,6 +47,7 @@ macro_rules! s_asset_dir {
_ if path.ends_with(".js") => "application/javascript",
_ if path.ends_with(".css") => "text/css",
_ if path.ends_with(".svg") => "image/svg+xml",
+ _ if path.ends_with(".ini") => "text/plain",
_ => "application/octet-stream",
};
DIR.get_file(path)
diff --git a/server/src/main.rs b/server/src/main.rs
index 92f9451..e35dd01 100644
--- a/server/src/main.rs
+++ b/server/src/main.rs
@@ -63,7 +63,8 @@ async fn run() {
let favicon: _ =
warp::path("favicon.ico").and(s_file!("client-web/public/favicon.ico", "image/avif"));
let room: _ = warp::path("room").and(s_file!("client-web/public/app.html", "text/html"));
- let assets: _ = warp::path("assets").and(s_asset_dir!());
+ let locale: _ = warp::path("locale").and(s_asset_dir!("client-web/locale"));
+ let assets: _ = warp::path("assets").and(s_asset_dir!("client-web/public/assets"));
let sw_script: _ = warp::path("sw.js").and(s_file!(
"client-web/public/assets/sw.js",
"application/javascript"
@@ -94,6 +95,7 @@ async fn run() {
.or(client_config)
.or(version)
.or(assets)
+ .or(locale)
.or(favicon)
.or(sw_script)
.or(old_format_redirect)