Archived
2
0

add lock controls for users.

This commit is contained in:
Miroslav Šedivý
2021-11-16 22:50:11 +01:00
parent 2290c4a065
commit 61fcf7f699
20 changed files with 277 additions and 113 deletions

View File

@ -21,6 +21,7 @@ import {
BroadcastStatusPayload,
AdminPayload,
AdminTargetPayload,
AdminLockMessage,
} from './messages'
interface NekoEvents extends BaseEvents {}
@ -461,21 +462,23 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
})
}
protected [EVENT.ADMIN.LOCK]({ id }: AdminPayload) {
this.$accessor.setLocked(true)
protected [EVENT.ADMIN.LOCK]({ id, resource }: AdminLockMessage) {
this.$accessor.setLocked(resource)
this.$accessor.chat.newMessage({
id,
content: this.$vue.$t('notifications.room_locked') as string,
content: this.$vue.$t(`locks.${resource}.notif_locked`) as string,
type: 'event',
created: new Date(),
})
}
protected [EVENT.ADMIN.UNLOCK]({ id }: AdminPayload) {
this.$accessor.setLocked(false)
protected [EVENT.ADMIN.UNLOCK]({ id, resource }: AdminLockMessage) {
this.$accessor.setUnlocked(resource)
this.$accessor.chat.newMessage({
id,
content: this.$vue.$t('notifications.room_unlocked') as string,
content: this.$vue.$t(`locks.${resource}.notif_unlocked`) as string,
type: 'event',
created: new Date(),
})

View File

@ -39,6 +39,7 @@ export type WebSocketPayloads =
| ScreenResolutionPayload
| ScreenConfigurationsPayload
| AdminPayload
| AdminLockPayload
| BroadcastStatusPayload
| BroadcastCreatePayload
@ -222,3 +223,14 @@ export interface AdminTargetPayload {
id: string
target?: string
}
export interface AdminLockMessage extends WebSocketMessage, AdminLockPayload {
event: AdminEvents
id: string
}
export type AdminLockResource = 'login' | 'control'
export interface AdminLockPayload {
resource: AdminLockResource
}