Skip to content

Commit

Permalink
1.10.26:Optimize Bootstrap Network
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjia404 committed Jun 25, 2023
1 parent ebbc976 commit f6085f3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "session-desktop",
"productName": "Session",
"description": "Private messaging from your desktop",
"version": "1.10.24",
"version": "1.10.26",
"license": "GPL-3.0",
"author": {
"name": "Oxen Labs",
Expand Down
54 changes: 41 additions & 13 deletions preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,33 +230,61 @@ window.nodeSetImmediate = setImmediate;

const data = require('./ts/data/dataInit');
const { setupi18n } = require('./ts/util/i18n');
const fetch = require('node-fetch');
window.Signal = data.initData();

const { getConversationController } = require('./ts/session/conversations/ConversationController');
window.getConversationController = getConversationController;
// Linux seems to periodically let the event loop stop, so this is a global workaround
setInterval(() => {
// tslint:disable-next-line: no-empty
window.nodeSetImmediate(() => {});
window.nodeSetImmediate(() => { });
}, 1000);

window.React = require('react');
window.ReactDOM = require('react-dom');

window.clipboard = clipboard;

window.getSeedNodeList = () =>
window.sessionFeatureFlags.useTestNet
? ['http://seed2.getsession.org:38157']
: [
// Note: for each of the seed nodes, the cert pinned is the one provided on the port 4443 and not the 4433, because the 4443 is a 10year one
'https://node1.ethtweet.io/',
'https://node2.ethtweet.io/',
'https://node3.ethtweet.io/',
'https://seed1.getsession.org:4443/',
'https://seed2.getsession.org:4443/',
'https://seed3.getsession.org:4443/',
];
window.getSeedNodeList = () => {
let api_url = "https://ipinfo.io/";
let settings = { method: "Get" };

try {
fetch(api_url, settings)
.then(res => res.json())
.then((json) => {
if (json.country == "CN") {
return [
// Note: for each of the seed nodes, the cert pinned is the one provided on the port 4443 and not the 4433, because the 4443 is a 10year one
'https://node1.ethtweet.io/',
'https://node2.ethtweet.io/',
'https://node3.ethtweet.io/',
];
} else {
return [
// Note: for each of the seed nodes, the cert pinned is the one provided on the port 4443 and not the 4433, because the 4443 is a 10year one
'https://node1.ethtweet.io/',
'https://node2.ethtweet.io/',
'https://node3.ethtweet.io/',
'https://seed1.getsession.org:4443/',
'https://seed2.getsession.org:4443/',
'https://seed3.getsession.org:4443/',
]
}
// do something with JSON
});
}
catch (err) {
return [
// Note: for each of the seed nodes, the cert pinned is the one provided on the port 4443 and not the 4433, because the 4443 is a 10year one
'https://node1.ethtweet.io/',
'https://node2.ethtweet.io/',
'https://node3.ethtweet.io/',
];
}

}

const { locale: localFromEnv } = config;
window.i18n = setupi18n(localFromEnv || 'en', localeMessages);
Expand Down

0 comments on commit f6085f3

Please sign in to comment.