Support device name change sync message
This commit is contained in:
parent
1c4e7bc85d
commit
96de2c2a38
9 changed files with 190 additions and 12 deletions
|
@ -862,6 +862,19 @@ export type GetAccountForUsernameResultType = z.infer<
|
|||
typeof getAccountForUsernameResultZod
|
||||
>;
|
||||
|
||||
const getDevicesResultZod = z.object({
|
||||
devices: z.array(
|
||||
z.object({
|
||||
id: z.number(),
|
||||
name: z.string().nullish(), // primary devices may not have a name
|
||||
lastSeen: z.number().nullish(),
|
||||
created: z.number().nullish(),
|
||||
})
|
||||
),
|
||||
});
|
||||
|
||||
export type GetDevicesResultType = z.infer<typeof getDevicesResultZod>;
|
||||
|
||||
export type GetIceServersResultType = Readonly<{
|
||||
relays?: ReadonlyArray<IceServerGroupType>;
|
||||
}>;
|
||||
|
@ -874,15 +887,6 @@ export type IceServerGroupType = Readonly<{
|
|||
hostname?: string;
|
||||
}>;
|
||||
|
||||
export type GetDevicesResultType = ReadonlyArray<
|
||||
Readonly<{
|
||||
id: number;
|
||||
name: string;
|
||||
lastSeen: number;
|
||||
created: number;
|
||||
}>
|
||||
>;
|
||||
|
||||
export type GetSenderCertificateResultType = Readonly<{ certificate: string }>;
|
||||
|
||||
export type MakeProxiedRequestResultType =
|
||||
|
@ -1376,6 +1380,7 @@ export type WebAPIType = {
|
|||
getAccountForUsername: (
|
||||
options: GetAccountForUsernameOptionsType
|
||||
) => Promise<GetAccountForUsernameResultType>;
|
||||
getDevices: () => Promise<GetDevicesResultType>;
|
||||
getProfileUnauth: (
|
||||
serviceId: ServiceIdString,
|
||||
options: ProfileFetchUnauthRequestOptions
|
||||
|
@ -1847,6 +1852,7 @@ export function initialize({
|
|||
getBackupUploadForm,
|
||||
getBadgeImageFile,
|
||||
getConfig,
|
||||
getDevices,
|
||||
getGroup,
|
||||
getGroupAvatar,
|
||||
getGroupCredentials,
|
||||
|
@ -2935,6 +2941,15 @@ export function initialize({
|
|||
});
|
||||
}
|
||||
|
||||
async function getDevices() {
|
||||
const result = await _ajax({
|
||||
call: 'devices',
|
||||
httpType: 'GET',
|
||||
responseType: 'json',
|
||||
});
|
||||
return parseUnknown(getDevicesResultZod, result);
|
||||
}
|
||||
|
||||
async function updateDeviceName(deviceName: string) {
|
||||
await _ajax({
|
||||
call: 'updateDeviceName',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue