summaryrefslogtreecommitdiff
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js109
1 files changed, 109 insertions, 0 deletions
diff --git a/src/index.js b/src/index.js
new file mode 100644
index 0000000..d7c092a
--- /dev/null
+++ b/src/index.js
@@ -0,0 +1,109 @@
+/*
+Copyright VoidNet
+License: https://creativecommons.org/licenses/by-nc-nd/4.0/
+*/
+
+const { app, BrowserWindow, ipcMain, dialog } = require( 'electron' );
+const pt = require( 'path' );
+const proc = require( 'process' );
+const cproc = require( 'child_process' );
+const fsys = require( 'fs' );
+const hts = require( 'https' );
+const ht = require( 'http' );
+const DNS = require( 'dns' );
+
+app.commandLine.appendSwitch( 'ppapi' );
+app.commandLine.appendSwitch( 'enable-accelerated-2d-canvas' );
+
+/*
+ * The code commented out below was supposed
+ * to be for android but hasn't been fully tested
+ * because of not finding way to run it before making apk
+ * out of it.
+*/
+
+/*
+if ( proc.platform === 'linux' && proc.arch === 'arm64' ){
+ app.commandLine.appendSwitch( 'ppapi-flash-path', './fa.obj' );
+ app.commandLine.appendSwitch( 'ppapi-flash-version', '11.1.115.81' );
+} else */
+if ( proc.platform === 'linux' ){
+ app.commandLine.appendSwitch( 'ppapi-flash-path', './fl.obj' );
+ app.commandLine.appendSwitch( 'ppapi-flash-version', '32.0.0.114' );
+ app.commandLine.appendSwitch( 'enable-gpu-rasterization' );
+ app.commandLine.appendSwitch( 'enable-nacl' );
+} else if ( proc.platform === 'win32' ){
+ app.commandLine.appendSwitch( 'ppapi-flash-path', './fw.obj' );
+ app.commandLine.appendSwitch( 'ppapi-flash-version', '32.0.0.114' );
+ app.commandLine.appendSwitch( 'enable-gpu-rasterization' );
+ app.commandLine.appendSwitch( 'enable-nacl' );
+}
+else
+{
+ app.quit();
+}
+
+function open_url( url_link ){
+ switch ( proc.platform ){
+ case 'linux':
+ cproc.exec( '$(which xdg-open) ' + url_link, function(err_msg, std_out, std_err){
+ //executed
+ } );
+ break;
+ case 'win32':
+ cproc.exec( 'start ' + url_link, {
+ windowsHide: true
+ }, function(exec_exception, std_out_msg, std_err_msg){
+ //executed
+ } );
+ break;
+ default:
+ break;
+ }
+}
+
+ipcMain.on( 'asyncmsg', function(ev_data, msg_arg){
+ if ( typeof msg_arg === 'string' && msg_arg !== undefined && msg_arg !== null && msg_arg !== '' ){
+ var split_arg = msg_arg.split( ' ' );
+ switch ( split_arg[0] ){
+ case 'ERR_BAN_LIST_FAIL':
+ app.quit();
+ break;
+ case 'APP_SHUTDOWN':
+ app.quit();
+ break;
+ case 'OPEN_URL':
+ open_url( split_arg[1] );
+ break;
+ default:
+ break;
+ }
+ split_arg = undefined;
+ }
+} );
+
+app.on( 'ready', function(){
+ const runner_window = new BrowserWindow( {
+ width: 1200,
+ height: 700,
+ title: "FlashRunner 2.0.7",
+ show: false,
+ webPreferences: {
+ devTools: false,
+ plugins: true,
+ webviewTag: false
+ }
+ } );
+
+ runner_window.setMenuBarVisibility( false );
+
+ runner_window.loadFile( pt.join(__dirname, 'flashrunner.html') );
+
+ runner_window.on( 'ready-to-show', function(){
+ runner_window.show();
+ } );
+} );
+
+app.on( 'window-all-closed', function(){
+ app.quit();
+} );