2017-09-26 05:40:53 -05:00
|
|
|
'use strict';
|
2018-04-11 08:13:59 -05:00
|
|
|
const { remote, ipcRenderer, crashReporter } = require('electron');
|
2017-09-26 05:40:53 -05:00
|
|
|
|
|
|
|
renderDom();
|
|
|
|
|
|
|
|
/**
|
2017-09-26 11:04:25 -05:00
|
|
|
* Method that renders application data
|
2017-09-26 05:40:53 -05:00
|
|
|
*/
|
|
|
|
function renderDom() {
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
|
|
const applicationName = remote.app.getName() || 'Symphony';
|
|
|
|
let appName = document.getElementById('app-name');
|
|
|
|
let copyright = document.getElementById('copyright');
|
|
|
|
|
|
|
|
appName.innerHTML = applicationName;
|
|
|
|
copyright.innerHTML = `Copyright © ${new Date().getFullYear()} ${applicationName}`
|
|
|
|
});
|
2017-09-26 11:04:25 -05:00
|
|
|
}
|
2017-10-30 03:55:33 -05:00
|
|
|
|
2017-10-30 08:06:45 -05:00
|
|
|
ipcRenderer.on('buildNumber', (event, buildNumber) => {
|
2017-10-30 03:55:33 -05:00
|
|
|
let versionText = document.getElementById('version');
|
|
|
|
const version = remote.app.getVersion();
|
|
|
|
|
|
|
|
if (versionText) {
|
2017-10-30 08:06:45 -05:00
|
|
|
versionText.innerHTML = version ? `Version ${version} (${version}.${buildNumber})` : 'N/A';
|
2017-10-30 03:55:33 -05:00
|
|
|
}
|
2018-04-11 08:13:59 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
ipcRenderer.on('register-crash-reporter', (event, arg) => {
|
|
|
|
if (arg && typeof arg === 'object') {
|
|
|
|
crashReporter.start(arg);
|
|
|
|
}
|
2018-08-16 01:05:40 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
// note: this is a workaround until
|
|
|
|
// https://github.com/electron/electron/issues/8841
|
|
|
|
// is fixed on the electron. where 'will-navigate'
|
|
|
|
// is never fired in sandbox mode
|
|
|
|
//
|
|
|
|
// This is required in order to prevent from loading
|
|
|
|
// dropped content
|
|
|
|
window.addEventListener('drop', function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
});
|
|
|
|
|
|
|
|
window.addEventListener('dragover', function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
2017-10-30 03:55:33 -05:00
|
|
|
});
|