Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

removes fetch override #10

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ async function buildCookieValue(accountName: string): Promise<string | null> {

return cookies
.map((cookie) => `${cookie.name}=${cookie.value}`)
.concat(`__account__=${accountName}`)
.join('; ')
}

Expand Down Expand Up @@ -83,7 +82,7 @@ async function buildAddRules(): Promise<DeclarativeNetRequest.Rule[]> {
],
},
condition: {
regexFilter: `${rule.urlPattern}|__account__=${rule.account}`,
regexFilter: `${rule.urlPattern}`,
resourceTypes: RESOURCE_TYPES,
},
})
Expand Down Expand Up @@ -188,7 +187,7 @@ function interceptRequests() {

const autoSwitchRules = await ruleService.getAll()
for (const rule of autoSwitchRules) {
const urlPattern = `${rule.urlPattern}|__account__=${rule.account}`
const urlPattern = `${rule.urlPattern}`
if (new RegExp(urlPattern).test(details.url)) {
const cookieValue = await buildCookieValue(rule.account)
if (cookieValue) {
Expand Down
9 changes: 0 additions & 9 deletions src/content/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import './index.css'
// Script that will be injected in the main page
import { createElement } from './createElement'
import injectedScript from './injected?script&module'
import { ACCOUNT_ITEM_CLASS, ACCOUNT_REMOVE_CLASS, ADD_ACCOUNT_BUTTON_ID, createAccountItem, createAddAccountLink, createDivider } from './ui'

async function addSwitchUserMenu(logoutForm: HTMLFormElement) {
Expand Down Expand Up @@ -84,13 +83,6 @@ async function switchAccount(account: string) {
}
}

function injectScript() {
const script = document.createElement('script')
script.src = browser.runtime.getURL(injectedScript)
script.type = 'module'
document.head.prepend(script)
}

function ready(fn: () => void) {
if (document.readyState !== 'loading') {
fn()
Expand Down Expand Up @@ -126,7 +118,6 @@ function watchDom() {
}

async function init() {
injectScript()
ready(watchDom)

document.addEventListener('click', (event) => {
Expand Down
68 changes: 0 additions & 68 deletions src/content/injected.ts

This file was deleted.