remove gui basepath

This commit is contained in:
2024-11-12 20:03:27 -07:00
parent a25cf64681
commit b65ec274d8
2 changed files with 4 additions and 14 deletions
-1
View File
@@ -11,7 +11,6 @@ asset_dir = "public"
[web.app] [web.app]
# HTML title tag content # HTML title tag content
title = "Mumble Web 2" title = "Mumble Web 2"
base_path = "gui"
[web.watcher] [web.watcher]
# when watcher trigger, regenerate the `index.html` # when watcher trigger, regenerate the `index.html`
+4 -13
View File
@@ -65,11 +65,6 @@ async fn serve_gui_index_html(req: &Request, res: &mut Response) {
res.render(Text::Html(modified_html)); res.render(Text::Html(modified_html));
} }
#[handler]
async fn redirect_to_gui(res: &mut Response) {
res.render(Redirect::permanent("/gui"));
}
async fn init_config() -> Result<()> { async fn init_config() -> Result<()> {
let mut config: Config = toml::from_str( let mut config: Config = toml::from_str(
&fs::read_to_string("./config.toml") &fs::read_to_string("./config.toml")
@@ -100,18 +95,14 @@ async fn main() -> Result<()> {
init_logging(); init_logging();
init_config().await?; init_config().await?;
let config = CONFIG.get().unwrap(); let config = CONFIG.get().unwrap();
info!("config\n{}", toml::to_string_pretty(&config.gui)?);
info!("gui config\n{}", serde_json::to_string_pretty(&config.gui)?);
// Server routing // Server routing
let router = Router::new() let router = Router::new()
.get(redirect_to_gui) .get(serve_gui_index_html)
.push(Router::with_path("/proxy").goal(connect_proxy)) .push(Router::with_path("/proxy").goal(connect_proxy))
.push(Router::with_path("/gui").get(serve_gui_index_html)) .push(Router::with_path("/<*+rest>").get(StaticDir::new(config.gui_path.clone())))
.push(Router::with_path("/gui/<*+rest>").get(StaticDir::new(config.gui_path.clone())))
// right now dioxus assets don't properly handle base_url, so we are stuck with this
.push(
Router::with_path("/assets/<*+rest>")
.get(StaticDir::new(config.gui_path.join("assets"))),
)
.hoop(Logger::new()); .hoop(Logger::new());
// Read server certs // Read server certs