@leofcoin/peernet 1.1.23 → 1.1.24
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-31b62450.js} +1 -1
- package/exports/browser/{index-2c2a9d47.js → index-e407f1a3.js} +1 -1
- package/exports/browser/{messages-6cc87ed7.js → messages-2465e07d.js} +1 -1
- package/exports/browser/{peernet-98e14e24.js → peernet-805b1e8e.js} +12 -9
- package/exports/browser/peernet.js +1 -1
- package/exports/peernet.js +9 -6
- package/package.json +1 -1
- package/src/dht/dht.js +10 -6
|
@@ -6200,6 +6200,7 @@ 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
|
const now = Math.round(new Date().getTime() / 1000);
|
|
@@ -6237,12 +6238,14 @@ class DhtEarth {
|
|
|
6237
6238
|
* @return {Object} {latitude: lat, longitude: lon}
|
|
6238
6239
|
*/
|
|
6239
6240
|
async getCoordinates(address) {
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6241
|
+
if (!fetchedCoordinates[address]) {
|
|
6242
|
+
const request = `https://whereis.leofcoin.org/?ip=${address}`;
|
|
6243
|
+
let response = await fetch(request);
|
|
6244
|
+
response = await response.json();
|
|
6245
|
+
const { lat, lon } = response;
|
|
6246
|
+
fetchedCoordinates[address] = { latitude: lat, longitude: lon };
|
|
6247
|
+
}
|
|
6248
|
+
return fetchedCoordinates[address];
|
|
6246
6249
|
}
|
|
6247
6250
|
/**
|
|
6248
6251
|
* @param {Object} peer
|
|
@@ -20182,7 +20185,7 @@ class Identity {
|
|
|
20182
20185
|
globalThis.peernet.selectedAccount = new TextDecoder().decode(selected);
|
|
20183
20186
|
}
|
|
20184
20187
|
else {
|
|
20185
|
-
const importee = await import(/* webpackChunkName: "generate-account" */ './index-
|
|
20188
|
+
const importee = await import(/* webpackChunkName: "generate-account" */ './index-e407f1a3.js');
|
|
20186
20189
|
const { identity, accounts } = await importee.default(password, this.network);
|
|
20187
20190
|
await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
|
|
20188
20191
|
await globalThis.walletStore.put('version', String(1));
|
|
@@ -20353,7 +20356,7 @@ class Peernet {
|
|
|
20353
20356
|
this.root = options.root;
|
|
20354
20357
|
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
|
|
20355
20358
|
// FolderMessageResponse
|
|
20356
|
-
} = await import(/* webpackChunkName: "messages" */ './messages-
|
|
20359
|
+
} = await import(/* webpackChunkName: "messages" */ './messages-2465e07d.js');
|
|
20357
20360
|
/**
|
|
20358
20361
|
* proto Object containing protos
|
|
20359
20362
|
* @type {Object}
|
|
@@ -20425,7 +20428,7 @@ class Peernet {
|
|
|
20425
20428
|
if (this.#starting || this.#started)
|
|
20426
20429
|
return;
|
|
20427
20430
|
this.#starting = true;
|
|
20428
|
-
const importee = await import('./client-
|
|
20431
|
+
const importee = await import('./client-31b62450.js');
|
|
20429
20432
|
/**
|
|
20430
20433
|
* @access public
|
|
20431
20434
|
* @type {PeernetClient}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { P as default } from './peernet-
|
|
1
|
+
export { P as default } from './peernet-805b1e8e.js';
|
|
2
2
|
import './value-157ab062.js';
|
package/exports/peernet.js
CHANGED
|
@@ -161,6 +161,7 @@ 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
|
const now = Math.round(new Date().getTime() / 1000);
|
|
@@ -198,12 +199,14 @@ class DhtEarth {
|
|
|
198
199
|
* @return {Object} {latitude: lat, longitude: lon}
|
|
199
200
|
*/
|
|
200
201
|
async getCoordinates(address) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
if (!fetchedCoordinates[address]) {
|
|
203
|
+
const request = `https://whereis.leofcoin.org/?ip=${address}`;
|
|
204
|
+
let response = await fetch(request);
|
|
205
|
+
response = await response.json();
|
|
206
|
+
const { lat, lon } = response;
|
|
207
|
+
fetchedCoordinates[address] = { latitude: lat, longitude: lon };
|
|
208
|
+
}
|
|
209
|
+
return fetchedCoordinates[address];
|
|
207
210
|
}
|
|
208
211
|
/**
|
|
209
212
|
* @param {Object} peer
|
package/package.json
CHANGED
package/src/dht/dht.js
CHANGED
|
@@ -14,6 +14,8 @@ const lastFetched = {
|
|
|
14
14
|
},
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
const fetchedCoordinates = {}
|
|
18
|
+
|
|
17
19
|
const getAddress = async () => {
|
|
18
20
|
const {address} = lastFetched
|
|
19
21
|
const now = Math.round(new Date().getTime() / 1000);
|
|
@@ -58,12 +60,14 @@ export default class DhtEarth {
|
|
|
58
60
|
* @return {Object} {latitude: lat, longitude: lon}
|
|
59
61
|
*/
|
|
60
62
|
async getCoordinates(address) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
if (!fetchedCoordinates[address]) {
|
|
64
|
+
const request = `https://whereis.leofcoin.org/?ip=${address}`
|
|
65
|
+
let response = await fetch(request)
|
|
66
|
+
response = await response.json()
|
|
67
|
+
const {lat, lon} = response;
|
|
68
|
+
fetchedCoordinates[address] = {latitude: lat, longitude: lon}
|
|
69
|
+
}
|
|
70
|
+
return fetchedCoordinates[address]
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
/**
|