feat(device): add clientName to DeviceMeta for multi-client display
Add clientName field to DeviceMeta so non-browser clients (Telegram, Discord, etc.) can provide a human-readable label instead of relying on userAgent parsing. Desktop UI now prioritizes clientName over parsed UA string, fixing "Unknown on Unknown" display for Telegram connections. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a94b6e8b1c
commit
d367e77c0a
6 changed files with 17 additions and 7 deletions
|
|
@ -15,6 +15,7 @@ interface DeviceMeta {
|
|||
userAgent?: string
|
||||
platform?: string
|
||||
language?: string
|
||||
clientName?: string
|
||||
}
|
||||
|
||||
interface PendingConfirm {
|
||||
|
|
@ -55,9 +56,11 @@ export function DeviceConfirmDialog() {
|
|||
? parseUserAgent(pending.meta.userAgent)
|
||||
: null
|
||||
|
||||
const deviceLabel = parsed
|
||||
? `${parsed.browser} on ${parsed.os}`
|
||||
: pending?.deviceId
|
||||
const deviceLabel = pending?.meta?.clientName
|
||||
? pending.meta.clientName
|
||||
: parsed
|
||||
? `${parsed.browser} on ${parsed.os}`
|
||||
: pending?.deviceId
|
||||
|
||||
return (
|
||||
<AlertDialog open={pending !== null}>
|
||||
|
|
|
|||
|
|
@ -44,9 +44,11 @@ function DeviceItem({
|
|||
? parseUserAgent(device.meta.userAgent)
|
||||
: null
|
||||
|
||||
const displayName = parsed
|
||||
? `${parsed.browser} on ${parsed.os}`
|
||||
: device.deviceId
|
||||
const displayName = device.meta?.clientName
|
||||
? device.meta.clientName
|
||||
: parsed
|
||||
? `${parsed.browser} on ${parsed.os}`
|
||||
: device.deviceId
|
||||
|
||||
const handleRevoke = async () => {
|
||||
setRevoking(true)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ export interface DeviceMeta {
|
|||
userAgent?: string
|
||||
platform?: string
|
||||
language?: string
|
||||
clientName?: string
|
||||
}
|
||||
|
||||
export interface DeviceEntry {
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ export interface DeviceMeta {
|
|||
userAgent?: string;
|
||||
platform?: string;
|
||||
language?: string;
|
||||
clientName?: string;
|
||||
}
|
||||
|
||||
/** verify - request params */
|
||||
|
|
|
|||
|
|
@ -204,7 +204,9 @@ export class TelegramService implements OnModuleInit {
|
|||
connectionInfo.token,
|
||||
{
|
||||
platform: "telegram",
|
||||
userAgent: `Telegram ${telegramUserId} @${msg?.from?.username ?? ""} ${msg?.from?.first_name ?? ""}`.trim(),
|
||||
clientName: msg?.from?.username
|
||||
? `Telegram @${msg.from.username}`
|
||||
: `Telegram ${msg?.from?.first_name ?? telegramUserId}`,
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ export interface DeviceMeta {
|
|||
userAgent?: string;
|
||||
platform?: string;
|
||||
language?: string;
|
||||
clientName?: string;
|
||||
}
|
||||
|
||||
export interface DeviceEntry {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue