Skip to content

Commit

Permalink
Fix: Content script fetch requests result in XSRF cross-origin forger…
Browse files Browse the repository at this point in the history
…y failure #42

Chore: Firefox manifest changes
  • Loading branch information
Xzensi committed Jun 6, 2024
1 parent db24bc5 commit f314ae2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
12 changes: 8 additions & 4 deletions manifest-firefox-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
"name": "NipahTV",
"short_name": "NTV",
"author": "Xzensi",
"description": "A Better Kick and 7TV Emote Integration for Kick.",
"homepage_url": "https://nipahtv.com",
"description": "Transform your chat experience on Kick with new features, emotes and performance improvements.",
"version": "{{VERSION}}",
"icons": {
"48": "assets/img/icons/border-48.png"
"16": "assets/img/NTV_icon_16.png",
"48": "assets/img/NTV_icon_48.png",
"96": "assets/img/NTV_icon_96.png",
"128": "assets/img/NTV_icon_128.png"
},
"permissions": ["https://7tv.io/*"],
"permissions": ["https://kick.com/*", "https://7tv.io/*"],
"background": {
"scripts": ["service-worker.js"],
"persistent": false,
Expand All @@ -21,7 +25,7 @@
"css": ["style.min.css"]
}
],
"web_accessible_resources": ["assets/*.png", "assets/btn/*.png"],
"web_accessible_resources": ["assets/img/*.png", "assets/btn/*.png"],
"browser_specific_settings": {
"gecko": {
"id": "{69696969-6969-6969-6969-696969696969}"
Expand Down
1 change: 1 addition & 0 deletions src/NetworkInterfaces/KickNetworkInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export class KickNetworkInterface extends AbstractNetworkInterface {
const responseChannelMeData = await REST.get(`https://kick.com/api/v2/channels/${channelName}/me`).catch(
() => {}
)

if (responseChannelMeData) {
Object.assign(channelData, {
me: {
Expand Down
2 changes: 2 additions & 0 deletions src/UserInterface/KickUserInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export class KickUserInterface extends AbstractUserInterface {

// TODO move methods like this to super class. this.elm.textfield event can be in contentEditableEditor
async loadEmoteMenu() {
if (!this.session.channelData.me.is_logged_in) return
if (!this.elm.textField) return error('Text field not loaded for emote menu')

const container = this.elm.textField.parentElement!.parentElement!
Expand Down Expand Up @@ -448,6 +449,7 @@ export class KickUserInterface extends AbstractUserInterface {
loadReplyBehaviour() {
const { inputController } = this
const { channelData } = this.session
if (!channelData.me.is_logged_in) return
if (!inputController) return error('Input controller not loaded for reply behaviour')

const chatMessagesContainerEl = this.elm.chatMessagesContainer
Expand Down
1 change: 1 addition & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class REST {
const urlDomain = new URL(url as string).host.split('.').slice(-2).join('.')
if (currentDomain === urlDomain) {
options.credentials = 'include'
options.referrer = window.location.origin + window.location.pathname

const XSRFToken = getCookie('XSRF')
if (XSRFToken) {
Expand Down

0 comments on commit f314ae2

Please sign in to comment.