sbot/app/index.js

44 lines
1.2 KiB
JavaScript
Raw Normal View History

2015-06-25 02:41:17 +11:00
var app = require('app')
var Menu = require('menu')
var path = require('path')
2015-06-25 13:23:27 +11:00
var config = require('ssb-config')
var windows = require('./lib/windows')
2015-06-25 02:41:17 +11:00
// Report crashes to our server.
//require('crash-reporter').start();
app.on('ready', function ready () {
// setup blobs
2015-06-25 13:42:31 +11:00
var blobs_dir = path.join(config.path, 'blobs')
var downloads_dir = app.getPath('userDesktop')
var blobs = require('./lib/blobs')(blobs_dir, downloads_dir)
2015-06-25 13:42:31 +11:00
2015-06-25 02:41:17 +11:00
// start sbot
2015-06-25 13:23:27 +11:00
require('scuttlebot').init(config, function (err, sbot) {
2015-07-02 05:02:59 +11:00
// register sbot plugins
sbot.use(require('phoenix-api'))
// register electron protocols
require('protocol').registerProtocol('blob', blobs.protocol)
2015-06-25 13:23:27 +11:00
2015-06-25 05:14:52 +11:00
// open the web app
var mainWindow = windows.open(
'file://' + path.join(__dirname, '../node_modules/ssbplug-phoenix/home.html'),
sbot,
blobs,
{ width: 1000, height: 720 }
)
2015-07-02 05:02:59 +11:00
// mainWindow.openDevTools()
2015-06-25 13:42:31 +11:00
2015-06-25 05:14:52 +11:00
// setup menu
2015-06-25 08:48:00 +11:00
// Menu.setApplicationMenu(Menu.buildFromTemplate([{
// label: 'Window',
// submenu: [
// // { label: 'Open Web App', click: onopen },
// { label: 'Quit', click: onquit }
// ]
// }]))
2015-06-25 02:41:17 +11:00
})
});