mirror of
https://github.com/status-im/codimd.git
synced 2025-02-04 17:53:53 +00:00
realtime RealtimeUserData
Signed-off-by: Raccoon <raccoon@hackmd.io>
This commit is contained in:
parent
a095cd3448
commit
ab2ed4ab65
@ -24,6 +24,22 @@ import {UpdateDirtyNoteJob} from "./realtimeUpdateDirtyNoteJob";
|
|||||||
import {CleanDanglingUserJob} from "./realtimeCleanDanglingUserJob";
|
import {CleanDanglingUserJob} from "./realtimeCleanDanglingUserJob";
|
||||||
import {SaveRevisionJob} from "./realtimeSaveRevisionJob";
|
import {SaveRevisionJob} from "./realtimeSaveRevisionJob";
|
||||||
|
|
||||||
|
|
||||||
|
export interface RealtimeUserData {
|
||||||
|
id?: string
|
||||||
|
color?: string
|
||||||
|
address?: string
|
||||||
|
'user-agent'?: string
|
||||||
|
photo?: string
|
||||||
|
|
||||||
|
cursor?: any
|
||||||
|
login?: boolean
|
||||||
|
userid?: string
|
||||||
|
name?: string
|
||||||
|
|
||||||
|
idle?: any
|
||||||
|
type?: any
|
||||||
|
}
|
||||||
const chance = new Chance()
|
const chance = new Chance()
|
||||||
|
|
||||||
export let io: SocketIO.Server = null
|
export let io: SocketIO.Server = null
|
||||||
@ -95,8 +111,8 @@ export function emitCheck(note) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
export const users = {}
|
|
||||||
export const notes = {}
|
export const notes = {}
|
||||||
|
export const users: Record<string, RealtimeUserData> = {}
|
||||||
|
|
||||||
export function getNotePool(): any {
|
export function getNotePool(): any {
|
||||||
return notes
|
return notes
|
||||||
@ -130,11 +146,11 @@ export function getNoteFromNotePool(noteId) {
|
|||||||
return notes[noteId]
|
return notes[noteId]
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getUserPool() {
|
export function getUserPool(): Record<string, RealtimeUserData> {
|
||||||
return users
|
return users
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getUserFromUserPool(userId) {
|
export function getUserFromUserPool(userId: string): RealtimeUserData | null {
|
||||||
return users[userId]
|
return users[userId]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user