The frontend/UI server, written in JS using the MarkoJS library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

22 lines
622 B

module.exports = class {
onCreate() {
this.state = {
permitted: false
}
}
onInput(input) {
if (!input.user || !input.user.loggedIn) {
this.state.permitted = false
return
}
if (input.author != null && input.author != "" && input.user.name === input.author) {
this.state.permitted = input.user.permissions.includes("member")
} else if (Array.isArray(input.permission)) {
this.state.permitted = input.user.permissions.find(p => input.permission.includes(p))
} else {
this.state.permitted = input.user.permissions.includes(input.permission)
}
}
}