Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
delEmote(state, id: string) {
const emotes = {
...state.emotes,
}
delete emotes[id]
state.emotes = emotes
},
reset(state) {
state.emotes = {}
state.history = []
},
})
export const actions = actionTree(
{ state, getters, mutations },
{
newEmote(store, emote: Emote) {
if (accessor.settings.ignore_emotes || document.visibilityState === 'hidden') {
return
}
const id = makeid(10)
accessor.chat.addEmote({ id, emote })
},
newMessage({ state }, message: Message) {
if (accessor.settings.chat_sound) {
new Audio('chat.mp3').play().catch(console.error)
}
accessor.chat.addMessage(message)
state.groups[0].list.push(emoji)
set('emoji_recent', JSON.stringify(state.groups[0].list))
}
},
addGroup(state, group: Group) {
state.groups.push(group)
},
setKeywords(state, keywords: Keywords) {
state.keywords = keywords
},
setList(state, list: string[]) {
state.list = list
},
})
export const actions = actionTree(
{ state, getters, mutations },
{
initialise() {
$http
.get('/emoji.json')
.then((req) => {
for (const group of req.data.groups) {
accessor.emoji.addGroup(group)
}
accessor.emoji.setList(req.data.list)
accessor.emoji.setKeywords(req.data.keywords)
})
.catch(console.error)
},
},
)
setClipboard(state, clipboard: string) {
state.clipboard = clipboard
},
setLocked(state, locked: boolean) {
state.locked = locked
},
reset(state) {
state.id = ''
state.clipboard = ''
state.locked = false
},
})
export const actions = actionTree(
{ state, getters, mutations },
{
sendClipboard({ getters }, clipboard: string) {
if (!accessor.connected || !getters.hosting) {
return
}
$client.sendMessage(EVENT.CONTROL.CLIPBOARD, { text: clipboard })
},
toggle({ getters }) {
if (!accessor.connected) {
return
}
if (!getters.hosting) {
setConnnecting(state) {
state.connected = false
state.connecting = true
},
setConnected(state, connected: boolean) {
state.connected = connected
state.connecting = false
if (connected) {
set('displayname', state.displayname)
set('password', state.password)
}
},
})
export const actions = actionTree(
{ state, mutations },
{
initialise(store) {
accessor.emoji.initialise()
accessor.settings.initialise()
},
lock() {
if (!accessor.connected || !accessor.user.admin) {
return
}
$client.sendMessage(EVENT.ADMIN.LOCK)
},
unlock() {
...member,
},
}
},
delMember(state, id: string) {
state.members[id] = {
...state.members[id],
connected: false,
}
},
reset(state) {
state.members = {}
},
})
export const actions = actionTree(
{ state, getters, mutations },
{
ban({ state }, member: string | Member) {
if (!accessor.connected || !accessor.user.admin) {
return
}
if (typeof member === 'string') {
member = state.members[member]
}
if (!member) {
return
}
$client.sendMessage(EVENT.ADMIN.BAN, { id: member.id })
state.tab = tab
set('tab', tab)
},
setAbout(state, page: string) {
state.about_page = page
},
toggleAbout(state) {
state.about = !state.about
},
toggleSide(state) {
state.side = !state.side
set('side', state.side)
},
})
export const actions = actionTree({ state, getters, mutations }, {})
reset(state) {
state.index = -1
state.tracks = []
state.streams = []
state.configurations = []
state.width = 1280
state.height = 720
state.rate = 30
state.horizontal = 16
state.vertical = 9
state.playing = false
state.playable = false
},
})
export const actions = actionTree(
{ state, getters, mutations },
{
screenConfiguations({ state }) {
if (!accessor.connected || !accessor.user.admin) {
return
}
$client.sendMessage(EVENT.SCREEN.CONFIGURATIONS)
},
screenGet({ state }) {
if (!accessor.connected) {
return
}
$client.sendMessage(EVENT.SCREEN.RESOLUTION)