Add /p as alias for /peer (both TUI and web), web /p @alias support
TUI: /p @manwe works same as /peer @manwe Web: /p @manwe and /peer @manwe resolve alias and set peer input Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -295,7 +295,8 @@ impl App {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if text.starts_with("/peer ") {
|
||||
if text.starts_with("/peer ") || text.starts_with("/p ") {
|
||||
let text = if text.starts_with("/p ") { format!("/peer {}", &text[3..]) } else { text.clone() };
|
||||
let raw = text[6..].trim().to_string();
|
||||
let fp = if raw.starts_with('@') {
|
||||
match self.resolve_alias(&raw[1..], client).await {
|
||||
|
||||
@@ -847,6 +847,22 @@ async function doSend() {
|
||||
} catch(e) { addSys('Reply failed: ' + e.message); }
|
||||
return;
|
||||
}
|
||||
if (text.startsWith('/p ') || text.startsWith('/peer ')) {
|
||||
let val = text.startsWith('/p ') ? text.slice(3).trim() : text.slice(6).trim();
|
||||
if (val.startsWith('@')) {
|
||||
const resp = await fetch(SERVER + '/v1/alias/resolve/' + val.slice(1));
|
||||
const data = await resp.json();
|
||||
if (data.error) { addSys('Unknown alias ' + val); return; }
|
||||
$peerInput.value = data.fingerprint;
|
||||
addSys(val + ' → ' + data.fingerprint.slice(0,16) + '...');
|
||||
} else {
|
||||
$peerInput.value = val;
|
||||
}
|
||||
currentGroup = null;
|
||||
localStorage.setItem('wz-peer', $peerInput.value);
|
||||
addSys('Peer set to ' + $peerInput.value.slice(0,16) + '...');
|
||||
return;
|
||||
}
|
||||
if (text.startsWith('/gcreate ')) { await groupCreate(text.slice(9).trim()); return; }
|
||||
if (text.startsWith('/gjoin ')) { await groupJoin(text.slice(7).trim()); return; }
|
||||
if (text === '/gleave') {
|
||||
|
||||
Reference in New Issue
Block a user