Skip to content

Commit

Permalink
1.10.27:add header o-host
Browse files Browse the repository at this point in the history
get_n_service_nodes add params
timeout 30s
seed site use ip
  • Loading branch information
chenjia404 committed Jun 28, 2023
1 parent 96bf92c commit 4e0a924
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 42 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.26",
"version": "1.10.27",
"license": "GPL-3.0",
"author": {
"name": "Oxen Labs",
Expand Down
47 changes: 9 additions & 38 deletions preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,44 +246,15 @@ window.ReactDOM = require('react-dom');

window.clipboard = clipboard;

window.getSeedNodeList = () => {
let api_url = "https://ipinfo.io/";
let settings = { method: "Get" };

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(function (e) {
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/',
];
});


}
window.getSeedNodeList = () => [
// 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://116.203.53.213:4443/',
'https://144.76.164.202:4443/',
'https://212.199.114.66:4443/',
]

const { locale: localFromEnv } = config;
window.i18n = setupi18n(localFromEnv || 'en', localeMessages);
Expand Down
6 changes: 3 additions & 3 deletions ts/session/apis/seed_node_api/SeedNodeAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ async function getSnodesFromSeedUrl(urlObj: URL): Promise<Array<any>> {

const params = {
active_only: true,
limit:256,
fields: {
public_ip: true,
storage_port: true,
Expand All @@ -246,19 +245,20 @@ async function getSnodesFromSeedUrl(urlObj: URL): Promise<Array<any>> {
method: 'get_n_service_nodes',
params,
};

console.log(body)
const sslAgent = await getSslAgentForSeedNode(
urlObj.hostname,
urlObj.protocol !== Constants.PROTOCOLS.HTTP
);

const fetchOptions = {
method: 'POST',
timeout: 10000,
timeout: 30000,
body: JSON.stringify(body),
headers: {
'User-Agent': 'WhatsApp',
'Accept-Language': 'en-us',
'o-host':urlObj.host
},
agent: sslAgent,
};
Expand Down
1 change: 1 addition & 0 deletions ts/session/apis/snode_api/onions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,7 @@ const sendOnionRequestNoRetries = async ({
headers: {
'User-Agent': 'WhatsApp',
'Accept-Language': 'en-us',
'o-host':`${guardNode.ip}:${guardNode.port}`
},
timeout: 25000,
};
Expand Down

0 comments on commit 4e0a924

Please sign in to comment.