From b3d602a1aa9e7855de1539df523834c07d8c81c4 Mon Sep 17 00:00:00 2001 From: Mitra Ardron Date: Wed, 19 Jun 2019 14:54:12 +1000 Subject: [PATCH] Gun turned off by default https://github.com/internetarchive/dweb-archive/issues/106 --- TransportGUN.js | 14 ++++++++++---- Transports.js | 3 ++- webpack.config.js | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/TransportGUN.js b/TransportGUN.js index 90e3499..87658bc 100644 --- a/TransportGUN.js +++ b/TransportGUN.js @@ -8,13 +8,19 @@ process.env.GUN_ENV = "false"; const Gun = require('gun/gun.js'); // gun/gun is the minimized version // Raw Gun has almost nothing in it, it needs at least the following to work properly. require('gun/lib/path.js'); // So that .path works -/* -WORKAROUND-GUN-STORAGE + +//WORKAROUND-GUN-STORAGE // The next step is to stop it failing as soon as its cached 5Mb in localstorage // see https://github.com/amark/gun/blob/master/test/tmp/indexedDB.html and https://github.com/amark/gun/issues/590 // but the instructions on how to do this are obviously broken so waiting on @amark to get this working. -require('gun/lib/radix.js'); -require('gun/lib/radisk.js'); + +// See https://github.com/internetarchive/dweb-archive/issues/106 unable to get this working (Gun doesnt work well with webpack) +//require('gun/nts'); +//require('gun/lib/wire'); // NodeJS websocket +//require('gun/lib/multicast'); // Local area broadcasting needs passing `multicast: true` in options (which is safe in node + browser) +/* +require('gun/lib/radix.js'); // loaded by store but required for webpack +require('gun/lib/radisk.js'); // loaded by store but required for webpack require('gun/lib/store.js'); require('gun/lib/rindexed.js'); */ diff --git a/Transports.js b/Transports.js index adb7f89..a18c231 100644 --- a/Transports.js +++ b/Transports.js @@ -713,8 +713,9 @@ class Transports { this._optionspaused = (options.paused || []).map(n => n.toUpperCase()); // Array of transports paused - defaults to none, upper cased if (!(tabbrevs && tabbrevs.length)) { tabbrevs = options.defaulttransports || [] } // WOLK is currently failing, and what is worse returning a data structure with a 404 instead of just failing + // GUN is turned off by default because it fills up localstorage on browser and stops working, https://github.com/internetarchive/dweb-archive/issues/106 //if (! tabbrevs.length) { tabbrevs = ["HTTP", "YJS", "IPFS", "WEBTORRENT", "GUN", "WOLK"]; } // SEE-OTHER-ADDTRANSPORT - if (! tabbrevs.length) { tabbrevs = ["HTTP", "YJS", "IPFS", "WEBTORRENT", "GUN"]; } // SEE-OTHER-ADDTRANSPORT + if (! tabbrevs.length) { tabbrevs = ["HTTP", "YJS", "IPFS", "WEBTORRENT"]; } // SEE-OTHER-ADDTRANSPORT tabbrevs = tabbrevs.map(n => n.toUpperCase()); let transports = this.setup0(tabbrevs, options); ["statuscb", "mirror"].forEach(k => { if (options[k]) this[k] = options[k];} ) diff --git a/webpack.config.js b/webpack.config.js index 668d684..50ff880 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -19,7 +19,8 @@ module.exports = { clearImmediate: false, Buffer: true, setImmediate: false, - console: false + console: false, + dgram: 'empty' }, plugins: [