summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-12-16 11:47:20 +0100
committerRory& <root@rory.gay>2025-12-16 11:47:20 +0100
commitd7a950d0e7a69319ac601ae3f72f25071bbcf022 (patch)
tree210fb51002cdb823c04b92edb96b8879bd0c53d1 /src/util
parentExperimental unix socket mode (diff)
downloadserver-ts-d7a950d0e7a69319ac601ae3f72f25071bbcf022.tar.xz
Device management
Diffstat (limited to 'src/util')
-rw-r--r--src/util/entities/Session.ts20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/util/entities/Session.ts b/src/util/entities/Session.ts

index 1569543f..4ff9e10c 100644 --- a/src/util/entities/Session.ts +++ b/src/util/entities/Session.ts
@@ -87,10 +87,28 @@ export class Session extends BaseClassWithoutId { client_info: { os: this.client_info.os, client: this.client_info.client, - location: this.last_seen_location + location: this.last_seen_location, }, }; } + + getExtendedDeviceInfo() { + return { + id: this.session_id, + id_hash: crypto.createHash("sha256").update(this.session_id).digest("hex"), + status: this.status, + activities: this.activities, + client_status: this.client_status, + approx_last_used_time: this.last_seen.toISOString(), + client_info: { + ...this.client_info, + location: this.last_seen_location, + }, + last_seen: this.last_seen, + last_seen_ip: this.last_seen_ip, + last_seen_location: this.last_seen_location, + }; + } } export const PrivateSessionProjection: (keyof Session)[] = ["user_id", "session_id", "activities", "client_info", "status"];