@hive-p2p/server 1.0.28 → 1.0.30
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/core/node-services.mjs +2 -2
- package/core/topologist.mjs +4 -3
- package/package.json +1 -1
package/core/node-services.mjs
CHANGED
|
@@ -122,8 +122,8 @@ export class NodeServices {
|
|
|
122
122
|
/** @type {Array<{urls: string}>} */
|
|
123
123
|
const stunUrls = [];
|
|
124
124
|
for (const b of bootstraps) {
|
|
125
|
-
|
|
126
|
-
domain.replace('
|
|
125
|
+
if (!b.includes(':')) continue;
|
|
126
|
+
const domain = b.split(':')[1].replace('//', '');
|
|
127
127
|
const port = parseInt(b.split(':')[2]) + 1;
|
|
128
128
|
stunUrls.push({ urls: `stun:${domain}:${port}` });
|
|
129
129
|
}
|
package/core/topologist.mjs
CHANGED
|
@@ -149,10 +149,11 @@ export class Topologist {
|
|
|
149
149
|
const isBrowser = typeof window !== 'undefined';
|
|
150
150
|
const isSecure = isBrowser && window.location.protocol === 'https:';
|
|
151
151
|
const protocol = isSecure ? 'wss://' : 'ws://';
|
|
152
|
-
const
|
|
153
|
-
|
|
152
|
+
const hasWsSuffix = url.endsWith('/ws');
|
|
153
|
+
const host = isBrowser && !hasWsSuffix ? window.location.host : url;
|
|
154
|
+
|
|
154
155
|
// Build full URL if not already prefixed
|
|
155
|
-
return url.startsWith('ws') ? url : `${protocol}${
|
|
156
|
+
return url.startsWith('ws') ? url : `${protocol}${host}`;
|
|
156
157
|
}
|
|
157
158
|
#connectToPublicNode(publicUrl = 'localhost:8080') {
|
|
158
159
|
let remoteId = null;
|