This repository has been archived by the owner on Jun 16, 2020. It is now read-only.
forked from brave/browser-laptop
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
following example of Webtorrent PR 5342
- Loading branch information
Showing
37 changed files
with
208 additions
and
8 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
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,77 @@ | ||
/* IPFS node in electron's main process */ | ||
|
||
// TODO(diasdavid) - review electron's main process support https://github.com/ipfs/js-ipfs/issues/843 | ||
|
||
// const electron = require('electron') | ||
// const ipc = electron.ipcMain | ||
// const messages = require('../../js/constants/messages') | ||
// const IPFS = require('ipfs') | ||
// const os = require('os') | ||
// const path = require('path') | ||
|
||
module.exports = {init} | ||
|
||
// Set to see communication between WebTorrent and torrent viewer tabs | ||
const DEBUG_IPC = false | ||
if (DEBUG_IPC) { | ||
console.log('IPFS IPC debugging enabled') | ||
} | ||
|
||
// IPFS node | ||
// let node = null | ||
// let channels = {} | ||
|
||
// Receive messages via the window process, ultimately from the UI in a <webview> process | ||
function init (state, action) { | ||
if (DEBUG_IPC) { | ||
console.log('IPFS IPC init') | ||
} | ||
|
||
return state | ||
|
||
/* | ||
node = new IPFS({ | ||
repo: path.join(os.homedir(), '/.brave-jsipfs') | ||
}) | ||
node.on('ready', () => { | ||
if (DEBUG_IPC) { | ||
console.log('IPFS node is ready') | ||
} | ||
}) | ||
node.on('error', (err) => console.log('IPFS: ', err)) | ||
// access on the browser with remote.getGlobal('ipfs') | ||
global.ipfs = node | ||
*/ | ||
|
||
/* TODO(diasdavid) consider enabling the browser tab to start and stop the node | ||
ipc.on(messages.IPFS_MESSAGE, function (event, msg) { | ||
if (DEBUG_IPC) { | ||
console.log('IPFS: Received IPC: ' + JSON.stringify(msg)) | ||
} | ||
channels[msg.clientKey] = e.sender | ||
server.receive(msg) | ||
}) | ||
*/ | ||
} | ||
|
||
// Send messages from the browser process (here), thru the window process, to the <webview> | ||
/* | ||
function send (msg) { | ||
if (DEBUG_IPC) console.log('Sending IPC: ' + JSON.stringify(msg)) | ||
const channel = channels[msg.clientKey] | ||
if (!channel) { | ||
if (DEBUG_IPC) console.error('Ignoring unrecognized clientKey ' + msg.clientKey) | ||
return | ||
} | ||
if (channel.isDestroyed()) { | ||
if (DEBUG_IPC) console.log('Removing destroyed channel, clientKey ' + msg.clientKey) | ||
delete channels[msg.clientKey] | ||
return | ||
} | ||
channel.send(messages.IPFS_MESSAGE, msg) | ||
} | ||
*/ |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.