Xzensi / NipahTV

✨ NipahTV - A Better Kick and 7TV Emote Extension for Kick ✨
https://nipahtv.com
7 stars 2 forks source link

nipah not working on kick and badge disappeared got an error message now can someone help me please #192

Closed justagirl33 closed 4 hours ago

justagirl33 commented 1 day ago

i opened kick today no nipah badge and no nipah, i removed it several times from chrome and reinstalled it tried a few things i have no idea where it is, can someone help please?

justagirl33 commented 1 day ago

image

26342 26343 26344 26345 26346 26347 26348 26349 26350 26351 26352 26353 26354 26355 26356 26357 26358 26359 26360 26361 26362 26363 26364 26365 26366 26367 26368 26369 26370 26371 26372 26373 26374 26375 26376 26377 26378 26379 26380 26381 26382 26383 26384 26385 26386 26387 26388 26389 26390 26391 26392 26393 26394 26395 26396 26397 26398 26399 26400 26401 26402 26403 26404 26405 26406 26407 26408 26409 26410 26411 26412 26413 26414 26415 26416 26417 26418 26419 26420 26421 26422 26423 26424 26425 26426 26427 26428 26429 26430 26431 26432 26433 26434

<25435 lines not shown> static createImageBackground(imageUrl) { return `background-image: url('${imageUrl}'); background-size: 100% auto;`; } static createShadowEffects(shadows) { if (!shadows?.length) return "filter: '';"; const dropShadows = shadows.map((shadow) => { const color = _SevenTVPaintStyleGenerator.convertColorToHex(shadow.color); return `drop-shadow(${color} ${shadow.x_offset}px ${shadow.y_offset}px ${shadow.radius}px)`; }); return `filter: ${dropShadows.join(" ")};`; } static generateCSSRules(paint, shadows) { const rules = []; switch (paint.function) { case "LINEAR_GRADIENT": rules.push(_SevenTVPaintStyleGenerator.createLinearGradient(paint)); break; case "RADIAL_GRADIENT": rules.push(_SevenTVPaintStyleGenerator.createRadialGradient(paint)); break; case "URL": rules.push(_SevenTVPaintStyleGenerator.createImageBackground(paint.image_url)); break; } if (shadows) rules.push(_SevenTVPaintStyleGenerator.createShadowEffects(paint.shadows ?? [])); return rules.filter(Boolean).join(""); } }; // dist/chrome/src/Extensions/SevenTV/index.ts var logger34 = new Logger(); var { log: log32, info: info31, error: error34 } = logger34.destruct(); var SevenTV; ((SevenTV2) => { let EmoteLifecycle; ((EmoteLifecycle2) => { EmoteLifecycle2[EmoteLifecycle2["DELETED"] = 0] = "DELETED"; EmoteLifecycle2[EmoteLifecycle2["PENDING"] = 1] = "PENDING"; EmoteLifecycle2[EmoteLifecycle2["PROCESSING"] = 2] = "PROCESSING"; EmoteLifecycle2[EmoteLifecycle2["DISABLED"] = 3] = "DISABLED"; EmoteLifecycle2[EmoteLifecycle2["LIVE"] = 4] = "LIVE"; EmoteLifecycle2[EmoteLifecycle2["FAILED"] = 5] = "FAILED"; })(EmoteLifecycle = SevenTV2.EmoteLifecycle || (SevenTV2.EmoteLifecycle = {})); let EmoteFlags; ((EmoteFlags2) => { EmoteFlags2[EmoteFlags2["PRIVATE"] = 1] = "PRIVATE"; EmoteFlags2[EmoteFlags2["AUTHENTIC"] = 2] = "AUTHENTIC"; EmoteFlags2[EmoteFlags2["ZERO_WIDTH"] = 256] = "ZERO_WIDTH"; })(EmoteFlags = SevenTV2.EmoteFlags || (SevenTV2.EmoteFlags = {})); let EmoteSetFlags; ((EmoteSetFlags2) => { })(EmoteSetFlags = SevenTV2.EmoteSetFlags || (SevenTV2.EmoteSetFlags = {})); let ObjectKind; ((ObjectKind2) => { ObjectKind2[ObjectKind2["USER"] = 1] = "USER"; ObjectKind2[ObjectKind2["EMOTE"] = 2] = "EMOTE"; ObjectKind2[ObjectKind2["EMOTE_SET"] = 3] = "EMOTE_SET"; ObjectKind2[ObjectKind2["ROLE"] = 4] = "ROLE"; ObjectKind2[ObjectKind2["ENTITLEMENT"] = 5] = "ENTITLEMENT"; ObjectKind2[ObjectKind2["BAN"] = 6] = "BAN"; ObjectKind2[ObjectKind2["MESSAGE"] = 7] = "MESSAGE"; ObjectKind2[ObjectKind2["REPORT"] = 8] = "REPORT"; ObjectKind2[ObjectKind2["PRESENCE"] = 9] = "PRESENCE"; ObjectKind2[ObjectKind2["COSMETIC"] = 10] = "COSMETIC"; })(ObjectKind = SevenTV2.ObjectKind || (SevenTV2.ObjectKind = {})); })(SevenTV || (SevenTV = {})); function getStvPlatformId() { switch (PLATFORM) { case "twitch" /* TWITCH */: return "TWITCH"; case "kick" /* KICK */: return "KICK"; case "youtube" /* YOUTUBE */: return "YOUTUBE"; } error34("EXT:STV", "MAIN", "Unsupported platform:", PLATFORM); return "UNKNOWN"; } var SevenTVExtension = class extends Extension { name = "7TV"; version = "1.0.0"; description = "7TV extension for emote support"; database; datastore; sessionCreateCb; sessionDestroyCb; renderMessageMiddleware; paintSheet = null; eventAPI = null; cachedStvMeUser = null; // private cachedStvChannelUser: Pick | null = null constructor(rootContext, sessions) { super(rootContext, sessions); this.sessionCreateCb = this.onSessionCreate.bind(this); this.sessionDestroyCb = this.onSessionDestroy.bind(this); } async init() { this.database = false ? DatabaseProxyFactory2.create("NTV_Ext_SevenTV", new SevenTVDatabase()) : DatabaseProxyFactory2.create("NTV_Ext_SevenTV"); return this.loadDatabase().then(async () => { return this.rootContext.settingsManager.loadSettings(); }).then(() => { this.datastore = new SevenTVDatastore(this.database); this.hookRenderMessagePipeline(this.datastore); }); } static getExtensionDatabase() { return new SevenTVDatabase(import_wrapper_default); } loadDatabase() { return new Promise((resolve, reject) => { if (!this.database) return reject("Database is not initialized"); this.database.checkCompatibility().then(() => { log32("EXT:STV", "INIT", "SevenTV database passed compatibility check."); resolve(void 0); }).catch((err) => { error34("EXT:STV", "INIT", "Failed to open SevenTV database because:", err); reject(); }); }); } onEnable() { info31("EXT:STV", "INIT", "Enabling extension:", this.name, this.version); const { eventBus: rootEventBus, settingsManager } = this.rootContext; this.init().then(async () => { this.eventAPI = new SevenTVEventAPI(this.rootContext, this.datastore); this.eventAPI.connect(); this.eventAPI.addEventListener( "paint_created", ((event) => { this.handlePaintCreated(event); }).bind(this) ); this.eventAPI.addEventListener( "paint_entitled", ((event) => { this.handlePaintEntitled(event); }).bind(this) ); if (rootEventBus.hasFiredEvent("ntv.session.create")) this.sessions.forEach(this.onSessionCreate.bind(this)); rootEventBus.subscribe("ntv.session.create", this.sessionCreateCb); rootEventBus.subscribe("ntv.session.destroy", this.sessionDestroyCb); }).catch((err) => { error34("EXT:STV", "INIT", "Failed to initialize SevenTV extension", err); }); } onDisable() { info31("EXT:STV", "MAIN", "Disabling extension:", this.name, this.version); const { eventBus: rootEventBus } = this.rootContext; if (this.eventAPI) { this.eventAPI.disconnect(); this.eventAPI = null; } this.unhookRenderMessagePipeline(); rootEventBus.unsubscribe("ntv.session.create", this.sessionCreateCb); rootEventBus.unsubscribe("ntv.session.destroy", this.sessionDestroyCb); } async onSessionCreate(session) { const { datastore } = this; const { eventBus } = session; const { settingsManager } = this.rootContext; if (!session.channelData) return error34("EXT:STV", "MAIN", `Skipping session without channel data, you're probably not in a channel..`); const { channelId, userId: channelUserId } = session.channelData; const platformMeUserId = session.meData.userId; this.registerEmoteProvider(session); if (!datastore) return error34("EXT:STV", "MAIN", "Datastore is not initialized, cannot add session:", session); if (!this.eventAPI) return error34("EXT:STV", "MAIN", "Event API is not initialized, cannot add session:", session); const STV_ID_NULL = "00000000000000000000000000"; const platformId = getStvPlatformId(); let promises = []; if (!this.cachedStvMeUser) { promises.push( getUserCosmeticDataByConnection(platformId, platformMeUserId).then((res) => res?.userByConnection ?? { id: STV_ID_NULL }).then((user) => { if (user.id === STV_ID_NULL) info31( "EXT:STV", "MAIN", "SevenTV failed to get user, looks like you don't have a 7TV account.." ); return this.cachedStvMeUser = user; }).then((user) => { if (user.id === STV_ID_NULL) return; (async () => { const paint = user.style?.paint; if (paint) { datastore.createEntitlement({ id: STV_ID_NULL, kind: "PAINT", ref_id: paint.id, user }); datastore.createCosmetic({ id: paint.id, kind: "PAINT", data: paint }); this.handlePaintCreated(new CustomEvent("paint_created", { detail: paint })); } })(); }).catch((err) => this.cachedStvMeUser = { id: STV_ID_NULL }) ); } promises.push( getUserEmoteSetConnectionsDataByConnection(getStvPlatformId(), channelUserId).then((res) => res ?? { id: STV_ID_NULL }).catch((err) => { id: STV_ID_NULL; }) ); const promiseRes = await Promise.allSettled(promises); const channelUser = promiseRes[promiseRes.length - 1].status === "fulfilled" ? ( //@ts-ignore promiseRes[promiseRes.length - 1].value ) : { id: STV_ID_NULL }; let activeEmoteSet; if (channelUser.id !== STV_ID_NULL && "emote_sets" in channelUser && channelUser.emote_sets) { activeEmoteSet = channelUser.emote_sets.find( (set) => set.id === channelUser.connections?.find((c) => c.platform === platformId)?.emote_set_id ); } const stvMeUserId = !this.cachedStvMeUser || this.cachedStvMeUser.id === STV_ID_NULL ? void 0 : this.cachedStvMeUser.id; const room = this.eventAPI.registerRoom(channelUserId, stvMeUserId, activeEmoteSet?.id); if (room && room.userId && room.userId !== STV_ID_NULL) { eventBus.subscribe("ntv.chat.message.new", (message) => { this.eventAPI?.sendPresence(room); }); } } onSessionDestroy(session) { if (this.eventAPI && session.channelData?.userId) { this.eventAPI.removeRoom(session.channelData.userId); } } registerEmoteProvider(session) { session.emotesManager.registerProvider(SevenTVEmoteProvider); } hookRenderMessagePipeline(datastore) { const { settingsManager } = this.rootContext; const renderMessagePipeline = this.rootContext.renderMessagePipeline; this.renderMessageMiddleware = renderMessagePipeline.use( (message, badgesEl, usernameEl, messageParts, next) => { const user = datastore.getUserByName(message.username); if (!user) return next(); const paintCosmeticsEnabledSetting = settingsManager.getSetting( "shared", "ext.7tv.cosmetics.paints.enabled" ); if (paintCosmeticsEnabledSetting) { const paint = datastore.getUserPaint(user.id); if (paint) { usernameEl.setAttribute("seventv-painted-content", "true"); usernameEl.setAttribute("seventv-paint-id", paint.id); usernameEl.style.removeProperty("color"); } } const badgeCosmeticsEnabledSetting = settingsManager.getSetting( "shared", "ext.7tv.cosmetics.badges.enabled" ); if (badgeCosmeticsEnabledSetting) { const badge = datastore.getUserBadge(user.id); if (badge) { const file = badge.host.files.filter((f) => f.format === "WEBP")[0]; if (file) { const badgeEl = document.createElement("img"); badgeEl.classList.add("ntv__badge"); const hostUrl = badge.host.url; badgeEl.setAttribute( "srcset", `${hostUrl}/1x.webp 32w 32h, ${hostUrl}/2x.webp 64w 64h, ${hostUrl}/3x.webp 96w 96h, ${hostUrl}/4x.webp 128w 128h` ); badgeEl.setAttribute("title", badge.tooltip); badgeEl.setAttribute("loading", "lazy"); badgeEl.setAttribute("decoding", "async"); badgeEl.setAttribute("draggable", "false"); badgeEl.setAttribute("height", "" + file.height); badgeEl.setAttribute("width", "" + file.width); badgesEl.appendChild(badgeEl); } } } next(); } ); } unhookRenderMessagePipeline() { if (this.renderMessageMiddleware) this.rootContext.renderMessagePipeline.remove(this.renderMessageMiddleware); } handlePaintCreated(event) { if (!this.paintSheet) { const styleEl = document.createElement("style"); styleEl.id = "ntv__ext-7tv__paint-styles"; (document.head || document.documentElement).appendChild(styleEl); this.paintSheet = styleEl.sheet; if (!this.paintSheet) return error34("EXT:STV", "MAIN", "Failed to create CSSStyleSheet", styleEl); this.paintSheet.insertRule( `[seventv-painted-content="true"] { background-color: currentcolor; }`, this.paintSheet.cssRules.length ); this.paintSheet.insertRule( `[seventv-paint-id] { -webkit-text-fill-color: transparent; background-clip: text !important; -webkit-background-clip: text !important; font-weight: 700; }`, this.paintSheet.cssRules.length ); } const paint = event.detail; const selector = `[seventv-paint-id="${paint.id}"]`; for (let i = 0; i < this.paintSheet.cssRules.length; i++) { const rule = this.paintSheet.cssRules[i]; if (rule instanceof CSSStyleRule && rule.selectorText === selector) return; } const paintShadowsEnabledSetting = this.rootContext.settingsManager.getSetting( "shared", "ext.7tv.cosmetics.paints.shadows.enabled" ); const cssRules = SevenTVPaintStyleGenerator.generateCSSRules(paint, paintShadowsEnabledSetting); this.paintSheet.insertRule(`${selector} {${cssRules}}`, this.paintSheet.cssRules.length); } handlePaintEntitled(event) { const user = event.detail; const paint = this.datastore?.getUserPaint(user.id); if (!paint) return; const displayName = user.display_name.replaceAll('"', """).replaceAll("'", "'"); const chatMessages = document.querySelectorAll( `.ntv__chat-message__username[title="${displayName}"]` ); for (const message of chatMessages) { message.setAttribute("seventv-painted-content", "true"); message.setAttribute("seventv-paint-id", paint.id); message.style.removeProperty("color"); } } }; // dist/chrome/src/Extensions/Botrix/BotrixInputCompletionStrategy.ts var logger35 = new Logger(); var { log: log33, info: info32, error: error35 } = logger35.destruct(); var BotrixInputCompletionStrategy = class extends AbstractInputCompletionStrategy { constructor(rootContext, session, contentEditableEditor, navListWindowManager, { botrixSessionManager }) { super(rootContext, session, contentEditableEditor, navListWindowManager); this.rootContext = rootContext; this.session = session; this.contentEditableEditor = contentEditableEditor; this.navListWindowManager = navListWindowManager; } id = "botrix"; isFullLineStrategy = true; shouldUseStrategy(event, contentEditableEditor) { const firstChar = contentEditableEditor.getFirstCharacter(); return firstChar === "!" || event instanceof KeyboardEvent && event.key === "!" && contentEditableEditor.isInputEmpty(); } maybeCreateNavWindow() { if (this.navWindow) return; this.navWindow = this.navListWindowManager.createNavWindow(this.id); this.navWindow.addEventListener("entry-click", (event) => { this.renderInlineCompletion(); }); } updateCompletionEntries() { if (!this.navWindow) return error35("EXT:BTX", "MAIN", "Tab completion window does not exist yet"); } renderInlineCompletion() { if (!this.navWindow) return error35("EXT:BTX", "MAIN", "Tab completion window does not exist yet"); const selectedEntry = this.navWindow.getSelectedEntry(); if (!selectedEntry) return error35("EXT:BTX", "MAIN", "No selected entry to render completion"); const { name } = selectedEntry; this.contentEditableEditor.clearInput(); this.contentEditableEditor.insertText("!" + name); } moveSelectorUp() { if (!this.navWindow) return error35("EXT:BTX", "MAIN", "No tab completion window to move selector up"); this.navWindow.moveSelectorUp(); this.renderInlineCompletion(); } moveSelectorDown() { if (!this.navWindow) return error35("EXT:BTX", "MAIN", "No tab completion window to move selector down"); this.navWindow.moveSelectorDown(); this.renderInlineCompletion(); } handleKeyDown(event) { } }; // dist/chrome/src/Extensions/Botrix/BotrixExecutionStrategy.ts var BotrixExecutionStrategy = class { constructor(rootContext, session) { this.rootContext = rootContext; this.session = session; } shouldUseStrategy(inputIntentDTO) { return inputIntentDTO.input[0] === "!"; } async route(contentEditableEditor, inputIntentDTO, dontClearInput) { const { networkInterface } = this.session; dontClearInput || contentEditableEditor.clearInput(); if (inputIntentDTO.isReply) { if (!inputIntentDTO.replyRefs) throw new Error("ReplyRefs are required for reply messages."); await networkInterface.sendReply( inputIntentDTO.input, inputIntentDTO.replyRefs.messageId, inputIntentDTO.replyRefs.messageContent, inputIntentDTO.replyRefs.senderId, inputIntentDTO.replyRefs.senderUsername, true ); } else { await networkInterface.sendMessage(inputIntentDTO.input, true); } } }; // dist/chrome/src/Extensions/Botrix/index.ts var logger36 = new Logger(); var { log: log34, info: info33, error: error36 } = logger36.destruct(); var BotrixNetworkInterface = class { static async fetchUserShopItems(userSlug, platformId) { return REST.get(`https://botrix.live/api/public/shop/items?u=${userSlug}&platform=${platformId}`); } }; var BotrixSessionManager = class { constructor(session) { this.session = session; } userShopItems = []; async getUserShopItems() { if (!this.userShopItems.length) { const userSlug = this.session.channelData.channelName; const platformId = PLATFORM; const userShopItems = await BotrixNetworkInterface.fetchUserShopItems(userSlug, platformId); log34("EXT:BTX", "MAIN", "User shop items:", userShopItems); } } }; var BotrixExtension = class extends Extension { name = "Botrix"; version = "1.0.0"; description = "Botrix extension for the botrix completion strategy"; sessionCreateCb; constructor(rootContext, sessions) { super(rootContext, sessions); this.sessionCreateCb = this.onSessionCreate.bind(this); } onEnable() { info33("EXT:BTX", "INIT", "Enabling extension:", this.name, this.version); const { eventBus: rootEventBus, settingsManager } = this.rootContext; this.sessions.forEach(this.onSessionCreate.bind(this)); rootEventBus.subscribe("ntv.session.create", this.sessionCreateCb); } onDisable() { info33("EXT:BTX", "INIT", "Disabling extension:", this.name, this.version); const { eventBus: rootEventBus } = this.rootContext; rootEventBus.unsubscribe("ntv.session.create", this.sessionCreateCb); } onSessionCreate(session) { this.registerSessionExecutionStrategy(session); } registerSessionExecutionStrategy(session) { const { rootContext } = this; session.inputExecutionStrategyRegister.registerStrategy(new BotrixExecutionStrategy(rootContext, session)); } registerSessionCompletionStrategy(session) { const inputController = session.userInterface?.getInputController(); if (!inputController) return error36( "EXT:BTX", "MAIN", `No input controller found for extension ${this.name} with session:`, session ); const inputCompletionStrategyManager = session.inputCompletionStrategyManager; if (!inputCompletionStrategyManager) return error36( "EXT:BTX", "MAIN", `No input completion strategy manager found for extension ${this.name} with session:`, session ); session.inputCompletionStrategyRegister.registerStrategy( new BotrixInputCompletionStrategy( this.rootContext, session, inputController.contentEditableEditor, inputCompletionStrategyManager.navListWindowManager, { botrixSessionManager: new BotrixSessionManager(session) } ) ); } }; // dist/chrome/src/app.ts var logger37 = new Logger(); var { log: log35, info: info34, error: error37 } = logger37.destruct(); var NipahClient = class { VERSION = "1.5.55"; ENV_VARS = { 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', GITHUB_ROOT: "https://raw.githubusercontent.com/Xzensi/NipahTV", RELEASE_BRANCH: "master" }; stylesLoaded = true; eventBus = null; emotesManager = null; rootContext = null; loadSettingsManagerPromise = null; database = null; sessions = []; async initialize() { const { ENV_VARS } = this; info34("CORE", "INIT", `Initializing Nipah client [${this.VERSION}]..`); let resourceRoot; if (false) { info34("CORE", "INIT", "Running in debug mode enabled.."); resourceRoot = ENV_VARS.LOCAL_RESOURCE_ROOT; window.NipahTV = this; } else if (true) { info34("CORE", "INIT", "Running in extension mode.."); resourceRoot = browser.runtime.getURL("/"); } else { resourceRoot = ENV_VARS.GITHUB_ROOT + "/" + ENV_VARS.RELEASE_BRANCH + "/"; } let platform = getPlatformId(); if (platform === "kick" /* KICK */) { info34("CORE", "INIT", "Platform detected: Kick"); } else if (platform === "twitch" /* TWITCH */) { info34("CORE", "INIT", "Platform detected: Twitch"); } else if (platform === "youtube" /* YOUTUBE */) { info34("CORE", "INIT", "Platform detected: Youtube"); } else { return error37("CORE", "INIT", "Unsupported platform", window.location.host); } if (false) { window.NTV_APP_VERSION = this.VERSION; window.NTV_PLATFORM = platform; window.NTV_RESOURCE_ROOT = resourceRoot; window.NTV_BROWSER = await getBrowser(); window.NTV_DEVICE = getDevice(); window.NTV_SUPPORTS_AVIF = await hasSupportForAvif(); } else { window.PLATFORM = platform; window.RESOURCE_ROOT = resourceRoot; window.APP_VERSION = this.VERSION; window.BROWSER = await getBrowser(); window.DEVICE = getDevice(); window.SUPPORTS_AVIF = await hasSupportForAvif(); } Object.freeze(APP_VERSION); Object.freeze(PLATFORM); Object.freeze(RESOURCE_ROOT); Object.freeze(BROWSER); Object.freeze(DEVICE); Object.freeze(SUPPORTS_AVIF); this.attachPageNavigationListener(); this.setupDatabase().then(async () => { window.RESTFromMainService = new RESTFromMain(); window.ReactivePropsFromMain = new ReactivePropsFromMain2(); await this.injectPageScript(); this.setupClientEnvironment().catch( (err) => error37("CORE", "INIT", "Failed to setup client environment.\n\n", err.message) ); }); } injectPageScript() { return new Promise((resolve, reject) => { if (false) { const s = document.createElement("script"); s.src = browser.runtime.getURL("page.js"); s.onload = function() { s.remove(); resolve(void 0); }; s.onerror = function() { error37("CORE", "INIT", "Failed to load page script.."); reject(void 0); }; (document.head || document.documentElement).appendChild(s); } else { resolve(void 0); } }); } setupDatabase() { return new Promise((resolve, reject) => { const database = false ? DatabaseProxyFactory.create("NipahTV", new Database()) : DatabaseProxyFactory.create("NipahTV"); database.checkCompatibility().then(() => { log35("CORE", "INIT", "Database passed compatibility check."); this.database = database; resolve(void 0); }).catch((err) => { error37("CORE", "INIT", "Failed to open database because:", err); reject(); }); }); } async setupClientEnvironment() { const { database } = this; if (!database) throw new Error("Database is not initialized."); info34("CORE", "INIT", "Setting up client environment.."); const rootEventBus = new Publisher("ROOT"); const settingsManager = new SettingsManager({ database, rootEventBus }); settingsManager.initialize(); let eventService; if (PLATFORM === "kick" /* KICK */) { eventService = new KickEventService(); } else if (PLATFORM === "twitch" /* TWITCH */) { eventService = new TwitchEventService(); } else { throw new Error("Unsupported platform"); } this.rootContext = { eventBus: rootEventBus, database, settingsManager, eventService, announcementService: new AnnouncementService(rootEventBus, settingsManager), renderMessagePipeline: new RenderMessagePipeline() }; this.loadExtensions(); this.loadSettingsManagerPromise = settingsManager.loadSettings().then(() => { log35("CORE", "SETUP", "Settings loaded successfully."); const appVersion = settingsManager.getGlobalSetting("app.version"); if (!appVersion || appVersion !== this.VERSION) { settingsManager.setGlobalSetting("app.version", this.VERSION); } const updateAvailableVersion = settingsManager.getGlobalSetting("app.update_available"); if (updateAvailableVersion && updateAvailableVersion <= this.VERSION) { settingsManager.setGlobalSetting("app.update_available", null); } }).catch((err) => { throw new Error(`Couldn't load settings because: ${err}`); }); this.loadAppUpdateBehaviour(rootEventBus); this.doExtensionCompatibilityChecks(); this.createChannelSession(); this.loadReloadUIHack(); } loadAppUpdateBehaviour(rootEventBus) { rootEventBus.subscribe("ntv.app.update", () => { info34("CORE", "MAIN", "Extension update has been requested, reloading extension.."); browser.runtime.sendMessage({ action: "runtime.reload" }).then(() => { info34("CORE", "MAIN", "Reloading page after runtime reload.."); location.reload(); }).catch((err) => { error37("CORE", "MAIN", "Failed to reload extension.", err); location.reload(); }); }); } async loadExtensions() { const rootContext = this.rootContext; if (!rootContext) throw new Error("Root context is not initialized."); const { settingsManager } = rootContext; let sevenTVExtension = null; const enableSevenTVExtension = () => { sevenTVExtension = new SevenTVExtension(rootContext, this.sessions); sevenTVExtension.onEnable(); }; const isSevenTVExtensionEnabled = await settingsManager.getSettingFromDatabase("global.shared.ext.7tv.enabled"); if (isSevenTVExtensionEnabled) enableSevenTVExtension(); rootContext.eventBus.subscribe( "ntv.settings.change.ext.7tv.enabled", ({ value, prevValue }) => { if (value && !prevValue) enableSevenTVExtension(); else if (sevenTVExtension) { sevenTVExtension.onDisable(); sevenTVExtension = null; } } ); const enableBotrixExtension = () => { const extension = new BotrixExtension(rootContext, this.sessions); extension.onEnable(); }; const isBotrixExtensionEnabled = true; if (isBotrixExtensionEnabled) enableBotrixExtension(); } doExtensionCompatibilityChecks() { info34("CORE", "INIT", "Checking for extension compatibility issues.."); const rootContext = this.rootContext; if (!rootContext) throw new Error("Root context is not initialized."); const { announcementService, eventBus: rootEventBus } = rootContext; waitForElements2(["#seventv-site-hosted"], 6e3).then(() => { log35("CORE", "INIT", "Detected SevenTV extension"); const platformName = PLATFORM[0].toUpperCase() + PLATFORM.slice(1); announcementService.registerAnnouncement({ id: "seventv_conflict", title: "NipahTV Compatibility Warning", showDontShowAgainButton: true, showCloseButton: true, message: `

\u26A0\uFE0F 7TV Extension Conflict! \u26A0\uFE0F

The 7TV extension has been found to be enabled on ${platformName}. 7TV is not compatible with NipahTV and will cause issues if both are enabled at the same time. It is possible to keep the 7TV extension for other streaming websites if you want, by disabling the extension for only ${platformName}.

How to disable 7TV extension only just for ${platformName}?

If you want to keep 7TV for other streaming websites instead of uninstalling it completely, please follow the instructions on https://nipahtv.com/seventv_compatibility.

Feel free to join the NipahTV Discord community if you need help with this.


You can ignore this warning if you want, but expect weird issues such as blank and empty messages.

` }); announcementService.displayAnnouncement("seventv_conflict"); }).catch(() => { }); } async createChannelSession() { log35("CORE", "MAIN", `Creating new session for ${window.location.href}...`); const rootContext = this.rootContext; if (!rootContext) throw new Error("Root context is not initialized."); const { settingsManager, eventBus: rootEventBus } = rootContext; const eventBus = new Publisher("SESSION"); const usersManager = new UsersManager({ eventBus, settingsManager }); const session = { eventBus, usersManager, inputCompletionStrategyRegister: new InputCompletionStrategyRegister(), inputExecutionStrategyRegister: new InputExecutionStrategyRegister() }; if (PLATFORM === "kick" /* KICK */) { session.networkInterface = new KickNetworkInterface(session); } else if (PLATFORM === "twitch" /* TWITCH */) { throw new Error("Twitch platform is not supported yet."); } else { throw new Error("Unsupported platform"); } const networkInterface = session.networkInterface; const promiseRes = await Promise.allSettled([ this.loadSettingsManagerPromise, networkInterface.loadMeData().catch((err) => { throw `Couldn't load me data because: ${err.message}`; }), networkInterface.loadChannelData().catch((err) => { throw `Couldn't load channel data because: ${err.message}`; }) ]); for (const res of promiseRes) { if (res.status === "rejected") return error37("CORE", "MAIN", "Failed to create session because:", res.reason); } if (!session.meData) throw new Error("Failed to load me user data."); if (!session.channelData) throw new Error("Failed to load channel data."); this.sessions.push(session); const channelData = session.channelData; eventBus.publish("ntv.channel.loaded.channel_data", channelData); const disableModCreatorView = settingsManager.getSetting( channelData.channelId, "moderators.mod_creator_view.disable_ntv" ); if (disableModCreatorView && (channelData.isModView || channelData.isCreatorView)) { info34("CORE", "MAIN", "NipahTV is disabled for this channel in mod/creator view."); return; } this.attachEventServiceListeners(rootContext, session); session.badgeProvider = new KickBadgeProvider(rootContext, channelData); session.badgeProvider.initialize(); const emotesManager = this.emotesManager = new EmotesManager(rootContext, session); emotesManager.initialize(); session.emotesManager = emotesManager; session.inputExecutionStrategyRegister.registerStrategy(new DefaultExecutionStrategy(rootContext, session)); session.inputExecutionStrategyRegister.registerStrategy(new CommandExecutionStrategy(rootContext, session)); let userInterface; if (PLATFORM === "kick" /* KICK */) { userInterface = new KickUserInterface(rootContext, session); } else { return error37("CORE", "MAIN", "Platform has no user interface implemented..", PLATFORM); } session.userInterface = userInterface; if (PLATFORM === "kick" /* KICK */) { emotesManager.registerProvider(KickEmoteProvider); } else if (PLATFORM === "twitch" /* TWITCH */) { throw new Error("Twitch platform is not supported yet."); } else { throw new Error("Unsupported platform"); } rootEventBus.publish("ntv.session.create", session); if (!this.stylesLoaded) { this.loadStyles().then(() => { this.stylesLoaded = true; userInterface.loadInterface(); }).catch((response) => error37("CORE", "INIT", "Failed to load styles.", response)); } else { userInterface.loadInterface(); } const providerOverrideOrder = [2 /* SEVENTV */, 1 /* KICK */]; emotesManager.loadProviderEmotes(channelData, providerOverrideOrder); } loadReloadUIHack() { const rootContext = this.rootContext; if (!rootContext) throw new Error("Root context is not initialized."); rootContext.eventBus.subscribe("ntv.reload_sessions", () => { this.sessions.forEach((session) => { session.isDestroyed = true; session.eventBus.publish("ntv.session.destroy"); session.eventBus.publish("ntv.session.restore_original"); this.rootContext?.eventBus.publish("ntv.session.destroy", session); }); this.sessions = []; setTimeout(() => this.createChannelSession(), 1e3); }); } attachEventServiceListeners(rootContext, session) { const { eventBus, channelData, meData } = session; if (channelData.isVod) return; rootContext.eventService.subToChatroomEvents(channelData); rootContext.eventService.addEventListener(channelData, "MESSAGE", (message) => { eventBus.publish("ntv.chat.message.new", message, true); }); rootContext.eventService.addEventListener(channelData, "CHATROOM_UPDATED", (chatroomData) => { const oldChatroomData = channelData.chatroom; if (oldChatroomData?.emotesMode?.enabled !== chatroomData.emotesMode?.enabled) { eventBus.publish("ntv.channel.chatroom.emotes_mode.updated", chatroomData.emotesMode); } else if (oldChatroomData?.subscribersMode?.enabled !== chatroomData.subscribersMode?.enabled) { eventBus.publish("ntv.channel.chatroom.subscribers_mode.updated", chatroomData.subscribersMode); } else if (oldChatroomData?.followersMode?.enabled !== chatroomData.followersMode?.enabled || oldChatroomData?.followersMode?.min_duration !== chatroomData.followersMode?.min_duration) { eventBus.publish("ntv.channel.chatroom.followers_mode.updated", chatroomData.followersMode); } else if (oldChatroomData?.slowMode?.enabled !== chatroomData.slowMode?.enabled || oldChatroomData?.slowMode?.messageInterval !== chatroomData.slowMode?.messageInterval) { eventBus.publish("ntv.channel.chatroom.slow_mode.updated", chatroomData.slowMode); } channelData.chatroom = chatroomData; eventBus.publish("ntv.channel.chatroom.updated", chatroomData); }); let unbanTimeoutHandle = null; rootContext.eventService.addEventListener(channelData, "USER_BANNED", (data) => { eventBus.publish("ntv.channel.chatroom.user.banned", data); if (data.user.id === meData.userId) { log35("CORE", "MAIN", "You have been banned from the channel.."); session.channelData.me.isBanned = { bannedAt: (/* @__PURE__ */ new Date()).toISOString(), expiresAt: data.expiresAt, permanent: data.permanent, reason: "" // Reason is not provided by Kick here }; eventBus.publish("ntv.channel.chatroom.me.banned", data); if (unbanTimeoutHandle) clearTimeout(unbanTimeoutHandle); if (!data.permanent) { unbanTimeoutHandle = setTimeout(() => { delete session.channelData.me.isBanned; eventBus.publish("ntv.channel.chatroom.me.unbanned"); }, data.duration * 60 * 1e3); } } }); rootContext.eventService.addEventListener(channelData, "USER_UNBANNED", (data) => { eventBus.publish("ntv.channel.chatroom.user.unbanned", data); if (data.user.id === meData.userId) { if (unbanTimeoutHandle) clearTimeout(unbanTimeoutHandle); log35("CORE", "MAIN", "You have been unbanned from the channel.."); delete session.channelData.me.isBanned; eventBus.publish("ntv.channel.chatroom.me.unbanned"); } }); } loadStyles() { if (true) return Promise.resolve(); return new Promise((resolve, reject) => { info34("CORE", "INIT", "Injecting styles.."); if (false) { GM_xmlhttpRequest({ method: "GET", url: RESOURCE_ROOT + "dist/userscript/kick.css", onerror: () => reject("Failed to load local stylesheet"), onload: function(response) { log35("CORE", "MAIN", "Loaded styles from local resource.."); GM_addStyle(response.responseText); resolve(void 0); } }); } else { let style; switch (PLATFORM) { case "kick" /* KICK */: style = "KICK_CSS"; break; default: return reject("Unsupported platform"); } const stylesheet = GM_getResourceText(style); if (!stylesheet) return reject("Failed to load stylesheet"); if (stylesheet.substring(0, 4) === "http") { reject("Invalid stylesheet resource."); } GM_addStyle(stylesheet); resolve(void 0); } }); } attachPageNavigationListener() { info34("CORE", "MAIN", "Current URL:", window.location.href); let locationURL = window.location.href; let channelName = null; const navigateFn = () => { if (locationURL === window.location.href) return; if (window.location.pathname.match("^/[a-zA-Z0-9]{8}(?:-[a-zA-Z0-9]{4,12}){4}/.+")) return; const prevLocation = locationURL; const newLocation = window.location.href; locationURL = newLocation; log35("CORE", "MAIN", "Navigated to:", newLocation); const prevSession = this.sessions[0]; const prevChannelName = prevSession.channelData.channelName;
justagirl33 commented 1 day ago

26342 const prevChannelName = prevSession.channelData.channelName; error message

Xzensi commented 1 day ago

Ah, thats no good. Thanks for reporting! I'll fix it asap.

Xzensi commented 1 day ago

The issue should be fixed now. Could you kindly perform a manual update and tell me if this fixed it for you? The update should be available in about at most a hour from the moment I posted this.

If you're not sure how to manually update, in Chrome go to extensions and in top of screen click on "Developer mode". New buttons will appear, one of which is "Update".

image

and

image

(I've got dark theme, might be white for you)

justagirl33 commented 1 day ago

thank you so much

On Sun, Nov 3, 2024 at 1:35 PM Xzensi @.***> wrote:

Ah, thats no good. Thanks for reporting! I'll fix it asap.

— Reply to this email directly, view it on GitHub https://github.com/Xzensi/NipahTV/issues/192#issuecomment-2453525408, or unsubscribe https://github.com/notifications/unsubscribe-auth/BMQVOV7ZHCTSHSM5IWGQ2BLZ6ZUFFAVCNFSM6AAAAABRCXFGGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJTGUZDKNBQHA . You are receiving this because you authored the thread.Message ID: @.***>

Xzensi commented 4 hours ago

Assuming it's fixed now I'll close this issue. Let me know if it's still giving you problems and I'll reopen it.

justagirl33 commented 4 hours ago

oh ok yes i do not know how but now you told me i will yes it is working, thank you very much 🙂

On Mon, Nov 4, 2024 at 1:11 PM Xzensi @.***> wrote:

Closed #192 https://github.com/Xzensi/NipahTV/issues/192 as completed.

— Reply to this email directly, view it on GitHub https://github.com/Xzensi/NipahTV/issues/192#event-15108394444, or unsubscribe https://github.com/notifications/unsubscribe-auth/BMQVOV3RIM6CBUMOILRGFSLZ662EFAVCNFSM6AAAAABRCXFGGGVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJVGEYDQMZZGQ2DINA . You are receiving this because you authored the thread.Message ID: @.***>