insomnia/app/app.html
Gregory Schier 9291c24463 Lots
2016-08-17 15:44:03 -07:00

91 lines
2.5 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insomnia</title>
</head>
<body>
<div id="root"></div>
<script src="./external/jsonlint.js"></script>
<script src="./external/raven.min.js"></script>
<script>
// Sentry
if (process.env.INSOMNIA_ENV !== 'development') {
Raven.config('https://fb3242f902b54cdd934b8ffa204426c0:23430fbe203a4189a68efb63c38fc50b@app.getsentry.com/88289', {
allowSecretKey: true,
logger: 'sentry',
levels: ['warn', 'error'],
release: require('./app.json').version,
ignoreUrls: [
/.*raven\.min\.js.*/
],
includePaths: [
/^(?!.*raven.min.js$).*$/ // Ignore raven stuff
],
dataCallback: function (data) {
console.log("SENTRY DATA", data);
var normalize = function (filename) {
var match = filename.match(/\/(app.asar|build)\/(.*)/);
if (match) {
return match[2]; // return everything after ../app.asar/*
} else {
return filename;
}
};
data.exception.values[0].stacktrace.frames.forEach(function (frame) {
frame.filename = normalize(frame.filename);
});
return data
}
}).install();
console.log('-- Initialized Sentry --');
}
</script>
<script>
const {longName} = require('./app.json');
document.title = `${longName}`;
</script>
<script>
// HOT RELOADING IN DEV
(function () {
const script = document.createElement('script');
script.src = (process.env.HOT) ? 'http://localhost:3333/build/bundle.js' : './bundle.js';
document.write(script.outerHTML);
}());
</script>
<script>
// CREATE MENUS
const remote = require('electron').remote;
const Menu = remote.Menu;
const MenuItem = remote.MenuItem;
var menu = new Menu();
menu.append(new MenuItem({label: "Undo", selector: "undo:"}));
menu.append(new MenuItem({label: "Redo", selector: "redo:"}));
menu.append(new MenuItem({type: "separator"}));
menu.append(new MenuItem({label: "Cut", selector: "cut:"}));
menu.append(new MenuItem({label: "Copy", selector: "copy:"}));
menu.append(new MenuItem({label: "Paste", selector: "paste:"}));
menu.append(new MenuItem({label: "Select All", selector: "selectAll:"}));
window.addEventListener('contextmenu', function (e) {
e.preventDefault();
menu.popup(remote.getCurrentWindow());
}, false);
</script>
<script>
// SOME HELPERS
document.body.setAttribute('data-platform', process.platform);
</script>
</body>
</html>