cyb3r-downloader/src/index.js

96 lines
2.6 KiB
JavaScript
Raw Normal View History

2017-08-09 23:00:01 +02:00
const path = require('path');
global.dir = path.join(__dirname);
const {
app,
BrowserWindow,
Menu,
dialog,
ipcMain
} = require('electron');
const fs = require('fs');
const yt_dl = require('./controller/youtube-dl')
2017-08-13 23:47:09 +02:00
const dl = require('./controller/download');
2017-08-21 23:54:57 +02:00
const browser = require('./controller/windows.js/browser');
2017-09-10 20:42:21 +02:00
const tray = require('./controller/tray')
2017-08-21 23:54:57 +02:00
2017-09-10 20:42:21 +02:00
const main_window = require('./controller/windows.js/main.js')
2017-08-21 23:54:57 +02:00
2017-09-10 20:42:21 +02:00
let tray_win = null;
2017-08-09 23:00:01 +02:00
2017-08-13 23:47:09 +02:00
if (!fs.existsSync(global.dir+'/tmp/inst')) {
fs.writeFileSync(global.dir+'/tmp/inst',"out");
var win;
const createWindow = () =>{
win = new BrowserWindow({
width: 320,
height: 500,
show: false,
2017-08-20 23:57:42 +02:00
frame: false,
icon: __dirname + '/app.ico'
2017-08-13 23:47:09 +02:00
})
win.once('ready-to-show', () => {
})
win.on('closed', () => {
win = null;
});
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
}else{
var win ;
app.getPath('documents')
const createWindow = () =>{
win = new BrowserWindow({
width: 320,
height: 500,
show: false,
2017-08-20 23:57:42 +02:00
frame: false,
icon: __dirname + '/app.ico'
2017-08-13 23:47:09 +02:00
})
ipcMain
.on('start-full', (event, arg)=>{
2017-09-10 20:42:21 +02:00
main_window.createWindow();
main_window.open();
tray_win = tray();
win.close();
2017-08-13 23:47:09 +02:00
});
win.loadURL(`file://${__dirname}/app/view/init.html`)
win.once('ready-to-show', () => {
win.show()
//var x = new yt_dl("https://www.youtube.com/watch?v=UbQgXeY_zi4")
//x.download();
})
win.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;
});
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow();
}
2017-08-09 23:00:01 +02:00
});
}
2017-08-13 23:47:09 +02:00
module.exports = app;