Этот коммит содержится в:
Paul Frazee 2015-06-24 21:23:27 -05:00
родитель f3421c4bba
Коммит fe030cb0e0
3 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

@ -3,6 +3,7 @@ var Tray = require('tray')
var Menu = require('menu')
var shell = require('shell')
var BrowserWindow = require('browser-window')
var config = require('ssb-config')
// Report crashes to our server.
@ -13,7 +14,10 @@ var mainWindow
app.on('ready', function ready () {
// start sbot
require('scuttlebot').init(config, function (err, sbot) {
require('scuttlebot').init(config, function (err, sbot) {
// register protocols
require('protocol').registerProtocol('ext', require('./lib/ext-protocol')(config))
// open the web app
// shell.openExternal('http://localhost:8008')
mainWindow = new BrowserWindow({width: 1000, height: 720})

14
app/lib/ext-protocol.js Обычный файл
Просмотреть файл

@ -0,0 +1,14 @@
var protocol = require('protocol')
var path = require('path')
var toPath = require('multiblob/util').toPath
module.exports = function (config) {
var dir = path.join(config.path, 'blobs')
return function (request) {
var id = request.url.split(':')[1]
if (request.method == 'GET' && id) {
console.log('loading', id, toPath(dir, id))
return new protocol.RequestFileJob(toPath(dir, id))
}
}
}

Просмотреть файл

@ -25,6 +25,7 @@
"electron-prebuilt": "^0.28.2"
},
"dependencies": {
"multiblob": "^1.4.3",
"scuttlebot": "^4.2.3",
"ssb-config": "^1.0.3"
}