underpost 2.8.885 → 2.8.886
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/.env.production +3 -0
- package/.github/workflows/ghpkg.ci.yml +1 -1
- package/.github/workflows/npmpkg.ci.yml +1 -1
- package/.github/workflows/publish.ci.yml +5 -5
- package/.github/workflows/pwa-microservices-template-page.cd.yml +1 -1
- package/.github/workflows/pwa-microservices-template-test.ci.yml +1 -1
- package/CHANGELOG.md +145 -1
- package/Dockerfile +1 -1
- package/README.md +3 -3
- package/bin/build.js +18 -9
- package/bin/deploy.js +93 -187
- package/cli.md +2 -2
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +54 -54
- package/manifests/deployment/dd-test-development/proxy.yaml +4 -4
- package/manifests/lxd/underpost-setup.sh +5 -5
- package/package.json +3 -3
- package/scripts/ssl.sh +164 -0
- package/src/cli/baremetal.js +7 -7
- package/src/cli/cloud-init.js +1 -1
- package/src/cli/cluster.js +10 -3
- package/src/cli/cron.js +1 -1
- package/src/cli/db.js +1 -1
- package/src/cli/deploy.js +33 -1
- package/src/cli/fs.js +2 -2
- package/src/cli/image.js +7 -0
- package/src/cli/monitor.js +33 -1
- package/src/cli/run.js +315 -51
- package/src/cli/script.js +32 -0
- package/src/cli/secrets.js +34 -0
- package/src/cli/test.js +42 -1
- package/src/client/components/core/Css.js +0 -8
- package/src/client/components/core/windowGetDimensions.js +229 -162
- package/src/index.js +2 -2
- package/src/mailer/MailerProvider.js +1 -0
- package/src/runtime/express/Express.js +12 -4
- package/src/runtime/lampp/Dockerfile +1 -1
- package/src/server/backup.js +20 -0
- package/src/server/client-build-live.js +12 -10
- package/src/server/client-build.js +136 -91
- package/src/server/client-dev-server.js +16 -2
- package/src/server/client-icons.js +19 -0
- package/src/server/conf.js +470 -60
- package/src/server/dns.js +184 -42
- package/src/server/downloader.js +65 -24
- package/src/server/object-layer.js +260 -162
- package/src/server/peer.js +2 -8
- package/src/server/proxy.js +93 -76
- package/src/server/runtime.js +15 -16
- package/src/server/ssr.js +4 -4
- package/src/server/tls.js +251 -0
- package/src/server/valkey.js +11 -10
- package/src/ws/IoInterface.js +2 -1
- package/src/ws/IoServer.js +2 -1
- package/src/ws/core/core.ws.connection.js +1 -1
- package/src/ws/core/core.ws.emit.js +1 -1
- package/src/ws/core/core.ws.server.js +1 -1
- package/manifests/maas/lxd-preseed.yaml +0 -32
- package/src/server/ssl.js +0 -108
- /package/{manifests/maas → scripts}/device-scan.sh +0 -0
- /package/{manifests/maas → scripts}/gpu-diag.sh +0 -0
- /package/{manifests/maas → scripts}/maas-setup.sh +0 -0
- /package/{manifests/maas → scripts}/nat-iptables.sh +0 -0
- /package/{manifests/maas → scripts}/nvim.sh +0 -0
- /package/{manifests/maas → scripts}/snap-clean.sh +0 -0
- /package/{manifests/maas → scripts}/ssh-cluster-info.sh +0 -0
|
@@ -1,196 +1,294 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
91
|
-
logger.error(`Failed to process image ${path}:`, error);
|
|
151
|
+
return { frame, colors };
|
|
92
152
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
-
|
|
158
|
-
|
|
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
|
-
|
|
242
|
+
const color = tile.map_color[colorIndex];
|
|
243
|
+
if (!color) continue;
|
|
161
244
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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;
|
package/src/server/peer.js
CHANGED
|
@@ -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,
|
|
50
|
-
|
|
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,
|