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

Commit

Permalink
Revert "Merge pull request #13115 from brave/feature/publisher-reques…
Browse files Browse the repository at this point in the history
…t-api"

This reverts commit 14741d4.
  • Loading branch information
bsclifton committed Mar 19, 2018
1 parent 56a3d76 commit 5593d21
Show file tree
Hide file tree
Showing 10 changed files with 408 additions and 1,441 deletions.
77 changes: 0 additions & 77 deletions app/browser/api/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -1394,77 +1394,6 @@ const clientprep = () => {
_internal.verboseP = ledgerClient.prototype.boolion(process.env.LEDGER_PUBLISHER_VERBOSE)
}

/**
* This callback that we do it in roundtrips
*
* @callback roundtripCallback
* @param {Error|null} error - error when doing a request, null if no errors
* @param {object} response - response object that we get from request.request
* @param {any} payload - data that we get from the request
*/

/**
* Round trip for fetching data (scrap data from html) inside window process
* @param {object} params - contains params from roundtrip
* @param {string} params.url - url of the site that we want to scrap
* @param {string} params.verboseP - tells us if we want to log the process or not
* @param {roundtripCallback} callback - The callback that handles the response
*/
const roundTripFromWindow = (params, callback) => {
if (!callback) {
return
}

if (!params || !params.url) {
if (params && params.verboseP) {
console.log(`We are missing url. Params ${JSON.stringify(params)}`)
}

callback(new Error('Url is missing'))
return
}

request.fetchPublisherInfo(params.url, {
method: 'GET',
responseType: 'text',
headers: {
'content-type': 'application/json; charset=utf-8'
}
}, (error, body) => {
if (error) {
if (params.verboseP) {
console.log(`roundTripFromWindow error: ${error.toString()}`)
}
return callback(error)
}

if (params.verboseP) {
console.log(`roundTripFromWindow success: ${JSON.stringify(body)}`)
}

return callback(null, null, body)
})
}

/**
* Round trip function for executing actions
* from the bat libraries (mostly server calls)
* @param {object} params - params that are directly tied to request.request
* @param {string} params.server - server url
* @param {string} params.method - HTTP method (GET, PUT, etc)
* @param {object} params.payload - payload that we want to send to the server
* @param {object} params.headers - HTTP headers
* @param {string} params.path - relative path to requested url
* @param {object} options
* @param {boolean} options.verboseP - tells us if we want to log the process or not
* @param {object} options.headers - headers that are used in the request.request
* @param {string} options.server - server url
* @param {boolean} options.binaryP - are we receiving binary payload back
* @param {boolean} options.rawP - are we receiving raw payload back
* @param {boolean} options.scrapeP - are we doping scraping
* @param {boolean} options.windowP - do we want to run this request in the window process
* @param {roundtripCallback} callback - The callback that handles the response
*/
const roundtrip = (params, options, callback) => {
let parts = typeof params.server === 'string' ? urlParse(params.server)
: typeof params.server !== 'undefined' ? params.server
Expand Down Expand Up @@ -1493,11 +1422,6 @@ const roundtrip = (params, options, callback) => {
parts.pathname = parts.path
}

if (options.windowP) {
roundTripFromWindow({url: urlFormat(parts), verboseP: options.verboseP}, callback)
return
}

options = {
url: urlFormat(parts),
method: params.method,
Expand Down Expand Up @@ -2924,7 +2848,6 @@ const getMethods = () => {
activityRoundTrip,
pathName,
onReferralInit,
roundTripFromWindow,
onReferralCodeRead,
onVerifiedPStatus
}
Expand Down
9 changes: 3 additions & 6 deletions app/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ let generateBraveManifest = () => {
manifest_version: 2,
version: '1.0',
background: {
scripts: [ 'content/scripts/metaScraper.js', 'content/scripts/requestHandler.js', 'content/scripts/idleHandler.js' ],
scripts: [ 'content/scripts/idleHandler.js' ],
persistent: true
},
content_scripts: [
Expand Down Expand Up @@ -187,19 +187,16 @@ let generateBraveManifest = () => {
'style-src': '\'self\' \'unsafe-inline\'',
'font-src': '\'self\' data:',
'img-src': '* data: file://*',
'connect-src': 'https://www.youtube.com',
'frame-src': '\'self\' https://brave.com'
}

if (process.env.NODE_ENV === 'development') {
// allow access to webpack dev server resources
let devServer = 'localhost:' + process.env.npm_package_config_port
cspDirectives['default-src'] = '\'self\' http://' + devServer
cspDirectives['connect-src'] = cspDirectives['connect-src'] + [
' \'self\'',
cspDirectives['connect-src'] = ['\'self\'',
'http://' + devServer,
'ws://' + devServer
].join(' ')
'ws://' + devServer].join(' ')
cspDirectives['style-src'] = '\'self\' \'unsafe-inline\' http://' + devServer
cspDirectives['font-src'] += ` http://${devServer}`
}
Expand Down
102 changes: 0 additions & 102 deletions app/extensions/brave/content/scripts/metaScraper.js

This file was deleted.

Loading

0 comments on commit 5593d21

Please sign in to comment.