Skip to content

Commit

Permalink
Fix: Disallow VIP & Mod buttons for moderators on user info modal due…
Browse files Browse the repository at this point in the history
… to lack of permission

Release: Version bump 1.4.16
  • Loading branch information
Xzensi committed Jun 18, 2024
1 parent 49b7066 commit 013f58e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
14 changes: 12 additions & 2 deletions dist/userscript/client.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name NipahTV
// @namespace https://github.com/Xzensi/NipahTV
// @version 1.4.15
// @version 1.4.16
// @author Xzensi
// @description Better Kick and 7TV emote integration for Kick chat.
// @match https://kick.com/*
Expand Down Expand Up @@ -2162,6 +2162,11 @@ var UserInfoModal = class extends AbstractModal {
const { userInfo, userChannelInfo } = this;
if (!userInfo || !userChannelInfo)
return;
const { channelData } = this.session;
if (!channelData.me.isBroadcaster && !channelData.me.isSuperAdmin) {
this.toaster.addToast("You do not have permission to perform this action.", 6e3, "error");
return;
}
this.modActionButtonVIPEl.classList.add("ntv__icon-button--disabled");
if (this.isUserVIP()) {
log(`Attempting to remove VIP status from user: ${userInfo.username}..`);
Expand Down Expand Up @@ -2212,6 +2217,11 @@ var UserInfoModal = class extends AbstractModal {
const { userInfo, userChannelInfo } = this;
if (!userInfo || !userChannelInfo)
return;
const { channelData } = this.session;
if (!channelData.me.isBroadcaster && !channelData.me.isSuperAdmin) {
this.toaster.addToast("You do not have permission to perform this action.", 6e3, "error");
return;
}
this.modActionButtonModEl.classList.add("ntv__icon-button--disabled");
if (this.isUserPrivileged()) {
log(`Attempting to remove mod status from user: ${userInfo.username}..`);
Expand Down Expand Up @@ -7581,7 +7591,7 @@ var KickBadgeProvider = class {
// src/app.ts
var NipahClient = class {
ENV_VARS = {
VERSION: "1.4.15",
VERSION: "1.4.16",
LOCAL_RESOURCE_ROOT: "http://localhost:3000/",
// GITHUB_ROOT: 'https://github.com/Xzensi/NipahTV/raw/master',
// GITHUB_ROOT: 'https://cdn.jsdelivr.net/gh/Xzensi/NipahTV@master',
Expand Down
12 changes: 12 additions & 0 deletions src/UserInterface/Modals/UserInfoModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,12 @@ export class UserInfoModal extends AbstractModal {
const { userInfo, userChannelInfo } = this
if (!userInfo || !userChannelInfo) return

const { channelData } = this.session
if (!channelData.me.isBroadcaster && !channelData.me.isSuperAdmin) {
this.toaster.addToast('You do not have permission to perform this action.', 6_000, 'error')
return
}

this.modActionButtonVIPEl!.classList.add('ntv__icon-button--disabled')

if (this.isUserVIP()) {
Expand Down Expand Up @@ -488,6 +494,12 @@ export class UserInfoModal extends AbstractModal {
const { userInfo, userChannelInfo } = this
if (!userInfo || !userChannelInfo) return

const { channelData } = this.session
if (!channelData.me.isBroadcaster && !channelData.me.isSuperAdmin) {
this.toaster.addToast('You do not have permission to perform this action.', 6_000, 'error')
return
}

this.modActionButtonModEl!.classList.add('ntv__icon-button--disabled')

if (this.isUserPrivileged()) {
Expand Down
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { KickBadgeProvider } from './Providers/KickBadgeProvider'

class NipahClient {
ENV_VARS = {
VERSION: '1.4.15',
VERSION: '1.4.16',
LOCAL_RESOURCE_ROOT: 'http://localhost:3000/',
// GITHUB_ROOT: 'https://github.com/Xzensi/NipahTV/raw/master',
// GITHUB_ROOT: 'https://cdn.jsdelivr.net/gh/Xzensi/NipahTV@master',
Expand Down

0 comments on commit 013f58e

Please sign in to comment.