64 lines
1.5 KiB
JavaScript
64 lines
1.5 KiB
JavaScript
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')
|
|
const dl = require('./controller/download');
|
|
const browser = require('./controller/windows.js/browser');
|
|
const tray = require('./controller/tray')
|
|
|
|
//const main_window = require('./controller/windows.js/main.js')
|
|
|
|
let tray_win = null;
|
|
|
|
if (!fs.existsSync(global.dir+'/tmp/inst')) {
|
|
fs.writeFileSync(global.dir+'/tmp/inst',"out");
|
|
app.quit();
|
|
}else{
|
|
var win ;
|
|
app.getPath('documents')
|
|
const createWindow = () =>{
|
|
win = new BrowserWindow({
|
|
width: 320,
|
|
height: 500,
|
|
show: false,
|
|
frame: false,
|
|
icon: __dirname + '/app.ico'
|
|
})
|
|
ipcMain
|
|
.on('start-full', (event, arg)=>{
|
|
//main_window.createWindow();
|
|
//main_window.open();
|
|
tray_win = tray();
|
|
win.close();
|
|
|
|
});
|
|
win.loadURL(`file://${__dirname}/app/view/init.html`)
|
|
win.once('ready-to-show', () => {
|
|
win.show()
|
|
})
|
|
win.on('closed', () => {
|
|
win = null;
|
|
});
|
|
}
|
|
app.on('ready', createWindow);
|
|
app.on('window-all-closed', () => {
|
|
if (process.platform !== 'darwin') {
|
|
app.quit();
|
|
}
|
|
});
|
|
app.on('activate', () => {
|
|
if (mainWindow === null) {
|
|
createWindow();
|
|
}
|
|
});
|
|
}
|
|
|
|
module.exports = app;
|