Skip to content

Commit

Permalink
Adds logic to redirect to crafted Url (required for Barron's)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpestana authored and petemill committed Sep 30, 2019
1 parent c950fe1 commit bf94520
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ async function performUnblockForSite (tabId, bypassArgs) {
url
} = bypassArgs
let success = false
const deleteOps = []
if (cookiesToDelete) {
const cookies = await getAllCookies({ domain })
const deleteOps = []
for (var i = cookies.length - 1; i >= 0; i--) {
if (cookiesToDelete.includes(cookies[i].name)) {
let name = cookies[i].name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ function detectBypassablePaywall() {

function bypassPaywall() {
console.log('Wallbreaker [barrons]: bypassing paywall in background script...')
return PerformBypassInBackgroundScript({
// removes URL param `mod=hp_BRIEFLIST` if it exists
const urlReload = document.location.href.split("mod=hp_BRIEFLIST").join();
const didBypass = PerformBypassInBackgroundScript({
cookiesToDelete: [ 'cX_P' ],
cookiesToExtend: [],
domain: ".barrons.com",
url: "https://barrons.com",
url: "https://www.barrons.com/",
})
return { didBypass, urlReload }
}

new WallbreakerController({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export default class WallbreakerController {

async bypassPaywall() {
// Perform site-specific bypass
const didBypass = await this.fnBypassPaywall()
const bypass = await this.fnBypassPaywall()
// Return status to background so can
// report on bypass or reload this and relevant tabs
if (didBypass) {
if (bypass.didBypass) {
sendBackgroundMessage({
type: 'did-bypass-paywall',
publisherHost: this.publisherId,
urlToShow: this.currentPageUrl
urlToShow: bypass.urlReload ? bypass.urlReload : this.currentPageUrl
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ function detectBypassablePaywall() {

function bypassPaywall() {
console.log('Wallbreaker [barrons]: bypassing paywall...')
return PerformBypassInBackgroundScript({
const didBypass = PerformBypassInBackgroundScript({
cookiesToDelete: [ 'rplm2', 'rplmct' ],
cookiesToExtend: [],
domain: ".washingtonpost.com",
url: "https://washingtonpost.com",
})
return { didBypass }
}

new WallbreakerController({
Expand Down

0 comments on commit bf94520

Please sign in to comment.