mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 14:14:56 -04:00
Implement MSC3852: Expose last_seen_user_agent
to users for their own devices; also expose to Admin API (#13549)
This commit is contained in:
parent
40e3e68cd7
commit
f9f03426de
8 changed files with 153 additions and 2 deletions
|
@ -74,6 +74,7 @@ class DeviceWorkerHandler:
|
|||
self._state_storage = hs.get_storage_controllers().state
|
||||
self._auth_handler = hs.get_auth_handler()
|
||||
self.server_name = hs.hostname
|
||||
self._msc3852_enabled = hs.config.experimental.msc3852_enabled
|
||||
|
||||
@trace
|
||||
async def get_devices_by_user(self, user_id: str) -> List[JsonDict]:
|
||||
|
@ -747,7 +748,13 @@ def _update_device_from_client_ips(
|
|||
device: JsonDict, client_ips: Mapping[Tuple[str, str], Mapping[str, Any]]
|
||||
) -> None:
|
||||
ip = client_ips.get((device["user_id"], device["device_id"]), {})
|
||||
device.update({"last_seen_ts": ip.get("last_seen"), "last_seen_ip": ip.get("ip")})
|
||||
device.update(
|
||||
{
|
||||
"last_seen_user_agent": ip.get("user_agent"),
|
||||
"last_seen_ts": ip.get("last_seen"),
|
||||
"last_seen_ip": ip.get("ip"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class DeviceListUpdater:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue