feat: local device profile replaces animal naming
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 35s
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 35s
- Users set their own device name and optional profile photo - Profile persisted in localStorage, no account needed - Auto-detect device type from user agent - Server validates client-provided profile defensively - PeerAvatar shows photo or device icon - ProfileSetup modal on first visit, editable from header
This commit is contained in:
parent
4dbdfedae0
commit
e3085ea7a2
@ -113,14 +113,15 @@ function checkMessageRate(client: Client): boolean {
|
||||
}
|
||||
|
||||
/** Sanitize client-provided display name */
|
||||
function sanitizeName(name: string): string {
|
||||
function sanitizeName(name: unknown): string {
|
||||
if (typeof name !== "string") return "Appareil";
|
||||
return name.trim().slice(0, 30) || "Appareil";
|
||||
}
|
||||
|
||||
/** Validate device type */
|
||||
function validateDeviceType(dt: string): DeviceType {
|
||||
function validateDeviceType(dt: unknown): DeviceType {
|
||||
const valid: DeviceType[] = ["phone", "tablet", "laptop", "desktop"];
|
||||
return valid.includes(dt as DeviceType) ? (dt as DeviceType) : "laptop";
|
||||
return typeof dt === "string" && valid.includes(dt as DeviceType) ? (dt as DeviceType) : "laptop";
|
||||
}
|
||||
|
||||
/** Validate avatar (must be a small data URL or undefined) */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user