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.
 
 
 
 

27 lines
738 B

module.exports = class {
onCreate() {
this.state = {
permitted: false
}
}
onInput(input) {
if (!input.user || !input.user.loggedIn) {
this.state.permitted = input.not
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)
}
// Flip the above permission
if (input.not) {
this.state.permitted = !this.state.permitted
}
}
}