Advertisement
genBTC

FRANZ electron main.js pepper flash

Nov 13th, 2016
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2. ! function () {
  3.     function e() {
  4.         'darwin' == process['platform'] && n['dock']['setBadge']('');
  5.         var e = g({
  6.                 defaultWidth: 800,
  7.                 defaultHeight: 600,
  8.                 path: n['getPath']('userData') + '/settings'
  9.             }),
  10.             t = {
  11.                 minWidth: 400,
  12.                 minHeight: 340,
  13.                 x: e['x'],
  14.                 y: e['y'],
  15.                 width: e['width'],
  16.                 height: e['height'],
  17.                 title: 'Franz',
  18.                 webPreferences: {
  19.                   plugins: true
  20.                 }
  21.                 //enable "plugins" for flash.
  22.             };
  23.         'linux' == process['platform'] && (t['icon'] = f['join'](__dirname, 'assets', 'franz.png')), T = new o(t), e['manage'](T), T['loadURL']('file://' + __dirname + '/index.html'), T['webContents']['on']('will-navigate', function (e) {
  24.             e['preventDefault']()
  25.         }), d['register'](T, 'Ctrl+Tab', function () {
  26.             T['webContents']['send']('shortcut', 'nextTab')
  27.         }), d['register'](T, 'Ctrl+Shift+Tab', function () {
  28.             T['webContents']['send']('shortcut', 'prevTab')
  29.         }), d['register'](T, 'Ctrl+PageDown', function () {
  30.             T['webContents']['send']('shortcut', 'nextTab')
  31.         }), d['register'](T, 'Ctrl+PageUp', function () {
  32.             T['webContents']['send']('shortcut', 'prevTab')
  33.         }), 'darwin' == process['platform'] && (d['register'](T, 'Alt+Cmd+Right', function () {
  34.             T['webContents']['send']('shortcut', 'nextTab')
  35.         }), d['register'](T, 'Alt+Cmd+Left', function () {
  36.             T['webContents']['send']('shortcut', 'prevTab')
  37.         })), d['register'](T, 'Alt+Ctrl+Shift+PageUp', function () {
  38.             T['webContents']['toggleDevTools']()
  39.         }), T['on']('restore', function () {
  40.             n['mainWindow']['setSkipTaskbar'](!1)
  41.         }), T['on']('minimize', function () {
  42.             n['wasMaximized'] = n['isMaximized']
  43.         }), T['on']('maximize', function () {
  44.             n['isMaximized'] = !0
  45.         }), T['on']('unmaximize', function () {
  46.             n['isMaximized'] = !1
  47.         }), T['on']('restore', function () {
  48.             n['wasMaximized'] && T['maximize']()
  49.         }), n['mainWindow'] = T, n['isMaximized'] = T['isMaximized']()
  50.     }
  51.     if(!require('electron-squirrel-startup')) {
  52.         var t = require('electron'),
  53.             n = t['app'],
  54.             o = t['BrowserWindow'],
  55.             i = t['dialog'],
  56.             a = t['ipcMain'],
  57.             r = t['shell'],
  58.             s = t['session'],
  59.             c = require('console'),
  60.             l = c['Console'],
  61.             u = require('fs-extra'),
  62.             d = require('electron-localshortcut'),
  63.             g = require('electron-window-state'),
  64.             f = require('path'),
  65.             p = require('underscore'),
  66.             h = require('i18n'),
  67.             m = require('nconf'),
  68.             w = require('auto-launch'),
  69.             v = require(f['join'](__dirname, 'lib', 'services')),
  70.             b = require(f['join'](__dirname, 'config', 'locales.json')),
  71.             _ = require('./lib/tray'),
  72.             x = new w({
  73.                 name: 'Franz'
  74.             });
  75.         n['appLauncher'] = x;
  76.         var y = u['createWriteStream'](n['getPath']('userData') + '/user.log'),
  77.             z = u['createWriteStream'](n['getPath']('userData') + '/error.log'),
  78.             k = new l(y, z);
  79.         process['on']('uncaughtException', function (e) {
  80.             k['error'](e), console['log'](e)
  81.         }), h['configure']({
  82.             locales: Object['keys'](b),
  83.             directory: __dirname + '/locales',
  84.             defaultLocale: 'en_GB',
  85.             register: global,
  86.             updateFiles: !1,
  87.             logErrorFn: function (e) {
  88.                 console['log']('error', e)
  89.             }
  90.         });
  91.         var q = {},
  92.             C = {},
  93.             S = 2e3,
  94.             j = ['services', 'appdata', 'settings'];
  95.         j['forEach'](function (e) {
  96.             q[e] = new m['Provider'];
  97.             var t = f['join'](n['getPath']('userData'), 'settings', e + '.json'),
  98.                 o = f['join'](n['getPath']('userData'), 'settings', e + '.backup.json');
  99.             try {
  100.                 q[e]['file'](e, t)
  101.             } catch(i) {
  102.                 k['error'](new Date + ' ' + e + '.json corrupt, trying to use backup');
  103.                 try {
  104.                     u['unlinkSync'](t), u['copySync'](o, t)
  105.                 } catch(i) {
  106.                     k['error'](new Date + ' could not restore ' + e + '.backup.json')
  107.                 } finally {
  108.                     try {
  109.                         q[e]['file'](e, t)
  110.                     } catch(i) {
  111.                         console['log']('na seas die zweite', e), k['error'](new Date + ' could not run with restored ' + e + '.backup.json');
  112.                         try {
  113.                             u['unlinkSync'](t), u['unlinkSync'](o)
  114.                         } catch(i) {
  115.                             k['error'](new Date + ' could delete ' + e + '.json and ' + e + '.backup.json')
  116.                         };
  117.                         q[e]['file'](e, t)
  118.                     }
  119.                 }
  120.             };
  121.             C[e] = p['debounce'](function () {
  122.                 q[e]['save'](function () {
  123.                     console['log']('####### ' + e + ' settings saved #######')
  124.                 })
  125.             }, S)
  126.         });
  127.         var D = q;
  128.         if(n['settings'] = D, n['forceQuit'] = !1, n['manualUpdate'] = !1, n['systemTray'] = null, n['isMaximized'] = !1, n['wasMaximized'] = !1, 'darwin' == process['platform'] || 'win32' == process['platform']) {
  129.             var M;
  130.             ! function () {
  131.                 var e = require('electron'),
  132.                     t = e['autoUpdater'];
  133.                 t['setFeedURL']('darwin' == process['platform'] ? 'http://franz.adlk.io/update/osx/' + n['getVersion']() : 'win32' == process['platform'] ? 'http://franz.adlk.io/update/v2/' + process['platform'] + '/' + process['arch'] + '/' + n['getVersion']() : ''), M = !1, t['on']('update-downloaded', function (e) {
  134.                     M || (M = !0, i['showMessageBox']({
  135.                         type: 'question',
  136.                         buttons: [__('24-install'), __('25-later'), __('26-changelog')],
  137.                         defaultId: 0,
  138.                         cancelId: 1,
  139.                         title: __('23-franz-is-ready-to-update'),
  140.                         message: __('22-a-new-update-is-ready-do-you-want-to-restart-franz-and-install-the-update')
  141.                     }, function (e) {
  142.                         M = !1, 0 == e ? (n['forceQuit'] = !0, t['quitAndInstall']()) : 2 == e && r['openExternal']('http://www.meetfranz.com/changelog.html')
  143.                     }))
  144.                 }), t['on']('checking-for-update', function (e) {
  145.                     console['log']('checking for update')
  146.                 }), t['on']('update-not-available', function (e) {
  147.                     n['manualUpdate'] && (console['log']('no update available'), i['showMessageBox']({
  148.                         type: 'info',
  149.                         buttons: ['OK'],
  150.                         defaultId: 0,
  151.                         title: __('27-no-update-for-franz-available'),
  152.                         message: __('28-no-update-for-franz-available')
  153.                     }), n['manualUpdate'] = !1)
  154.                 }), setTimeout(function () {
  155.                     t['checkForUpdates']()
  156.                 }, 3e4), setInterval(function () {
  157.                     M || t['checkForUpdates']()
  158.                 }, 864e5), a['on']('download-update', function (e, n) {
  159.                     t['checkForUpdates']()
  160.                 })
  161.             }()
  162.         };
  163.         void(0) === n['settings']['settings']['get']('settings:autoStartApp') && (console['log']('auto enable launch'), x['enable'](), n['settings']['settings']['set']('settings:autoStartApp', !0)), x['isEnabled']()['then'](function (e) {
  164.             n['settings']['settings']['set']('settings:autoStartApp', !0)
  165.         });
  166.         var T = void(0),
  167.             U = n['makeSingleInstance'](function (e, t) {
  168.                 return T && (T['isMinimized']() && T['restore'](), T['focus']()), !0
  169.             });
  170.         if(U) {
  171.             return void(n)['quit']()
  172.         };
  173.         //ENABLE ADOBE FLASH PLUGIN (64-bit Windows)
  174.         n.commandLine.appendSwitch('ppapi-flash-path', './resources/app/pepflashplayer64_23_0_0_207.dll');
  175.         n.commandLine.appendSwitch('ppapi-flash-version', '23.0.0.207');
  176.         //thats it.        
  177.         n['on']('ready', function () {
  178.             var t = n['settings']['settings']['get']('settings'),
  179.                 o = n['getLocale']();
  180.             if(void(0) !== t && void(0) !== t['locale'] && (o = t['locale']), void(0) === b[o]) {
  181.                 var i = void(0);
  182.                 for(var r in b) {
  183.                     if(o['substring'](0, 2) == r['substring'](0, 2)) {
  184.                         i = r;
  185.                         break
  186.                     }
  187.                 };
  188.                 void(0) !== i && (o = i)
  189.             };
  190.             return void(0) === b[o] && (o = 'en_GB'), D['settings']['set']('settings:locale', o), h['setLocale'](o), n['services'] = v['getServices'](), e(), _(), a['on']('saveSettings', function (e, t) {
  191.                 t = t['toLowerCase'](), C[t]()
  192.             }), a['on']('clearServiceCache', function (e) {
  193.                 p['each'](n['settings']['services']['get']('services'), function (e, t) {
  194.                     var n = s['fromPartition']('persist:' + e['service'] + '_' + e['id']);
  195.                     n['clearCache'](function (e) {
  196.                         console['log']('cache deleted')
  197.                     }), n['clearStorageData']({
  198.                         storages: ['appcache', 'filesystem']
  199.                     }, function (e) {
  200.                         console['log']('storage data deleted')
  201.                     })
  202.                 })
  203.             }), U ? void(n)['quit']() : void(0)
  204.         }), n['on']('before-quit', function (e) {
  205.             n['forceQuit'] = !0
  206.         }), n['on']('window-all-closed', function () {
  207.             var e = D['settings']['get']('settings:runInBackground') || !0;
  208.             e || n['quit']()
  209.         }), n['on']('activate', function () {
  210.             null === T ? e() : n['show']()
  211.         }), ('win32' == process['platform'] || 'linux' == process['platform']) && (n['visibleOnTaskbar'] = !0, a['on']('close-main-window', function () {
  212.             n['quit']()
  213.         }), a['on']('show-main-window', function () {
  214.             null === T ? n['mainWindow'] = T : T['show']()
  215.         })), a['on']('toggle-autostart', function () {
  216.             var e = D['settings']['get']('settings:autoStartApp');
  217.             e ? (console['log']('enable'), x['enable']()) : (console['log']('disable'), x['disable']())
  218.         })
  219.     }
  220. }()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement