diff --git a/warzone/Cargo.lock b/warzone/Cargo.lock
index b16cbdc..d43abab 100644
--- a/warzone/Cargo.lock
+++ b/warzone/Cargo.lock
@@ -2555,7 +2555,7 @@ dependencies = [
[[package]]
name = "warzone-client"
-version = "0.0.3"
+version = "0.0.4"
dependencies = [
"anyhow",
"argon2",
@@ -2584,7 +2584,7 @@ dependencies = [
[[package]]
name = "warzone-mule"
-version = "0.0.3"
+version = "0.0.4"
dependencies = [
"anyhow",
"clap",
@@ -2593,7 +2593,7 @@ dependencies = [
[[package]]
name = "warzone-protocol"
-version = "0.0.3"
+version = "0.0.4"
dependencies = [
"base64",
"bincode",
@@ -2616,7 +2616,7 @@ dependencies = [
[[package]]
name = "warzone-server"
-version = "0.0.3"
+version = "0.0.4"
dependencies = [
"anyhow",
"axum",
@@ -2642,7 +2642,7 @@ dependencies = [
[[package]]
name = "warzone-wasm"
-version = "0.0.3"
+version = "0.0.4"
dependencies = [
"base64",
"bincode",
diff --git a/warzone/Cargo.toml b/warzone/Cargo.toml
index 9bdf2ce..a7e6a79 100644
--- a/warzone/Cargo.toml
+++ b/warzone/Cargo.toml
@@ -9,7 +9,7 @@ members = [
]
[workspace.package]
-version = "0.0.3"
+version = "0.0.4"
edition = "2021"
license = "MIT"
rust-version = "1.75"
diff --git a/warzone/crates/warzone-server/src/routes/web.rs b/warzone/crates/warzone-server/src/routes/web.rs
index f6df3f0..919e4d7 100644
--- a/warzone/crates/warzone-server/src/routes/web.rs
+++ b/warzone/crates/warzone-server/src/routes/web.rs
@@ -83,7 +83,6 @@ const WEB_HTML: &str = r##"
.msg { padding: 2px 0; font-size: 0.85em; white-space: pre-wrap; word-wrap: break-word; }
.msg .ts { color: #333; margin-right: 4px; }
.msg .from-self { color: #4ade80; font-weight: bold; }
- .msg .from-peer { color: #e6a23c; font-weight: bold; }
.msg .from-sys { color: #5e9ca0; font-style: italic; }
.msg .lock { color: #ff6b9d; }
@@ -160,7 +159,7 @@ let peerBundles = {}; // peerFP -> bundle bytes
let pollTimer = null;
let wasmReady = false;
-const VERSION = '0.0.3';
+const VERSION = '0.0.4';
let DEBUG = true; // toggle with /debug command
function dbg(...args) {
@@ -402,12 +401,20 @@ function esc(s) {
return d.innerHTML;
}
+const PEER_COLORS = ['#e6a23c','#f56c9d','#67c7eb','#b39ddb','#ff8a65','#81c784','#ce93d8','#4fc3f7','#ffb74d','#aed581','#f06292','#4dd0e1'];
+
+function peerColor(name) {
+ let h = 0;
+ for (let i = 0; i < name.length; i++) h = ((h << 5) - h + name.charCodeAt(i)) | 0;
+ return PEER_COLORS[Math.abs(h) % PEER_COLORS.length];
+}
+
function addMsg(from, text, isSelf) {
const d = document.createElement('div');
d.className = 'msg';
- const cls = isSelf ? 'from-self' : 'from-peer';
+ const color = isSelf ? '#4ade80' : peerColor(from);
const lock = isSelf ? '' : '🔒 ';
- d.innerHTML = '' + ts() + ' ' + lock + '' + esc(from) + ': ' + esc(text);
+ d.innerHTML = '' + ts() + ' ' + lock + '' + esc(from) + ': ' + esc(text);
$messages.appendChild(d);
$messages.scrollTop = $messages.scrollHeight;
}