Skip to content

Commit

Permalink
Merge branch 'source'
Browse files Browse the repository at this point in the history
* source:
  Ok npm wants me to commit this
  Revert "add package lock file (skevy#86)"
  take shell straight of electron and updated button/links (skevy#87)
  add package lock file (skevy#86)
  Update readme (skevy#85)
  add the close query menu item for non-macOS (skevy#71)
  Add Origin header for CORS support (skevy#66)
  Update productName
  Add release command
  Update .gitignore
  Package with Electron Builder, add windows + linux packages
  Fix bad JSON stringify in get requests (skevy#60)
  Update to Babel 6 + GraphiQL 0.10.2/GraphQL 0.10.1

# Conflicts:
#	package.json
  • Loading branch information
madzhup committed Oct 16, 2017
2 parents 2e9304f + 0b40e95 commit e15cf09
Show file tree
Hide file tree
Showing 12 changed files with 12,462 additions and 482 deletions.
16 changes: 15 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
{
"stage": 0
"presets": [
["env", {
"targets": {
"electron": "0.36",
"uglify": true
}
}],
"stage-1",
"stage-2",
"stage-3",
"react"
],
"plugins": [
"transform-runtime"
]
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ node_modules

# App packaged
release
dist

.envrc
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ brew cask install graphiql
```

Alternately, download the binary from the [Releases](https://github.com/skevy/graphiql-app/releases) tab.

#### Getting started developing

- Branch and/or clone the repo locally.
- cd into it
- install all the require packages: `npm i`
- build the project: `npm run build`
- start the project: `npm start`
5 changes: 3 additions & 2 deletions app/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export default class App extends React.Component {

url += url.indexOf('?') == -1 ? "?" : "&";

return fetch(url + "query=" + encodeURIComponent(graphQLParams['query']) + "&variables=" + encodeURIComponent(graphQLParams['variables']), {
return fetch(url + "query=" + encodeURIComponent(graphQLParams['query']) + "&variables=" + encodeURIComponent(JSON.stringify(graphQLParams['variables'])), {
method: method,
credentials: 'include',
headers: Object.assign({}, defaultHeaders, headers),
Expand Down Expand Up @@ -352,7 +352,8 @@ const _storages = {};
function _makeStorage(storageKey) {
return {
setItem: (key, val) => window.localStorage.setItem(`${storageKey}${key}`, val),
getItem: (key) => window.localStorage.getItem(`${storageKey}${key}`)
getItem: (key) => window.localStorage.getItem(`${storageKey}${key}`),
removeItem: (key) => window.localStorage.removeItem(`${storageKey}${key}`)
};
}

Expand Down
File renamed without changes.
Binary file added build/icon.ico
Binary file not shown.
2 changes: 0 additions & 2 deletions dist/.gitignore

This file was deleted.

28 changes: 20 additions & 8 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var app = electron.app;
var BrowserWindow = electron.BrowserWindow;
var Menu = electron.Menu;
var crashReporter = electron.crashReporter;
const shell = electron.shell;
var menu, template;

crashReporter.start({
Expand All @@ -23,6 +24,11 @@ app.on('ready', function() {

mainWindow = new BrowserWindow({ width: 1024, height: 728 });

electron.session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
details.requestHeaders['Origin'] = 'electron://graphiql-app';
callback({ cancel: false, requestHeaders: details.requestHeaders });
});

if (process.env.HOT) {
mainWindow.loadURL('file://' + __dirname + '/app/hot-dev-app.html');
} else {
Expand Down Expand Up @@ -158,22 +164,22 @@ app.on('ready', function() {
submenu: [{
label: 'Learn More',
click: function() {
require('shell').openExternal('http://electron.atom.io');
shell.openExternal('http://electron.atom.io');
}
}, {
label: 'Documentation',
click: function() {
require('shell').openExternal('https://github.com/atom/electron/tree/master/docs#readme');
shell.openExternal('https://github.com/atom/electron/tree/master/docs#readme');
}
}, {
label: 'Community Discussions',
click: function() {
require('shell').openExternal('https://discuss.atom.io/c/electron');
shell.openExternal('https://discuss.atom.io/c/electron');
}
}, {
label: 'Search Issues',
click: function() {
require('shell').openExternal('https://github.com/atom/electron/issues');
shell.openExternal('https://github.com/atom/electron/issues');
}
}]
}];
Expand All @@ -189,6 +195,12 @@ app.on('ready', function() {
click: function() {
mainWindow.webContents.send('handleElectronMenuOption', 'NEW_TAB');
}
}, {
label: 'Close Query',
accelerator: 'Ctrl+W',
click: function() {
mainWindow.webContents.send('handleElectronMenuOption', 'CLOSE_TAB');
}
}]
}, {
label: '&View',
Expand Down Expand Up @@ -216,22 +228,22 @@ app.on('ready', function() {
submenu: [{
label: 'Learn More',
click: function() {
require('shell').openExternal('http://electron.atom.io');
shell.openExternal('http://electron.atom.io');
}
}, {
label: 'Documentation',
click: function() {
require('shell').openExternal('https://github.com/atom/electron/tree/master/docs#readme');
shell.openExternal('https://github.com/atom/electron/tree/master/docs#readme');
}
}, {
label: 'Community Discussions',
click: function() {
require('shell').openExternal('https://discuss.atom.io/c/electron');
shell.openExternal('https://discuss.atom.io/c/electron');
}
}, {
label: 'Search Issues',
click: function() {
require('shell').openExternal('https://github.com/atom/electron/issues');
shell.openExternal('https://github.com/atom/electron/issues');
}
}]
}];
Expand Down
Loading

0 comments on commit e15cf09

Please sign in to comment.