fix: web bot detection checks alias name first, then whois fallback
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1207,11 +1207,20 @@ async function doSend() {
|
|||||||
|
|
||||||
// Check if peer is a bot — send plaintext instead of E2E
|
// Check if peer is a bot — send plaintext instead of E2E
|
||||||
let isBotPeer = false;
|
let isBotPeer = false;
|
||||||
try {
|
const peerRaw = $peerInput.value.trim();
|
||||||
const wr = await fetch(SERVER + '/v1/alias/whois/' + normFP(peer));
|
// Check by alias name if peer was set via @alias
|
||||||
const wd = await wr.json();
|
if (peerRaw.startsWith('@')) {
|
||||||
if (wd.alias && (wd.alias.endsWith('bot') || wd.alias.endsWith('Bot') || wd.alias.endsWith('_bot') || wd.alias === 'botfather')) isBotPeer = true;
|
const aname = peerRaw.slice(1).toLowerCase();
|
||||||
} catch(e) {}
|
isBotPeer = aname.endsWith('bot') || aname.endsWith('_bot') || aname === 'botfather';
|
||||||
|
}
|
||||||
|
// Also check by fingerprint reverse-lookup
|
||||||
|
if (!isBotPeer) {
|
||||||
|
try {
|
||||||
|
const wr = await fetch(SERVER + '/v1/alias/whois/' + peer);
|
||||||
|
const wd = await wr.json();
|
||||||
|
if (wd.alias && (wd.alias.endsWith('bot') || wd.alias.endsWith('Bot') || wd.alias.endsWith('_bot') || wd.alias === 'botfather')) isBotPeer = true;
|
||||||
|
} catch(e) {}
|
||||||
|
}
|
||||||
|
|
||||||
if (isBotPeer) {
|
if (isBotPeer) {
|
||||||
const msgId = crypto.randomUUID ? crypto.randomUUID() : Date.now().toString();
|
const msgId = crypto.randomUUID ? crypto.randomUUID() : Date.now().toString();
|
||||||
|
|||||||
Reference in New Issue
Block a user