Files
3x-ui/frontend/src/lib/clients/hwid-log.ts
T
mrchatam 8082ab4d74 feat(clients): show short HWID fingerprint in admin device list (#6464)
* feat(clients): show short HWID fingerprint in admin device list

Expose a 12-char prefix of the stored hwid_hash in the admin HWID list API and UI so admins can distinguish devices without querying the database. Full hashes and raw HWIDs remain unexposed.

Fixes #6359

* ci: retrigger release matrix after 386 dependency download flake

---------

Co-authored-by: mrchatam <mrchatam@users.noreply.github.com>
Co-authored-by: mrchatam <287639636+mrchatam@users.noreply.github.com>
2026-09-12 11:13:22 +02:00

23 lines
722 B
TypeScript

// Shape of one entry in a client's HWID (registered-device) log, as returned
// by POST /panel/api/clients/hwids/:email.
export type ClientHwidInfo = {
id: number;
firstSeen: number;
lastSeen: number;
userAgent: string;
deviceOs: string;
osVersion: string;
deviceModel: string;
fingerprint: string;
};
// normalizeClientHwids accepts the API payload and returns typed entries,
// dropping anything that isn't a real HWID row (missing/non-numeric id).
export function normalizeClientHwids(obj: unknown): ClientHwidInfo[] {
if (!Array.isArray(obj)) return [];
return obj.filter(
(x): x is ClientHwidInfo =>
!!x && typeof x === 'object' && typeof (x as ClientHwidInfo).id === 'number',
);
}