file transfer permission state management
This commit is contained in:
@ -39,10 +39,7 @@ export const EVENT = {
|
||||
EMOTE: 'chat/emote',
|
||||
},
|
||||
FILETRANSFER: {
|
||||
ENABLE: 'filetransfer/enable',
|
||||
DISABLE: 'filetransfer/disable',
|
||||
UNPRIVENABLE: 'filetransfer/unprivenable',
|
||||
UNPRIVDISABLE: 'filetransfer/unprivdisable',
|
||||
STATUS: 'filetransfer/status',
|
||||
LIST: 'filetransfer/list',
|
||||
REFRESH: 'filetransfer/refresh'
|
||||
},
|
||||
@ -102,10 +99,7 @@ export type SignalEvents =
|
||||
export type ChatEvents = typeof EVENT.CHAT.MESSAGE | typeof EVENT.CHAT.EMOTE
|
||||
|
||||
export type FileTransferEvents =
|
||||
| typeof EVENT.FILETRANSFER.ENABLE
|
||||
| typeof EVENT.FILETRANSFER.DISABLE
|
||||
| typeof EVENT.FILETRANSFER.UNPRIVENABLE
|
||||
| typeof EVENT.FILETRANSFER.UNPRIVDISABLE
|
||||
| typeof EVENT.FILETRANSFER.STATUS
|
||||
| typeof EVENT.FILETRANSFER.LIST
|
||||
| typeof EVENT.FILETRANSFER.REFRESH
|
||||
|
||||
|
@ -25,6 +25,7 @@ import {
|
||||
SystemInitPayload,
|
||||
AdminLockResource,
|
||||
FileTransferListPayload,
|
||||
FileTransferStatusPayload,
|
||||
} from './messages'
|
||||
|
||||
interface NekoEvents extends BaseEvents {}
|
||||
@ -361,8 +362,12 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
// Chat Events
|
||||
// Filetransfer Events
|
||||
/////////////////////////////
|
||||
protected [EVENT.FILETRANSFER.STATUS]({ admin, unpriv }: FileTransferStatusPayload) {
|
||||
this.$accessor.settings.setLocalFileTransferStatus({ admin, unpriv })
|
||||
}
|
||||
|
||||
protected [EVENT.FILETRANSFER.LIST]({ cwd, files }: FileTransferListPayload) {
|
||||
this.$accessor.files.setCwd(cwd)
|
||||
this.$accessor.files.setFileList(files)
|
||||
|
@ -44,6 +44,7 @@ export type WebSocketPayloads =
|
||||
| ChatPayload
|
||||
| ChatSendPayload
|
||||
| EmojiSendPayload
|
||||
| FileTransferStatusPayload
|
||||
| ScreenResolutionPayload
|
||||
| ScreenConfigurationsPayload
|
||||
| AdminPayload
|
||||
@ -198,8 +199,17 @@ export interface EmojiSendPayload {
|
||||
emote: string
|
||||
}
|
||||
|
||||
// file transfer
|
||||
export interface FileTransferMessage extends WebSocketMessage, FileTransferListPayload {
|
||||
// file transfer enabled
|
||||
export interface FileTransferStatusMessage extends WebSocketMessage, FileTransferStatusPayload {
|
||||
event: typeof EVENT.FILETRANSFER.STATUS
|
||||
}
|
||||
export interface FileTransferStatusPayload {
|
||||
admin: boolean,
|
||||
unpriv: boolean
|
||||
}
|
||||
|
||||
// file transfer list
|
||||
export interface FileTransferListMessage extends WebSocketMessage, FileTransferListPayload {
|
||||
event: FileTransferEvents
|
||||
}
|
||||
export interface FileTransferListPayload {
|
||||
|
Reference in New Issue
Block a user