diff --git a/src/config.rs b/src/config.rs index 5c90357..730044f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -22,7 +22,7 @@ mod default { use std::{net::SocketAddr, time::Duration}; pub fn web_base() -> String { - "".to_string() + "/".to_string() } pub fn web_address() -> SocketAddr { @@ -138,13 +138,14 @@ impl ConfigFile { } fn web_base(&self) -> String { - self.web - .base - .strip_prefix('/') - .unwrap_or(&self.web.base) - .strip_suffix('/') - .unwrap_or(&self.web.base) - .to_string() + let mut base = self.web.base.clone(); + if !base.starts_with('/') { + base.insert(0, '/'); + } + if !base.ends_with('/') { + base.push('/'); + } + base } fn web_runner_token(&self) -> String { @@ -204,6 +205,7 @@ pub struct RunnerServerConfig { } pub struct Config { + /// Always starts and ends with a `/`. pub web_base: String, pub web_address: SocketAddr, pub web_runner_token: String, diff --git a/templates/base.html b/templates/base.html index e8512f7..5bf99cb 100644 --- a/templates/base.html +++ b/templates/base.html @@ -5,20 +5,17 @@ {% block title %}{% endblock %} - {{ base.repo_name }} - - + + {% block head %}{% endblock %} diff --git a/templates/index.html b/templates/index.html index 75f0891..0403805 100644 --- a/templates/index.html +++ b/templates/index.html @@ -11,7 +11,7 @@ {% for ref in tracked_refs %}
{{ ref.name }}
- + {% call util::commit_short(ref.short, ref.reachable) %}
@@ -24,7 +24,7 @@ {% for ref in untracked_refs %}
{{ ref.name }}
- + {% call util::commit_short(ref.short, ref.reachable) %}
diff --git a/templates/queue_table.html b/templates/queue_table.html index 0b182a8..ea90828 100644 --- a/templates/queue_table.html +++ b/templates/queue_table.html @@ -12,7 +12,7 @@ {% for task in tasks %} - + {% call util::commit_short(task.short, task.reachable) %}