if on localhost, connect to it (except if port 8080)

This commit is contained in:
Martti Malmi 2022-01-24 21:37:08 +02:00
parent e2e2cdaec5
commit bbeeed77ac
2 changed files with 2384 additions and 2273 deletions

View File

@ -9,11 +9,14 @@ const ELECTRON_GUN_URL = 'http://localhost:8767/gun';
let maxConnectedPeers = Helpers.isElectron ? 2 : 1;
const DEFAULT_PEERS = {};
if (window.location.hostname.endsWith('herokuapp.com') || window.location.host === 'localhost:4944') {
DEFAULT_PEERS[window.location.origin + '/gun'] = {};
} else {
DEFAULT_PEERS['https://gun-rs.iris.to/gun'] = {};
DEFAULT_PEERS['https://gun-us.herokuapp.com/gun'] = {};
DEFAULT_PEERS['https://gun-rs.iris.to/gun'] = {};
DEFAULT_PEERS['https://gun-us.herokuapp.com/gun'] = {};
const loc = window.location;
const host = loc.host;
const is_localhost_but_not_dev = host.startsWith('localhost') && host !== 'localhost:8080';
if (loc.hostname.endsWith('herokuapp.com') || is_localhost_but_not_dev) {
Object.keys(DEFAULT_PEERS).forEach(url => DEFAULT_PEERS[url].enabled = false);
DEFAULT_PEERS[loc.origin + '/gun'] = {enabled: true};
}
let knownPeers = getSavedPeers();

4644
yarn.lock

File diff suppressed because it is too large Load Diff