Skip to content

Commit

Permalink
Removes PIA
Browse files Browse the repository at this point in the history
Resolves brave#14763

Auditors:

Test Plan:
  • Loading branch information
NejcZdovc committed Jul 18, 2018
1 parent 7ebee8e commit 589a62e
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 103 deletions.
9 changes: 0 additions & 9 deletions app/browser/api/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -1591,15 +1591,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
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
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,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
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 589a62e

Please sign in to comment.