Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(web): keep the server version off the public login pages

AkitaOnRailsc81cd89a7c2c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fa1a91e2..a99cf713 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
-- Added the server version to the footer of every `/web` page, on the right
+- Added the server version to the footer of every signed-in `/web` page (the
+ public login and change-password pages leave it out), on the right
side opposite "ai-memory · read-only", so you can tell which build a browser
tab is talking to without running `ai-memory status`. (#1171)
diff --git a/crates/ai-memory-web/src/templates.rs b/crates/ai-memory-web/src/templates.rs
index 087a0653..4d6dfa8c 100644
--- a/crates/ai-memory-web/src/templates.rs
+++ b/crates/ai-memory-web/src/templates.rs
@@ -392,6 +392,26 @@ pub(crate) struct ChangePasswordView {
mod tests {
use super::*;
+ #[test]
+ fn public_auth_pages_do_not_show_the_server_version() {
+ let version = format!("v{VERSION}");
+ let login = LoginView {
+ next: "/web/".into(),
+ change_password_href: "/web/change-password".into(),
+ }
+ .render()
+ .unwrap();
+ let change = ChangePasswordView {
+ next: "/web/".into(),
+ }
+ .render()
+ .unwrap();
+ let signed_in = NotFoundView {}.render().unwrap();
+ assert!(!login.contains(&version), "login page leaks {version}");
+ assert!(!change.contains(&version), "change-password page leaks {version}");
+ assert!(signed_in.contains(&version), "signed-in pages show {version}");
+ }
+
#[test]
fn href_helpers_percent_encode_segments() {
// Relative (no leading slash) so they resolve against the injected
diff --git a/crates/ai-memory-web/templates/base.html b/crates/ai-memory-web/templates/base.html
index 678352b6..2c3ebdae 100644
--- a/crates/ai-memory-web/templates/base.html
+++ b/crates/ai-memory-web/templates/base.html
@@ -66,7 +66,7 @@
<footer class="border-t border-slate-200 dark:border-slate-800 mt-16 py-4">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 flex items-center justify-between gap-4 text-xs text-slate-400 dark:text-slate-600">
<span>ai-memory · read-only</span>
- <span>v{{ crate::templates::VERSION }}</span>
+ {% block footer_version %}<span>v{{ crate::templates::VERSION }}</span>{% endblock %}
</div>
</footer>
</body>
diff --git a/crates/ai-memory-web/templates/change_password.html b/crates/ai-memory-web/templates/change_password.html
index 82b59d0e..2cb03329 100644
--- a/crates/ai-memory-web/templates/change_password.html
+++ b/crates/ai-memory-web/templates/change_password.html
@@ -3,6 +3,7 @@
{% block title %}Change password — ai-memory{% endblock %}
{% block header_actions %}{% endblock %}
+{% block footer_version %}{% endblock %}
{% block content %}
<div class="max-w-md">
diff --git a/crates/ai-memory-web/templates/login.html b/crates/ai-memory-web/templates/login.html
index 9ad3aaad..4f75f3e7 100644
--- a/crates/ai-memory-web/templates/login.html
+++ b/crates/ai-memory-web/templates/login.html
@@ -3,6 +3,7 @@
{% block title %}Sign in — ai-memory{% endblock %}
{% block header_actions %}{% endblock %}
+{% block footer_version %}{% endblock %}
{% block content %}
<div class="max-w-md">