<commit_before>/*
 * Proxies certain fetch requests to work around
 * CORS issues
 */
import fetch from 'isomorphic-fetch'

const realFetch = fetch

const proxy = 'http://localhost:1337/'

function proxyFetch(url, options) {
  console.log(`proxyFetch: ${url}`)
  return new Promise((resolve, reject) => {
    realFetch
    .call(this, proxy + url, options)
    .then((response) => {
      resolve(response)
    })
    .catch((error) => {
      reject(error)
    })
  })
}

function proxyFetchForSomeHosts(url, options) {
  const tokens = url.split('://')
  const hostAndPath = tokens[1]
  const host = hostAndPath.split('/')[0]
  // if (scheme !== 'https') {
  //   return realFetch.call(this, url, options)
  // }

  if (host.endsWith('amazonaws.com') ||
       host.endsWith('facebook.com') ||
       host.endsWith('twitter.com') ||
       host.endsWith('github.com') ||
       host.endsWith('instagram.com') ||
       host.endsWith('linkedin.com') ||
       host.endsWith('ycombinator.com') ||
       host.endsWith('bitstamp.net') ||
       host.endsWith('blockchain.info') ||
       host.endsWith('localhost:18332')) {
    return proxyFetch(url, options)
  } else {
    return realFetch.call(this, url, options)
  }
}

window.fetch = proxyFetchForSomeHosts
window.realFetch = realFetch
window.proxyFetch = proxyFetch<commit_msg>remove blockchain.info from the proxying list<commit_after>/*
 * Proxies certain fetch requests to work around
 * CORS issues
 */
import fetch from 'isomorphic-fetch'

const realFetch = fetch

const proxy = 'http://localhost:1337/'

function proxyFetch(url, options) {
  console.log(`proxyFetch: ${url}`)
  return new Promise((resolve, reject) => {
    realFetch
    .call(this, proxy + url, options)
    .then((response) => {
      resolve(response)
    })
    .catch((error) => {
      reject(error)
    })
  })
}

function proxyFetchForSomeHosts(url, options) {
  const tokens = url.split('://')
  const hostAndPath = tokens[1]
  const host = hostAndPath.split('/')[0]
  // if (scheme !== 'https') {
  //   return realFetch.call(this, url, options)
  // }

  if (host.endsWith('amazonaws.com') ||
       host.endsWith('facebook.com') ||
       host.endsWith('twitter.com') ||
       host.endsWith('github.com') ||
       host.endsWith('instagram.com') ||
       host.endsWith('linkedin.com') ||
       host.endsWith('ycombinator.com') ||
       host.endsWith('bitstamp.net') ||
       host.endsWith('localhost:18332')) {
    return proxyFetch(url, options)
  } else {
    return realFetch.call(this, url, options)
  }
}

window.fetch = proxyFetchForSomeHosts
window.realFetch = realFetch
window.proxyFetch = proxyFetch
{'fraction_non_alphanumeric': 0.1601960045231813, 'fraction_numerical': 0.008292499057670561, 'mean_word_length': 3.2806451612903227, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7528059', 'n_tokens_mistral': 864, 'n_tokens_neox': 849, 'n_words': 167}