underpost 2.8.885 → 2.81.0

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.
Files changed (72) hide show
  1. package/.env.production +3 -0
  2. package/.github/workflows/ghpkg.ci.yml +1 -1
  3. package/.github/workflows/npmpkg.ci.yml +1 -1
  4. package/.github/workflows/publish.ci.yml +5 -5
  5. package/.github/workflows/pwa-microservices-template-page.cd.yml +1 -1
  6. package/.github/workflows/pwa-microservices-template-test.ci.yml +1 -1
  7. package/.vscode/zed.keymap.json +17 -0
  8. package/.vscode/zed.settings.json +20 -0
  9. package/CHANGELOG.md +145 -1
  10. package/Dockerfile +20 -3
  11. package/README.md +6 -6
  12. package/bin/build.js +18 -9
  13. package/bin/deploy.js +130 -195
  14. package/bin/zed.js +20 -0
  15. package/cli.md +13 -7
  16. package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
  17. package/manifests/deployment/dd-test-development/deployment.yaml +50 -50
  18. package/manifests/deployment/dd-test-development/proxy.yaml +4 -4
  19. package/manifests/lxd/underpost-setup.sh +5 -5
  20. package/package.json +3 -4
  21. package/{manifests/maas → scripts}/ssh-cluster-info.sh +1 -1
  22. package/scripts/ssl.sh +164 -0
  23. package/src/cli/baremetal.js +8 -8
  24. package/src/cli/cloud-init.js +1 -1
  25. package/src/cli/cluster.js +15 -4
  26. package/src/cli/cron.js +1 -1
  27. package/src/cli/db.js +2 -1
  28. package/src/cli/deploy.js +65 -14
  29. package/src/cli/fs.js +2 -2
  30. package/src/cli/image.js +19 -2
  31. package/src/cli/index.js +11 -4
  32. package/src/cli/monitor.js +34 -1
  33. package/src/cli/repository.js +42 -1
  34. package/src/cli/run.js +396 -86
  35. package/src/cli/script.js +32 -0
  36. package/src/cli/secrets.js +34 -0
  37. package/src/cli/test.js +42 -1
  38. package/src/client/components/core/Css.js +0 -8
  39. package/src/client/components/core/windowGetDimensions.js +229 -162
  40. package/src/index.js +2 -2
  41. package/src/mailer/MailerProvider.js +1 -0
  42. package/src/runtime/express/Dockerfile +41 -0
  43. package/src/runtime/express/Express.js +12 -4
  44. package/src/runtime/lampp/Dockerfile +1 -1
  45. package/src/server/backup.js +20 -0
  46. package/src/server/client-build-live.js +12 -10
  47. package/src/server/client-build.js +136 -91
  48. package/src/server/client-dev-server.js +16 -2
  49. package/src/server/client-icons.js +19 -0
  50. package/src/server/conf.js +495 -69
  51. package/src/server/dns.js +169 -46
  52. package/src/server/downloader.js +65 -24
  53. package/src/server/object-layer.js +260 -162
  54. package/src/server/peer.js +2 -8
  55. package/src/server/proxy.js +93 -76
  56. package/src/server/runtime.js +15 -16
  57. package/src/server/ssr.js +4 -4
  58. package/src/server/tls.js +251 -0
  59. package/src/server/valkey.js +11 -10
  60. package/src/ws/IoInterface.js +2 -1
  61. package/src/ws/IoServer.js +2 -1
  62. package/src/ws/core/core.ws.connection.js +1 -1
  63. package/src/ws/core/core.ws.emit.js +1 -1
  64. package/src/ws/core/core.ws.server.js +1 -1
  65. package/manifests/maas/lxd-preseed.yaml +0 -32
  66. package/src/server/ssl.js +0 -108
  67. /package/{manifests/maas → scripts}/device-scan.sh +0 -0
  68. /package/{manifests/maas → scripts}/gpu-diag.sh +0 -0
  69. /package/{manifests/maas → scripts}/maas-setup.sh +0 -0
  70. /package/{manifests/maas → scripts}/nat-iptables.sh +0 -0
  71. /package/{manifests/maas → scripts}/nvim.sh +0 -0
  72. /package/{manifests/maas → scripts}/snap-clean.sh +0 -0
@@ -1,196 +1,294 @@
1
- import dotenv from 'dotenv';
1
+ /**
2
+ * Provides utilities and engine logic for processing and managing Cyberia Online's object layer assets (skins, floors, weapons, etc.).
3
+ * @module src/server/object-layer.js
4
+ * @namespace CyberiaObjectLayer
5
+ */
2
6
 
7
+ import dotenv from 'dotenv';
3
8
  import fs from 'fs-extra';
4
9
  import { PNG } from 'pngjs';
5
10
  import sharp from 'sharp';
6
- import Jimp from 'jimp';
11
+ import { Jimp, intToRGBA, rgbaToInt } from 'jimp';
7
12
 
8
13
  import { range } from '../client/components/core/CommonJs.js';
9
14
  import { random } from '../client/components/core/CommonJs.js';
15
+ import { loggerFactory } from '../server/logger.js';
16
+
17
+ const logger = loggerFactory(import.meta);
10
18
 
11
19
  dotenv.config({ path: `./engine-private/conf/dd-cyberia/.env.production`, override: true });
12
20
 
13
- const pngDirectoryIteratorByObjectLayerType = async (
14
- objectLayerType = 'skin',
15
- callback = ({ path, objectLayerType, objectLayerId, direction, frame }) => {},
16
- ) => {
17
- for (const objectLayerId of await fs.readdir(`./src/client/public/cyberia/assets/${objectLayerType}`)) {
18
- for (const direction of await fs.readdir(
19
- `./src/client/public/cyberia/assets/${objectLayerType}/${objectLayerId}`,
20
- )) {
21
- const dirFolder = `./src/client/public/cyberia/assets/${objectLayerType}/${objectLayerId}/${direction}`;
22
- if (!fs.statSync(dirFolder).isDirectory()) continue;
23
- for (const frame of await fs.readdir(dirFolder)) {
24
- const imageFilePath = `./src/client/public/cyberia/assets/${objectLayerType}/${objectLayerId}/${direction}/${frame}`;
25
- await callback({ path: imageFilePath, objectLayerType, objectLayerId, direction, frame });
21
+ /**
22
+ * @typedef {Object} ObjectLayerCallbackPayload
23
+ * @property {string} path - The full file path to the image.
24
+ * @property {string} objectLayerType - The type of object layer (e.g., 'skin', 'floor').
25
+ * @property {string} objectLayerId - The unique ID of the object layer asset.
26
+ * @property {string} direction - The direction folder name (e.g., '08', '12').
27
+ * @memberof CyberiaObjectLayer
28
+ * @property {string} frame - The frame file name.
29
+ */
30
+
31
+ export class ObjectLayerEngine {
32
+ /**
33
+ * @memberof CyberiaObjectLayer
34
+ * @static
35
+ * @description Iterates through the directory structure of object layer PNG assets for a given type.
36
+ * @param {string} [objectLayerType='skin'] - The type of object layer to iterate over (e.g., 'skin', 'floor').
37
+ * @param {function(ObjectLayerCallbackPayload): Promise<void>} [callback=() => {}] - The async function to execute for each image file found.
38
+ * @returns {Promise<void>}
39
+ * @memberof CyberiaObjectLayer
40
+ */
41
+ static async pngDirectoryIteratorByObjectLayerType(
42
+ objectLayerType = 'skin',
43
+ callback = ({ path, objectLayerType, objectLayerId, direction, frame }) => {},
44
+ ) {
45
+ const assetRoot = `./src/client/public/cyberia/assets/${objectLayerType}`;
46
+ if (!fs.existsSync(assetRoot)) {
47
+ logger.warn(`Asset root not found for type: ${objectLayerType}`);
48
+ return;
49
+ }
50
+
51
+ for (const objectLayerId of await fs.readdir(assetRoot)) {
52
+ const idPath = `${assetRoot}/${objectLayerId}`;
53
+ if (!fs.statSync(idPath).isDirectory()) continue;
54
+
55
+ for (const direction of await fs.readdir(idPath)) {
56
+ const dirFolder = `${idPath}/${direction}`;
57
+ if (!fs.statSync(dirFolder).isDirectory()) continue;
58
+
59
+ for (const frame of await fs.readdir(dirFolder)) {
60
+ const imageFilePath = `${dirFolder}/${frame}`;
61
+ await callback({ path: imageFilePath, objectLayerType, objectLayerId, direction, frame });
62
+ }
26
63
  }
27
64
  }
28
65
  }
29
- };
30
-
31
- const readPngAsync = (filePath) => {
32
- return new Promise((resolve, reject) => {
33
- fs.createReadStream(filePath)
34
- .pipe(new PNG())
35
- .on('parsed', function () {
36
- resolve({
37
- width: this.width,
38
- height: this.height,
39
- data: Buffer.from(this.data),
66
+
67
+ /**
68
+ * @memberof CyberiaObjectLayer
69
+ * @static
70
+ * @description Asynchronously reads a PNG file and resolves with its raw bitmap data, width, and height.
71
+ * @param {string} filePath - The path to the PNG file.
72
+ * @returns {Promise<{width: number, height: number, data: Buffer} | {error: true, message: string}>} - The image data or an error object.
73
+ * @memberof CyberiaObjectLayer
74
+ */
75
+ static readPngAsync(filePath) {
76
+ return new Promise((resolve, reject) => {
77
+ fs.createReadStream(filePath)
78
+ .pipe(new PNG())
79
+ .on('parsed', function () {
80
+ resolve({
81
+ width: this.width,
82
+ height: this.height,
83
+ data: Buffer.from(this.data),
84
+ });
85
+ })
86
+ .on('error', (error) => {
87
+ logger.error(`Error reading PNG file: ${filePath}`, error);
88
+ // Resolve with a specific error indicator instead of rejecting
89
+ resolve({ error: true, message: error.message });
40
90
  });
41
- })
42
- .on('error', (err) => {
43
- reject(err);
44
- });
45
- });
46
- };
47
-
48
- const frameFactory = async (path, colors = []) => {
49
- const frame = [];
50
- try {
51
- let image;
52
-
53
- if (path.endsWith('.gif')) {
54
- image = await Jimp.read(path);
55
- // remove gif file
56
- fs.removeSync(path);
57
- // save image replacing gif for png
58
- const pngPath = path.replace('.gif', '.png');
59
- await image.writeAsync(pngPath);
60
- } else {
61
- const png = await readPngAsync(path);
62
- image = new Jimp(png.width, png.height);
63
- image.bitmap = png;
64
- }
91
+ });
92
+ }
93
+
94
+ /**
95
+ * @memberof CyberiaObjectLayer
96
+ * @static
97
+ * @description Processes an image file (PNG or GIF) to generate a frame matrix and a color palette (map_color).
98
+ * It quantizes the image based on a factor derived from image height (mazeFactor).
99
+ * @param {string} path - The path to the image file.
100
+ * @param {Array<number[]>} [colors=[]] - The existing color palette array to append new colors to.
101
+ * @returns {Promise<{frame: number[][], colors: Array<number[]>}>} - The frame matrix and the updated color palette.
102
+ * @memberof CyberiaObjectLayer
103
+ */
104
+ static async frameFactory(path, colors = []) {
105
+ const frame = [];
106
+ try {
107
+ let image;
65
108
 
66
- const mazeFactor = parseInt(image.bitmap.height / 24);
67
- let _y = -1;
68
- for (const y of range(0, image.bitmap.height - 1)) {
69
- if (y % mazeFactor === 0) {
70
- _y++;
71
- if (!frame[_y]) frame[_y] = [];
109
+ if (path.endsWith('.gif')) {
110
+ image = await Jimp.read(path);
111
+ // remove gif file
112
+ fs.removeSync(path);
113
+ // save image replacing gif for png
114
+ const pngPath = path.replace('.gif', '.png');
115
+ await image.write(pngPath);
116
+ } else {
117
+ const png = await ObjectLayerEngine.readPngAsync(path);
118
+ if (png.error) {
119
+ throw new Error(`Failed to read PNG: ${png.message}`);
120
+ }
121
+ image = new Jimp(png);
72
122
  }
73
- let _x = -1;
74
- for (const x of range(0, image.bitmap.width - 1)) {
75
- const rgba = Object.values(Jimp.intToRGBA(image.getPixelColor(x, y)));
76
- if (y % mazeFactor === 0 && x % mazeFactor === 0) {
77
- _x++;
78
- const indexColor = colors.findIndex(
79
- (c) => c[0] === rgba[0] && c[1] === rgba[1] && c[2] === rgba[2] && c[3] === rgba[3],
80
- );
81
- if (indexColor === -1) {
82
- colors.push(rgba);
83
- frame[_y][_x] = colors.length - 1;
84
- } else {
85
- frame[_y][_x] = indexColor;
123
+
124
+ const mazeFactor = parseInt(image.bitmap.height / 24);
125
+ let _y = -1;
126
+ for (const y of range(0, image.bitmap.height - 1)) {
127
+ if (y % mazeFactor === 0) {
128
+ _y++;
129
+ if (!frame[_y]) frame[_y] = [];
130
+ }
131
+ let _x = -1;
132
+ for (const x of range(0, image.bitmap.width - 1)) {
133
+ const rgba = Object.values(intToRGBA(image.getPixelColor(x, y)));
134
+ if (y % mazeFactor === 0 && x % mazeFactor === 0) {
135
+ _x++;
136
+ const indexColor = colors.findIndex(
137
+ (c) => c[0] === rgba[0] && c[1] === rgba[1] && c[2] === rgba[2] && c[3] === rgba[3],
138
+ );
139
+ if (indexColor === -1) {
140
+ colors.push(rgba);
141
+ frame[_y][_x] = colors.length - 1;
142
+ } else {
143
+ frame[_y][_x] = indexColor;
144
+ }
86
145
  }
87
146
  }
88
147
  }
148
+ } catch (error) {
149
+ logger.error(`Failed to process image ${path}:`, error);
89
150
  }
90
- } catch (error) {
91
- logger.error(`Failed to process image ${path}:`, error);
151
+ return { frame, colors };
92
152
  }
93
- return { frame, colors };
94
- };
95
-
96
- const getKeyFramesDirectionsFromNumberFolderDirection = (direction) => {
97
- let objectLayerFrameDirections = [];
98
-
99
- switch (direction) {
100
- case '08':
101
- objectLayerFrameDirections = ['down_idle', 'none_idle', 'default_idle'];
102
- break;
103
- case '18':
104
- objectLayerFrameDirections = ['down_walking'];
105
- break;
106
- case '02':
107
- objectLayerFrameDirections = ['up_idle'];
108
- break;
109
- case '12':
110
- objectLayerFrameDirections = ['up_walking'];
111
- break;
112
- case '04':
113
- objectLayerFrameDirections = ['left_idle', 'up_left_idle', 'down_left_idle'];
114
- break;
115
- case '14':
116
- objectLayerFrameDirections = ['left_walking', 'up_left_walking', 'down_left_walking'];
117
- break;
118
- case '06':
119
- objectLayerFrameDirections = ['right_idle', 'up_right_idle', 'down_right_idle'];
120
- break;
121
- case '16':
122
- objectLayerFrameDirections = ['right_walking', 'up_right_walking', 'down_right_walking'];
123
- break;
153
+
154
+ /**
155
+ * @memberof CyberiaObjectLayer
156
+ * @static
157
+ * @description Converts a numerical folder direction (e.g., '08', '14') into an array of corresponding keyframe names (e.g., 'down_idle', 'left_walking').
158
+ * @param {string} direction - The numerical direction string.
159
+ * @returns {string[]} - An array of keyframe direction names.
160
+ * @memberof CyberiaObjectLayer
161
+ */
162
+ static getKeyFramesDirectionsFromNumberFolderDirection(direction) {
163
+ let objectLayerFrameDirections = [];
164
+
165
+ switch (direction) {
166
+ case '08':
167
+ objectLayerFrameDirections = ['down_idle', 'none_idle', 'default_idle'];
168
+ break;
169
+ case '18':
170
+ objectLayerFrameDirections = ['down_walking'];
171
+ break;
172
+ case '02':
173
+ objectLayerFrameDirections = ['up_idle'];
174
+ break;
175
+ case '12':
176
+ objectLayerFrameDirections = ['up_walking'];
177
+ break;
178
+ case '04':
179
+ objectLayerFrameDirections = ['left_idle', 'up_left_idle', 'down_left_idle'];
180
+ break;
181
+ case '14':
182
+ objectLayerFrameDirections = ['left_walking', 'up_left_walking', 'down_left_walking'];
183
+ break;
184
+ case '06':
185
+ objectLayerFrameDirections = ['right_idle', 'up_right_idle', 'down_right_idle'];
186
+ break;
187
+ case '16':
188
+ objectLayerFrameDirections = ['right_walking', 'up_right_walking', 'down_right_walking'];
189
+ break;
190
+ }
191
+
192
+ return objectLayerFrameDirections;
124
193
  }
125
194
 
126
- return objectLayerFrameDirections;
127
- };
128
-
129
- const buildImgFromTile = async (
130
- options = {
131
- tile: { map_color: null, frame_matrix: null },
132
- imagePath: '',
133
- cellPixelDim: 20,
134
- opacityFilter: (x, y, color) => 255,
135
- },
136
- ) => {
137
- const { tile, imagePath, cellPixelDim, opacityFilter } = options;
138
- const mainMatrix = tile.frame_matrix;
139
- const sharpOptions = {
140
- create: {
141
- width: cellPixelDim * mainMatrix[0].length,
142
- height: cellPixelDim * mainMatrix.length,
143
- channels: 4,
144
- background: { r: 0, g: 0, b: 0, alpha: 0 }, // transparent background
195
+ /**
196
+ * @memberof CyberiaObjectLayer
197
+ * @static
198
+ * @description Builds a PNG image file from a tile matrix and color map using Jimp and Sharp.
199
+ * @param {Object} options - Options object.
200
+ * @param {Object} options.tile - The tile data.
201
+ * @param {Array<number[]>} options.tile.map_color - The color palette.
202
+ * @param {number[][]} options.tile.frame_matrix - The matrix of color indices.
203
+ * @param {string} options.imagePath - The output path for the generated image.
204
+ * @param {number} [options.cellPixelDim=20] - The pixel dimension of each cell in the matrix.
205
+ * @param {function(number, number, number[]): number} [options.opacityFilter] - Function to filter opacity (ignored in this implementation).
206
+ * @returns {Promise<void>}
207
+ * @memberof CyberiaObjectLayer
208
+ */
209
+ static async buildImgFromTile(
210
+ options = {
211
+ tile: { map_color: null, frame_matrix: null },
212
+ imagePath: '',
213
+ cellPixelDim: 20,
214
+ opacityFilter: (x, y, color) => 255,
145
215
  },
146
- };
216
+ ) {
217
+ const { tile, imagePath, cellPixelDim } = options;
218
+ const mainMatrix = tile.frame_matrix;
219
+ if (!mainMatrix || mainMatrix.length === 0 || mainMatrix[0].length === 0) {
220
+ logger.error(`Cannot build image from empty or invalid frame_matrix for path: ${imagePath}`);
221
+ return;
222
+ }
147
223
 
148
- let image = await sharp(sharpOptions).png().toBuffer();
149
- fs.writeFileSync(imagePath, image);
150
- image = await Jimp.read(imagePath);
224
+ const sharpOptions = {
225
+ create: {
226
+ width: cellPixelDim * mainMatrix[0].length,
227
+ height: cellPixelDim * mainMatrix.length,
228
+ channels: 4,
229
+ background: { r: 0, g: 0, b: 0, alpha: 0 }, // transparent background
230
+ },
231
+ };
151
232
 
152
- for (let y = 0; y < mainMatrix.length; y++) {
153
- for (let x = 0; x < mainMatrix[y].length; x++) {
154
- const colorIndex = mainMatrix[y][x];
155
- if (colorIndex === null || colorIndex === undefined) continue;
233
+ let image = await sharp(sharpOptions).png().toBuffer();
234
+ fs.writeFileSync(imagePath, image);
235
+ image = await Jimp.read(imagePath);
156
236
 
157
- const color = tile.map_color[colorIndex];
158
- if (!color) continue;
237
+ for (let y = 0; y < mainMatrix.length; y++) {
238
+ for (let x = 0; x < mainMatrix[y].length; x++) {
239
+ const colorIndex = mainMatrix[y][x];
240
+ if (colorIndex === null || colorIndex === undefined) continue;
159
241
 
160
- const rgbaColor = color.length === 4 ? color : [...color, 255]; // Ensure alpha channel
242
+ const color = tile.map_color[colorIndex];
243
+ if (!color) continue;
161
244
 
162
- for (let dy = 0; dy < cellPixelDim; dy++) {
163
- for (let dx = 0; dx < cellPixelDim; dx++) {
164
- const pixelX = x * cellPixelDim + dx;
165
- const pixelY = y * cellPixelDim + dy;
166
- image.setPixelColor(Jimp.rgbaToInt(...rgbaColor), pixelX, pixelY);
245
+ const rgbaColor = color.length === 4 ? color : [...color, 255]; // Ensure alpha channel
246
+
247
+ for (let dy = 0; dy < cellPixelDim; dy++) {
248
+ for (let dx = 0; dx < cellPixelDim; dx++) {
249
+ const pixelX = x * cellPixelDim + dx;
250
+ const pixelY = y * cellPixelDim + dy;
251
+ image.setPixelColor(rgbaToInt(...rgbaColor), pixelX, pixelY);
252
+ }
167
253
  }
168
254
  }
169
255
  }
256
+
257
+ await image.write(imagePath);
170
258
  }
171
259
 
172
- await image.writeAsync(imagePath);
173
- };
174
-
175
- const generateRandomStats = () => {
176
- return {
177
- effect: random(0, 10),
178
- resistance: random(0, 10),
179
- agility: random(0, 10),
180
- range: random(0, 10),
181
- intelligence: random(0, 10),
182
- utility: random(0, 10),
183
- };
184
- };
185
-
186
- const zIndexPriority = { floor: 0, skin: 1, weapon: 2, skill: 3, coin: 4 };
187
-
188
- export {
189
- pngDirectoryIteratorByObjectLayerType,
190
- readPngAsync,
191
- frameFactory,
192
- getKeyFramesDirectionsFromNumberFolderDirection,
193
- buildImgFromTile,
194
- generateRandomStats,
195
- zIndexPriority,
196
- };
260
+ /**
261
+ * @memberof CyberiaObjectLayer
262
+ * @static
263
+ * @description Generates a random set of character statistics for an item, with values between 0 and 10.
264
+ * @returns {{effect: number, resistance: number, agility: number, range: number, intelligence: number, utility: number}} - The random stats object.
265
+ * @memberof CyberiaObjectLayer
266
+ */
267
+ static generateRandomStats() {
268
+ return {
269
+ effect: random(0, 10),
270
+ resistance: random(0, 10),
271
+ agility: random(0, 10),
272
+ range: random(0, 10),
273
+ intelligence: random(0, 10),
274
+ utility: random(0, 10),
275
+ };
276
+ }
277
+ }
278
+
279
+ /**
280
+ * @memberof CyberiaObjectLayer
281
+ * @constant
282
+ * @description Mapping of item type names to numerical IDs.
283
+ * @type {{floor: number, skin: number, weapon: number, skill: number, coin: number}}
284
+ */
285
+ export const itemTypes = { floor: 0, skin: 1, weapon: 2, skill: 3, coin: 4 };
286
+
287
+ // Export equivalent for backward compatibility with existing destructured imports.
288
+ export const pngDirectoryIteratorByObjectLayerType = ObjectLayerEngine.pngDirectoryIteratorByObjectLayerType;
289
+ export const readPngAsync = ObjectLayerEngine.readPngAsync;
290
+ export const frameFactory = ObjectLayerEngine.frameFactory;
291
+ export const getKeyFramesDirectionsFromNumberFolderDirection =
292
+ ObjectLayerEngine.getKeyFramesDirectionsFromNumberFolderDirection;
293
+ export const buildImgFromTile = ObjectLayerEngine.buildImgFromTile;
294
+ export const generateRandomStats = ObjectLayerEngine.generateRandomStats;
@@ -37,21 +37,15 @@ const logger = loggerFactory(import.meta);
37
37
  * @memberof Peer
38
38
  * @param {object} config - Configuration object for the PeerJS server setup.
39
39
  * @param {number} config.port - The primary port on which the PeerJS server will listen.
40
- * @param {number} [config.devPort] - Optional development port. If provided and in 'development' NODE_ENV, 'http://localhost:${devPort}' is added to allowed origins.
41
40
  * @param {string[]} config.origins - An array of allowed domain origins for Cross-Origin Resource Sharing (CORS).
42
- * @param {string} config.host - The host address the server is bound to (used internally for configuration).
43
41
  * @param {string} config.path - The base path for the API. The PeerJS path ('/peer') will be appended to this.
44
42
  * @returns {Promise<object>} A promise that resolves to an object containing the final configuration and the server instance.
45
43
  * @returns {import('peer').IConfig} return.options - The final options object used to create the PeerServer.
46
44
  * @returns {import('peer').Server} return.peerServer - The created and listening PeerServer instance (wrapped by the listening server factory).
47
45
  * @returns {object} return.meta - The module's import meta object (`import.meta`).
48
46
  */
49
- const createPeerServer = async ({ port, devPort, origins, host, path }) => {
50
- if (process.env.NODE_ENV === 'development' && devPort) {
51
- // logger.warn(`Adding development origin: http://localhost:${devPort}`);
52
- origins.push(`http://localhost:${devPort}`);
53
- }
54
-
47
+ const createPeerServer = async ({ port, origins, path }) => {
48
+ logger.info('origins', origins);
55
49
  /** @type {import('peer').IConfig} */
56
50
  const options = {
57
51
  port,