aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-client/src
diff options
context:
space:
mode:
authorThomas Linford <tlinford@users.noreply.github.com>2026-01-21 15:47:47 +0100
committerGitHub <noreply@github.com>2026-01-21 15:47:47 +0100
commit85f3b9df8ec0cbdd607cd721dde97c9d0769ff85 (patch)
treeed9f2774ccc1b43569055b1cc1de4e262824cecc /zellij-client/src
parentFix query webserver from IPC rather than HTTPS (#4620) (diff)
downloadsl0ppij-85f3b9df8ec0cbdd607cd721dde97c9d0769ff85.tar.gz
sl0ppij-85f3b9df8ec0cbdd607cd721dde97c9d0769ff85.tar.xz
sl0ppij-85f3b9df8ec0cbdd607cd721dde97c9d0769ff85.zip
feat(web): add base_url option (#4409)
* feat(web): add base_url option * fix tests * update changelog
Diffstat (limited to 'zellij-client/src')
-rw-r--r--zellij-client/src/web_client/http_handlers.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/zellij-client/src/web_client/http_handlers.rs b/zellij-client/src/web_client/http_handlers.rs
index fb5df41d..4040fab7 100644
--- a/zellij-client/src/web_client/http_handlers.rs
+++ b/zellij-client/src/web_client/http_handlers.rs
@@ -19,11 +19,24 @@ const WEB_CLIENT_PAGE: &str = include_str!(concat!(
const ASSETS_DIR: include_dir::Dir<'_> = include_dir::include_dir!("$CARGO_MANIFEST_DIR/assets");
-pub async fn serve_html(request: Request) -> Html<String> {
+pub async fn serve_html(State(state): State<AppState>, request: Request) -> Html<String> {
let cookies = parse_cookies(&request);
let is_authenticated = cookies.get("session_token").is_some();
let auth_value = if is_authenticated { "true" } else { "false" };
- let html = Html(WEB_CLIENT_PAGE.replace("IS_AUTHENTICATED", &format!("{}", auth_value)));
+ let base_url = state
+ .config
+ .lock()
+ .unwrap()
+ .web_client
+ .base_url
+ .clone()
+ .unwrap_or("/".to_string());
+
+ let html = Html(
+ WEB_CLIENT_PAGE
+ .replace("IS_AUTHENTICATED", &format!("{}", auth_value))
+ .replace("BASE_URL", &base_url),
+ );
html
}