Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #14774 from NejcZdovc/fix/#14763-pia
Browse files Browse the repository at this point in the history
Removes PIA
  • Loading branch information
NejcZdovc committed Jul 18, 2018
1 parent 33387a6 commit 3258025
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 116 deletions.
14 changes: 0 additions & 14 deletions app/browser/api/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -1589,15 +1589,6 @@ const roundtrip = (params, options, callback) => {
parts = underscore.extend(underscore.pick(parts, ['protocol', 'hostname', 'port']),
underscore.omit(params, ['headers', 'payload', 'timeout']))

// TBD: let the user configure this via preferences [MTR]
if (params.useProxy) {
if (parts.hostname === 'ledger.brave.com') {
parts.hostname = 'ledger-proxy.privateinternetaccess.com'
} else if (parts.hostname === 'ledger.mercury.basicattentiontoken.org') {
parts.hostname = 'mercury-proxy.privateinternetaccess.com'
}
}

// Use alternate hostname if it's provided
parts.hostname = params.altHostname || parts.hostname

Expand Down Expand Up @@ -1642,11 +1633,6 @@ const roundtrip = (params, options, callback) => {
if (err) return callback(err, response)

if (Math.floor(response.statusCode / 100) !== 2) {
if (params.useProxy && response.statusCode === 403) {
params.useProxy = false
return module.exports.roundtrip(params, options, callback)
}

return callback(
new Error('HTTP response ' + response.statusCode + ' for ' + params.method + ' ' + params.path),
response)
Expand Down
Binary file removed app/extensions/brave/img/private_internet_access.png
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion app/extensions/brave/locales/en-US/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ paymentInProgress=Currently processing
payments=Payments
paymentsFAQLink.title=View the FAQ
paymentsSidebarText1=Our Partners
paymentsSidebarText2=All transaction IP addresses are anonymized with technology from:
paymentsSidebarText3=Brave BAT Wallets are provided through a partnership with:
paymentsWelcomeLink=View the FAQ
paymentsWelcomeText1=To start using Brave Payments, simply flip the switch at the top of this window.
Expand Down
10 changes: 0 additions & 10 deletions app/renderer/components/preferences/payment/disabledContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ const cx = require('../../../../../js/lib/classSet')
// style
const globalStyles = require('../../styles/global')
const commonStyles = require('../../styles/commonStyles')
const PIA = require('../../../../extensions/brave/img/private_internet_access.png')
const PIA2 = require('../../../../extensions/brave/img/private_internet_access_2x.png')
const uphold = require('../../../../extensions/brave/img/ledger/uphold_logo_small.png')
const uphold2 = require('../../../../extensions/brave/img/ledger/uphold_logo_medium.png')

Expand Down Expand Up @@ -91,8 +89,6 @@ class DisabledContent extends ImmutableComponent {
</div>
<div className={css(styles.disabledContent__sidebar)}>
<h2 className={css(styles.disabledContent__sidebar__header)} data-l10n-id='paymentsSidebarText1' />
<div className={css(styles.disabledContent__sidebar__text)} data-l10n-id='paymentsSidebarText2' />
<a href='https://www.privateinternetaccess.com/' rel='noopener' target='_blank'><span className={css(styles.disabledContent__sidebar__logo, styles.disabledContent__sidebar__logo_PIA)} /></a>
<div className={css(styles.disabledContent__sidebar__text)} data-l10n-id='paymentsSidebarText3' />
<a href='https://uphold.com/' rel='noopener' target='_blank'><span className={css(styles.disabledContent__sidebar__logo, styles.disabledContent__sidebar__logo_uphold)} /></a>
</div>
Expand Down Expand Up @@ -167,12 +163,6 @@ const styles = StyleSheet.create({
display: 'block'
},

disabledContent__sidebar__logo_PIA: {
backgroundImage: `-webkit-image-set(url(${PIA}) 1x, url(${PIA2}) 2x)`,
width: '195px',
height: '20px'
},

disabledContent__sidebar__logo_uphold: {
backgroundImage: `-webkit-image-set(url(${uphold}) 1x, url(${uphold2}) 2x)`,
backgroundSize: 'contain',
Expand Down
91 changes: 0 additions & 91 deletions test/unit/app/browser/api/ledgerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -903,97 +903,6 @@ describe('ledger api unit tests', function () {
assert.deepEqual(state.toJS(), expectedState.toJS())
})
})

describe('roundtrip', function () {
let requestStub
const simpleCallback = sinon.stub()
let responseCode = 200

before(function () {
requestStub = sinon.stub(request, 'request', (options, callback) => {
switch (responseCode) {
case 403:
callback(null, {
statusCode: 403,
headers: {},
statusMessage: '<html><body>Your requested URL has been blocked by the URL Filter database module of {{EnterpriseName}}. The URL is listed in categories that are not allowed by your administrator at this time.</body></html>',
httpVersionMajor: 1,
httpVersionMinor: 1
})
break
case 200:
default:
callback(null, {
statusCode: 200,
headers: {},
statusMessage: '',
httpVersionMajor: 1,
httpVersionMinor: 1
}, {timestamp: '6487805648321904641'})
}
})
})

after(function () {
requestStub.restore()
})

describe('when params.useProxy is true', function () {
let expectedOptions
before(function () {
expectedOptions = {
url: 'https://ledger-proxy.privateinternetaccess.com/v3/publisher/timestamp',
method: 'GET',
payload: undefined,
responseType: 'text',
headers: {
'content-type': 'application/json; charset=utf-8',
'user-agent': ''
},
verboseP: undefined
}
requestStub.reset()
simpleCallback.reset()
ledgerApi.roundtrip({
server: 'https://ledger.brave.com',
path: '/v3/publisher/timestamp',
useProxy: true
}, {}, simpleCallback)
})

it('updates URL to use proxy (ledger-proxy.privateinternetaccess.com)', function () {
assert(requestStub.withArgs(expectedOptions, sinon.match.func).called)
})

it('calls the callback on success', function () {
assert(simpleCallback.calledOnce)
})

describe('when the proxy returns a 403', function () {
before(function () {
responseCode = 403
requestStub.reset()
ledgerApi.roundtrip({
server: 'https://ledger.brave.com',
path: '/v3/publisher/timestamp',
useProxy: true
}, {}, simpleCallback)
})
after(function () {
responseCode = 200
})
it('calls request a second time (with useProxy = false)', function () {
assert(requestStub.calledTwice)
assert(requestStub.withArgs(expectedOptions, sinon.match.func).called)

const secondCallOptions = Object.assign({}, expectedOptions, {
url: 'https://ledger.brave.com/v3/publisher/timestamp'
})
assert(requestStub.withArgs(secondCallOptions, sinon.match.func).called)
})
})
})
})
})

describe('when timing needs to be checked', function () {
Expand Down

0 comments on commit 3258025

Please sign in to comment.