hive-p2p 1.0.15 → 1.0.16
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/package.json +1 -1
- package/simulation/simulator.mjs +8 -2
package/package.json
CHANGED
package/simulation/simulator.mjs
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import express from 'express';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
3
4
|
import { WebSocketServer } from 'ws';
|
|
4
5
|
import { io } from 'socket.io-client'; // used for twitch events only
|
|
5
6
|
import { CLOCK, SIMULATION, NODE, TRANSPORTS, IDENTITY, DISCOVERY, LOG_CSS } from '../core/config.mjs';
|
|
6
7
|
import { TestWsServer, TestWsConnection, TestTransport,
|
|
7
8
|
ICE_CANDIDATE_EMITTER, TEST_WS_EVENT_MANAGER, SANDBOX } from '../simulation/test-transports.mjs';
|
|
8
9
|
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
+
const __dirname = path.dirname(__filename);
|
|
12
|
+
const packageRoot = path.resolve(__dirname, '..');
|
|
13
|
+
console.log('Package root:', packageRoot); // debug
|
|
14
|
+
|
|
9
15
|
// SETUP SIMULATION ENV -----------------------------------------------\
|
|
10
16
|
SIMULATION.USE_TEST_TRANSPORTS = true; // |
|
|
11
17
|
IDENTITY.ARE_IDS_HEX = false; // FOR SIMULATOR STRING IDS |
|
|
@@ -230,8 +236,8 @@ app.use('../rendering/visualizer.mjs', (req, res, next) => {
|
|
|
230
236
|
|
|
231
237
|
app.use(express.static(path.resolve()));
|
|
232
238
|
const server = app.listen(3000, () => console.log('%cServer listening on http://localhost:3000', LOG_CSS.SIMULATOR));
|
|
233
|
-
app.get('/', (req, res) => res.sendFile('rendering/visualizer.html', { root:
|
|
234
|
-
app.get('/the-gossip-grail', (req, res) => res.sendFile('resources/the-gossip-grail.html', { root:
|
|
239
|
+
app.get('/', (req, res) => res.sendFile('rendering/visualizer.html', { root: packageRoot }));
|
|
240
|
+
app.get('/the-gossip-grail', (req, res) => res.sendFile('resources/the-gossip-grail.html', { root: packageRoot }));
|
|
235
241
|
|
|
236
242
|
/** @type {WebSocket} */
|
|
237
243
|
let clientWs;
|