@leofcoin/peernet 1.1.23 → 1.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/exports/browser/{client-e3216b03.js → client-bdab491d.js} +1 -1
- package/exports/browser/{index-2c2a9d47.js → index-116df6d1.js} +1 -1
- package/exports/browser/{messages-6cc87ed7.js → messages-fab7583b.js} +1 -1
- package/exports/browser/{peernet-98e14e24.js → peernet-3749aa41.js} +13 -11
- package/exports/browser/peernet.js +1 -1
- package/exports/peernet.js +10 -8
- package/package.json +1 -1
- package/src/dht/dht.js +11 -8
|
@@ -6200,10 +6200,10 @@ const lastFetched = {
|
|
|
6200
6200
|
timestamp: 0,
|
|
6201
6201
|
},
|
|
6202
6202
|
};
|
|
6203
|
+
const fetchedCoordinates = {};
|
|
6203
6204
|
const getAddress = async () => {
|
|
6204
6205
|
const { address } = lastFetched;
|
|
6205
|
-
|
|
6206
|
-
if (now - address.timestamp > 1200000) {
|
|
6206
|
+
if (address) {
|
|
6207
6207
|
address.value = await fetch('https://icanhazip.com/');
|
|
6208
6208
|
address.value = await address.value.text();
|
|
6209
6209
|
address.timestamp = Math.round(new Date().getTime() / 1000);
|
|
@@ -6237,12 +6237,14 @@ class DhtEarth {
|
|
|
6237
6237
|
* @return {Object} {latitude: lat, longitude: lon}
|
|
6238
6238
|
*/
|
|
6239
6239
|
async getCoordinates(address) {
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6240
|
+
if (!fetchedCoordinates[address]) {
|
|
6241
|
+
const request = `https://whereis.leofcoin.org/?ip=${address}`;
|
|
6242
|
+
let response = await fetch(request);
|
|
6243
|
+
response = await response.json();
|
|
6244
|
+
const { lat, lon } = response;
|
|
6245
|
+
fetchedCoordinates[address] = { latitude: lat, longitude: lon };
|
|
6246
|
+
}
|
|
6247
|
+
return fetchedCoordinates[address];
|
|
6246
6248
|
}
|
|
6247
6249
|
/**
|
|
6248
6250
|
* @param {Object} peer
|
|
@@ -20182,7 +20184,7 @@ class Identity {
|
|
|
20182
20184
|
globalThis.peernet.selectedAccount = new TextDecoder().decode(selected);
|
|
20183
20185
|
}
|
|
20184
20186
|
else {
|
|
20185
|
-
const importee = await import(/* webpackChunkName: "generate-account" */ './index-
|
|
20187
|
+
const importee = await import(/* webpackChunkName: "generate-account" */ './index-116df6d1.js');
|
|
20186
20188
|
const { identity, accounts } = await importee.default(password, this.network);
|
|
20187
20189
|
await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
|
|
20188
20190
|
await globalThis.walletStore.put('version', String(1));
|
|
@@ -20353,7 +20355,7 @@ class Peernet {
|
|
|
20353
20355
|
this.root = options.root;
|
|
20354
20356
|
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
|
|
20355
20357
|
// FolderMessageResponse
|
|
20356
|
-
} = await import(/* webpackChunkName: "messages" */ './messages-
|
|
20358
|
+
} = await import(/* webpackChunkName: "messages" */ './messages-fab7583b.js');
|
|
20357
20359
|
/**
|
|
20358
20360
|
* proto Object containing protos
|
|
20359
20361
|
* @type {Object}
|
|
@@ -20425,7 +20427,7 @@ class Peernet {
|
|
|
20425
20427
|
if (this.#starting || this.#started)
|
|
20426
20428
|
return;
|
|
20427
20429
|
this.#starting = true;
|
|
20428
|
-
const importee = await import('./client-
|
|
20430
|
+
const importee = await import('./client-bdab491d.js');
|
|
20429
20431
|
/**
|
|
20430
20432
|
* @access public
|
|
20431
20433
|
* @type {PeernetClient}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { P as default } from './peernet-
|
|
1
|
+
export { P as default } from './peernet-3749aa41.js';
|
|
2
2
|
import './value-157ab062.js';
|
package/exports/peernet.js
CHANGED
|
@@ -161,10 +161,10 @@ const lastFetched = {
|
|
|
161
161
|
timestamp: 0,
|
|
162
162
|
},
|
|
163
163
|
};
|
|
164
|
+
const fetchedCoordinates = {};
|
|
164
165
|
const getAddress = async () => {
|
|
165
166
|
const { address } = lastFetched;
|
|
166
|
-
|
|
167
|
-
if (now - address.timestamp > 1200000) {
|
|
167
|
+
if (address) {
|
|
168
168
|
address.value = await fetch('https://icanhazip.com/');
|
|
169
169
|
address.value = await address.value.text();
|
|
170
170
|
address.timestamp = Math.round(new Date().getTime() / 1000);
|
|
@@ -198,12 +198,14 @@ class DhtEarth {
|
|
|
198
198
|
* @return {Object} {latitude: lat, longitude: lon}
|
|
199
199
|
*/
|
|
200
200
|
async getCoordinates(address) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
if (!fetchedCoordinates[address]) {
|
|
202
|
+
const request = `https://whereis.leofcoin.org/?ip=${address}`;
|
|
203
|
+
let response = await fetch(request);
|
|
204
|
+
response = await response.json();
|
|
205
|
+
const { lat, lon } = response;
|
|
206
|
+
fetchedCoordinates[address] = { latitude: lat, longitude: lon };
|
|
207
|
+
}
|
|
208
|
+
return fetchedCoordinates[address];
|
|
207
209
|
}
|
|
208
210
|
/**
|
|
209
211
|
* @param {Object} peer
|
package/package.json
CHANGED
package/src/dht/dht.js
CHANGED
|
@@ -14,10 +14,11 @@ const lastFetched = {
|
|
|
14
14
|
},
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
const fetchedCoordinates = {}
|
|
18
|
+
|
|
17
19
|
const getAddress = async () => {
|
|
18
20
|
const {address} = lastFetched
|
|
19
|
-
|
|
20
|
-
if (now - address.timestamp > 1200000) {
|
|
21
|
+
if (address) {
|
|
21
22
|
address.value = await fetch('https://icanhazip.com/')
|
|
22
23
|
address.value = await address.value.text()
|
|
23
24
|
address.timestamp = Math.round(new Date().getTime() / 1000);
|
|
@@ -58,12 +59,14 @@ export default class DhtEarth {
|
|
|
58
59
|
* @return {Object} {latitude: lat, longitude: lon}
|
|
59
60
|
*/
|
|
60
61
|
async getCoordinates(address) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
if (!fetchedCoordinates[address]) {
|
|
63
|
+
const request = `https://whereis.leofcoin.org/?ip=${address}`
|
|
64
|
+
let response = await fetch(request)
|
|
65
|
+
response = await response.json()
|
|
66
|
+
const {lat, lon} = response;
|
|
67
|
+
fetchedCoordinates[address] = {latitude: lat, longitude: lon}
|
|
68
|
+
}
|
|
69
|
+
return fetchedCoordinates[address]
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
/**
|