'use strict'

const electron = require('electron')
const app = electron.app
const BrowserWindow = electron.BrowserWindow

let mainWindow = null
app.on('ready', () => {
  mainWindow = new BrowserWindow({
    width: 1000,
    height: 800,
  })

  mainWindow.loadURL(`file://${__dirname}/public/index.html`)
  if (process.env.NODE_ENV === 'development') {
    mainWindow.webContents.openDevTools()
  }

  mainWindow.on('closed', () => mainWindow = null)
})

@@ -443,12 +443,436 @@
  = null)
+%0A%0A  // Since this is an Electron app, the browser will not be adding an Origin%0A  // header to any requests. So we add it here manually to all requests from the%0A  // app.%0A  const request = mainWindow.webContents.session.webRequest%0A  request.onBeforeSendHeaders(function(details, callback) %7B%0A    details.requestHeaders%5B'Origin'%5D = 'report-generator';%0A    callback(%7Bcancel: false, requestHeaders: details.requestHeaders%7D);%0A  %7D)
 %0A%7D)%0A

add Origin header to all requests