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.

21 lines
622 B

  1. module.exports = class {
  2. onCreate() {
  3. this.state = {
  4. permitted: false
  5. }
  6. }
  7. onInput(input) {
  8. if (!input.user || !input.user.loggedIn) {
  9. this.state.permitted = false
  10. return
  11. }
  12. if (input.author != null && input.author != "" && input.user.name === input.author) {
  13. this.state.permitted = input.user.permissions.includes("member")
  14. } else if (Array.isArray(input.permission)) {
  15. this.state.permitted = input.user.permissions.find(p => input.permission.includes(p))
  16. } else {
  17. this.state.permitted = input.user.permissions.includes(input.permission)
  18. }
  19. }
  20. }