remove gui basepath
This commit is contained in:
+4
-13
@@ -65,11 +65,6 @@ async fn serve_gui_index_html(req: &Request, res: &mut Response) {
|
||||
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<()> {
|
||||
let mut config: Config = toml::from_str(
|
||||
&fs::read_to_string("./config.toml")
|
||||
@@ -100,18 +95,14 @@ async fn main() -> Result<()> {
|
||||
init_logging();
|
||||
init_config().await?;
|
||||
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
|
||||
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("/gui").get(serve_gui_index_html))
|
||||
.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"))),
|
||||
)
|
||||
.push(Router::with_path("/<*+rest>").get(StaticDir::new(config.gui_path.clone())))
|
||||
.hoop(Logger::new());
|
||||
|
||||
// Read server certs
|
||||
|
||||
Reference in New Issue
Block a user