-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
621 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,77 @@ | ||
nw.Window.open( | ||
'templates/index.html', | ||
{ | ||
"id": "happypandax_desktop_main", | ||
"title": "HappyPanda X Desktop", | ||
"width": 1024, | ||
"height": 800, | ||
"icon": "static/favicon/favicon.ico", | ||
"min_width": 500, | ||
"min_height": 500, | ||
'inject_js_start': 'app/start.js', | ||
}, | ||
function (win) { | ||
|
||
win.on('close', function () { | ||
this.hide() | ||
this.close(true) | ||
}); | ||
|
||
// global.contextmenu = new nw.Menu(); | ||
// global.contextmenu.createMacBuiltin("HappyPanda X Desktop"); | ||
// global.contextmenu.append(new nw.MenuItem({ label: 'Quit' })); | ||
|
||
// win.window.document.body.addEventListener('contextmenu', function (ev) { | ||
// ev.preventDefault(); | ||
// global.contextmenu.popup(ev.x, ev.y); | ||
// return false; | ||
// }); | ||
|
||
}); | ||
const { app, BrowserWindow } = require('electron') | ||
const path = require('path') | ||
|
||
function create_window () { | ||
let win = new BrowserWindow({ | ||
title: "HappyPanda X Desktop", | ||
icon: "static/favicon/favicon.ico", | ||
width: 1024, | ||
height: 800, | ||
minWidth: 500, | ||
minHeight: 500, | ||
webPreferences: { | ||
preload: path.join(__dirname, 'pre.js'), | ||
nodeIntegration: true | ||
}, | ||
backgroundColor: '#f9f9f9', | ||
show: false | ||
}) | ||
|
||
win.loadFile('templates/index.html') | ||
|
||
win.webContents.openDevTools() | ||
|
||
win.on('closed', () => { | ||
win = null | ||
}) | ||
|
||
win.once('ready-to-show', () => { | ||
win.show() | ||
}) | ||
} | ||
|
||
app.on('ready', create_window) | ||
|
||
app.on('window-all-closed', () => { | ||
if (process.platform !== 'darwin') { | ||
app.quit() | ||
} | ||
}) | ||
|
||
app.on('activate', () => { | ||
if (win === null) { | ||
create_window() | ||
} | ||
}) | ||
|
||
|
||
// nw.Window.open( | ||
// 'templates/index.html', | ||
// { | ||
// "id": "happypandax_desktop_main", | ||
// "title": "HappyPanda X Desktop", | ||
// "width": 1024, | ||
// "height": 800, | ||
// "icon": "static/favicon/favicon.ico", | ||
// "min_width": 500, | ||
// "min_height": 500, | ||
// 'inject_js_start': 'app/start.js', | ||
// }, | ||
// function (win) { | ||
|
||
// win.on('close', function () { | ||
// this.hide() | ||
// this.close(true) | ||
// }); | ||
|
||
// // global.contextmenu = new nw.Menu(); | ||
// // global.contextmenu.createMacBuiltin("HappyPanda X Desktop"); | ||
// // global.contextmenu.append(new nw.MenuItem({ label: 'Quit' })); | ||
|
||
// // win.window.document.body.addEventListener('contextmenu', function (ev) { | ||
// // ev.preventDefault(); | ||
// // global.contextmenu.popup(ev.x, ev.y); | ||
// // return false; | ||
// // }); | ||
|
||
// }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
var __OS__ = require('os'); | ||
|
||
global.SERVER = { | ||
HOST: 'localhost', | ||
PORT: 7007 | ||
} | ||
global.CONFIG_PATH = require('path').join(process.cwd(), 'desktop.json') | ||
|
||
global.SERVER_SSL = false; | ||
global.SERVER_HOST = global.SERVER.HOST; | ||
global.SERVER_PORT = global.SERVER.PORT; | ||
global.WEBSERVER_HOST = 'localhost'; | ||
global.WEBSERVER_PORT = 7008; | ||
global.SERVER_URL = (global.SERVER_SSL ? 'https://' : 'http://') + global.SERVER_HOST + ':' + global.SERVER_PORT.toString(); | ||
global.WEBSERVER_URL = (global.SERVER_SSL ? 'https://' : 'http://') + global.WEBSERVER_HOST + ':' + global.WEBSERVER_PORT.toString(); | ||
global.SOCKETIO_MODULE = require('./socket-io-client'); | ||
global.VERSION = require('../package.json').version; | ||
global.TITLE = "HPX Desktop - Alpha"; | ||
|
||
global.IS_SAME_MACHINE = function(host) { | ||
let same = false; | ||
let ifaces = __OS__.networkInterfaces(); | ||
|
||
Object.keys(ifaces).forEach(function (ifname) { | ||
ifaces[ifname].forEach(function (iface) { | ||
if (iface.address === host) | ||
same = true; | ||
}); | ||
}); | ||
return same; | ||
} | ||
|
||
class _DESKTOP_API { | ||
|
||
constructor() { | ||
} | ||
|
||
show_context_menu(ev) { | ||
} | ||
|
||
} | ||
|
||
global.DESKTOP_API = new _DESKTOP_API() |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.