Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var ipc = require('ipc');
// Listen for auto updates
ipc.on('notify', function (message) {
if (message === 'window:update-available') {
Session.set('updateAvailable', true);
}
if (message === 'application:quit') {
VirtualBox.saveVMState('boot2docker-vm', function (err) {
if (err) {
console.log(err);
}
});
}
});
var ipc = require('ipc');
// Listen for auto updates
ipc.on('notify', function (message) {
if (message === 'window:update-available') {
Session.set('updateAvailable', true);
}
if (message === 'application:quit') {
VirtualBox.saveVMState('boot2docker-vm', function (err) {
if (err) {
console.log(err);
}
});
}
});
function createMainWindow () {
const win = new BrowserWindow({
width: 1280,
height: 768,
resizable: true,
title: options.page_title
})
// Set the download directory to being off of the user's home folder
var tilde_downloads = path.join(app.getHomeDir(), 'Downloads')
win.webContents.session.setDownloadPath(tilde_downloads)
// Allow for messages to be sent from client
ipc.on('asynchronous-message', sendPath('async'))
ipc.on('synchronous-message', sendPath('sync'))
win.webContents.on('did-finish-load', function (webContents) {
var page_title = webContents.sender.getTitle()
var index_path
var home_btn_css
var home_btn_js
if (page_title != 'Aufbau home') {
// Add css
home_btn_css = fs.readFileSync(path.join(__dirname, 'home-btn.css'), 'utf-8')
webContents.sender.insertCSS(home_btn_css)
// Add home button
index_path = path.join(__dirname, 'www', 'index.html')
home_btn_js = fs.readFileSync(path.join(__dirname, 'home-btn.jst'), 'utf-8').replace('{{index_path}}', index_path)
webContents.sender.executeJavaScript(home_btn_js)
function createMainWindow () {
const win = new BrowserWindow({
width: 1280,
height: 768,
resizable: true,
title: options.page_title
})
// Set the download directory to being off of the user's home folder
var tilde_downloads = path.join(app.getHomeDir(), 'Downloads')
win.webContents.session.setDownloadPath(tilde_downloads)
// Allow for messages to be sent from client
ipc.on('asynchronous-message', sendPath('async'))
ipc.on('synchronous-message', sendPath('sync'))
win.webContents.on('did-finish-load', function (webContents) {
var page_title = webContents.sender.getTitle()
var index_path
var home_btn_css
var home_btn_js
if (page_title != 'Aufbau home') {
// Add css
home_btn_css = fs.readFileSync(path.join(__dirname, 'home-btn.css'), 'utf-8')
webContents.sender.insertCSS(home_btn_css)
// Add home button
index_path = path.join(__dirname, 'www', 'index.html')
home_btn_js = fs.readFileSync(path.join(__dirname, 'home-btn.jst'), 'utf-8').replace('{{index_path}}', index_path)
webContents.sender.executeJavaScript(home_btn_js)
return function (dispatch, getState) {
const state = getState(),
groupIndex = 0, // assume for now
group = state[tabGroupName][groupIndex],
focusedAce = _.find(group.tabs, {id: group.active}),
aceInstance = focusedAce && getAceInstance(focusedAce.id),
content = aceInstance && aceInstance.getSession().getValue();
if (_.isString(content)) {
return send('saveFile', filename, content)
.then(() => dispatch(fileIsSaved(group.groupId, focusedAce.id, filename)))
.catch(error => dispatch(errorCaught(error)));
}
};
}
function getUpdatePath() {
var path = $("#updateMultiplePath").val();
if (path === ''){
path = $("#ofPath").val();
}
ipc.send('pickUpdatePath', path); // current path could go here
}
export function connect() {
// For desktop mode only
if (!__WEB__) {
require('ipc').on('log', function (msg) {
logger.debug(msg);
});
require('ipc').on('playPauseToggle', function () {
logger.debug("received message: playPauseToggle");
if (store.player) {
store.player.togglePlayPause();
}
});
require('ipc').on('idle', function (idleOutput) {
// logger.debug("received idle: " + idleOutput);
const idleSeconds = parseInt(idleOutput);
if (idleSeconds > 180 && store.player && store.player.isPlaying) {
logger.debug("idle too long - pausing song");
store.player.pause();
}
});
// TODO: replace/remove
//const ipcRenderer = require('electron').ipcRenderer;
//observeStore(state => ({
// currentSong: state.currentSongAsync.data,
// artistImage: state.currentArtistImage
//}), data => {
continue;
}
var b5index = 'x' + str.charCodeAt(i).toString(16).toUpperCase() +
str.charCodeAt(i+1).toString(16).toUpperCase();
if (b2u_table[b5index]) {
data += b2u_table[b5index];
++i;
} else { // Not a big5 char
data += str.charAt(i);
}
}
return data;
}
});
ipc.send('connect', this.url);
ipc.on('data', pcman.receive.bind(pcman));
document.title = this.url;
document.addEventListener('focus', this.set_focus, false);
this.set_focus();
this.resize();
}
set_focus(e) {
export function connect() {
// For desktop mode only
if (!__WEB__) {
require('ipc').on('log', function (msg) {
logger.debug(msg);
});
require('ipc').on('playPauseToggle', function () {
logger.debug("received message: playPauseToggle");
if (store.player) {
store.player.togglePlayPause();
}
});
require('ipc').on('idle', function (idleOutput) {
// logger.debug("received idle: " + idleOutput);
const idleSeconds = parseInt(idleOutput);
if (idleSeconds > 180 && store.player && store.player.isPlaying) {
logger.debug("idle too long - pausing song");
peer.on('error', function error (err) {
ipc.send('icon', 'disconnected')
console.error('peer error')
console.error(err)
ui.containers.content.innerHTML = 'Error connecting! Please Quit. ' + err.message
})