user-scoped channel sessions, whatsapp disconnect cleanup, browser relay token fix
Channel session IDs now include userId (channel-{provider}-{userId}-{contextId})
to prevent cross-user contamination in multi-user setups. WhatsApp disconnect
properly logs out and clears cached auth. Browser relay uses server-derived token
directly.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -154,7 +154,7 @@ async function handleCommand(ctx: CommandContext): Promise<boolean> {
|
||||
await send('No models available.');
|
||||
return true;
|
||||
}
|
||||
const current = getSessionModel('whatsapp', whatsappId);
|
||||
const current = getSessionModel('whatsapp', ctx.userId, whatsappId);
|
||||
const grouped = new Map<string, string[]>();
|
||||
for (const m of models) {
|
||||
const list = grouped.get(m.provider) ?? [];
|
||||
@@ -171,7 +171,7 @@ async function handleCommand(ctx: CommandContext): Promise<boolean> {
|
||||
}
|
||||
|
||||
if (lower === '!model') {
|
||||
const current = getSessionModel('whatsapp', whatsappId);
|
||||
const current = getSessionModel('whatsapp', ctx.userId, whatsappId);
|
||||
await send(
|
||||
current
|
||||
? `Current model: *${current}*`
|
||||
@@ -183,7 +183,7 @@ async function handleCommand(ctx: CommandContext): Promise<boolean> {
|
||||
if (lower.startsWith('!model ')) {
|
||||
const requested = content.slice('!model '.length).trim();
|
||||
if (!requested) {
|
||||
const current = getSessionModel('whatsapp', whatsappId);
|
||||
const current = getSessionModel('whatsapp', ctx.userId, whatsappId);
|
||||
await send(current ? `Current model: *${current}*` : 'No active session yet.');
|
||||
return true;
|
||||
}
|
||||
@@ -193,7 +193,7 @@ async function handleCommand(ctx: CommandContext): Promise<boolean> {
|
||||
await send(`Model not found: \`${requested}\`\nUse \`!models\` to see available models.`);
|
||||
return true;
|
||||
}
|
||||
setSessionModel('whatsapp', whatsappId, match.id);
|
||||
setSessionModel('whatsapp', ctx.userId, whatsappId, match.id);
|
||||
await send(`Model switched to *${match.id}*. The new model will be used on your next message.`);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user