@xenon-device-management/xenon 1.1.18 → 1.1.20
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/lib/package.json
CHANGED
package/lib/schema.json
CHANGED
package/lib/src/app/index.js
CHANGED
|
@@ -154,7 +154,8 @@ const findPublicPath = () => {
|
|
|
154
154
|
return fallback;
|
|
155
155
|
};
|
|
156
156
|
const publicPath = findPublicPath();
|
|
157
|
-
logger_1.default.info(`[Xenon]
|
|
157
|
+
logger_1.default.info(`[Xenon] Dashboard assets path: ${publicPath}`);
|
|
158
|
+
logger_1.default.info(`[Xenon] Dashboard available at: /xenon/ (e.g. http://localhost:4723/xenon/)`);
|
|
158
159
|
// Principal Security: Add permissive CSP and CORS for the dashboard
|
|
159
160
|
router.use((req, res, next) => {
|
|
160
161
|
res.setHeader('Content-Security-Policy', "default-src * 'unsafe-inline' 'unsafe-eval' data: blob:; frame-ancestors 'self';");
|
|
@@ -200,13 +201,16 @@ function createRouter(pluginArgs) {
|
|
|
200
201
|
return res.status(404).json({ error: true, message: 'Not Found' });
|
|
201
202
|
logger_1.default.debug(`[Xenon] UI Fallback triggered for: ${url}. Targeting: ${indexPath}`);
|
|
202
203
|
if (fs_1.default.existsSync(indexPath)) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
204
|
+
try {
|
|
205
|
+
const html = fs_1.default.readFileSync(indexPath, 'utf-8');
|
|
206
|
+
res.set('Content-Type', 'text/html');
|
|
207
|
+
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
|
|
208
|
+
return res.send(html);
|
|
209
|
+
}
|
|
210
|
+
catch (err) {
|
|
211
|
+
logger_1.default.error(`[Xenon] UI Fallback read error for ${indexPath}: ${err.message}`);
|
|
212
|
+
return res.status(500).send(`Xenon UI Asset Error: ${err.message}`);
|
|
213
|
+
}
|
|
210
214
|
}
|
|
211
215
|
else {
|
|
212
216
|
logger_1.default.error(`[Xenon] UI Fallback failed: index.html not found at ${indexPath}`);
|
|
@@ -218,7 +222,7 @@ function createRouter(pluginArgs) {
|
|
|
218
222
|
catch (e) {
|
|
219
223
|
logger_1.default.error(`[Xenon] Could not even read directory ${publicPath}: ${e.message}`);
|
|
220
224
|
}
|
|
221
|
-
res.status(404).send('Xenon UI assets not found. Check installation.');
|
|
225
|
+
return res.status(404).send('Xenon UI assets not found. Check installation.');
|
|
222
226
|
}
|
|
223
227
|
});
|
|
224
228
|
return router;
|
|
@@ -148,12 +148,24 @@ let AndroidDeviceManager = class AndroidDeviceManager {
|
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
else if (deviceTypes.androidDeviceType === 'simulated') {
|
|
151
|
-
|
|
151
|
+
const simulated = devices.filter((device) => {
|
|
152
152
|
return device.deviceType === 'emulator';
|
|
153
153
|
});
|
|
154
|
+
if (this.pluginArgs.bootedEmulators) {
|
|
155
|
+
return simulated.filter((device) => device.state === 'device');
|
|
156
|
+
}
|
|
157
|
+
return simulated;
|
|
154
158
|
// return both real and simulated (emulated) devices
|
|
155
159
|
}
|
|
156
160
|
else {
|
|
161
|
+
if (this.pluginArgs.bootedEmulators) {
|
|
162
|
+
return devices.filter((device) => {
|
|
163
|
+
if (device.deviceType === 'emulator') {
|
|
164
|
+
return device.state === 'device';
|
|
165
|
+
}
|
|
166
|
+
return true;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
157
169
|
return devices;
|
|
158
170
|
}
|
|
159
171
|
}
|
package/lib/src/device-utils.js
CHANGED
|
@@ -411,18 +411,15 @@ function updateDeviceList(host, hubArgument, tlsRejectUnauthorized) {
|
|
|
411
411
|
return __awaiter(this, void 0, void 0, function* () {
|
|
412
412
|
const allExistingDevices = yield (0, device_service_1.getAllDevices)();
|
|
413
413
|
const devices = yield getDeviceManager().getDevices(allExistingDevices);
|
|
414
|
-
if (devices.length
|
|
415
|
-
|
|
416
|
-
|
|
414
|
+
if (devices.length > 0) {
|
|
415
|
+
// first thing first. Update device list in local list
|
|
416
|
+
yield (0, device_service_1.addNewDevice)(devices, host);
|
|
417
417
|
}
|
|
418
|
-
// log.debug(`Updating device list with ${JSON.stringify(devices)} devices`);
|
|
419
|
-
// first thing first. Update device list in local list
|
|
420
|
-
yield (0, device_service_1.addNewDevice)(devices, host);
|
|
421
418
|
// Prune any devices that are in our local DB for this host but NO LONGER discovered.
|
|
422
419
|
// This automatically cleans up disconnected Android devices safely, or filtered
|
|
423
420
|
// iOS simulators (e.g. when booted-simulators is turned on and a simulator shuts down)
|
|
424
421
|
const discoveredUdids = new Set(devices.map((d) => d.udid));
|
|
425
|
-
const staleLocalDevices = allExistingDevices.filter((d) => d.host === host && !discoveredUdids.has(d.udid));
|
|
422
|
+
const staleLocalDevices = allExistingDevices.filter((d) => (d.host === host || d.host.includes(`//${host}:`) || d.host.includes(`//${host}/`)) && !discoveredUdids.has(d.udid));
|
|
426
423
|
if (staleLocalDevices.length > 0) {
|
|
427
424
|
logger_1.default.info(`Removing ${staleLocalDevices.length} stale devices/simulators no longer discovered on this host.`);
|
|
428
425
|
yield (0, device_service_1.removeDevice)(staleLocalDevices.map((d) => ({ udid: d.udid, host: d.host })));
|
|
@@ -34,6 +34,7 @@ exports.DefaultPluginArgs = {
|
|
|
34
34
|
bindHostOrIp: ip_1.default.address(),
|
|
35
35
|
enableDashboard: false,
|
|
36
36
|
bootedSimulators: false,
|
|
37
|
+
bootedEmulators: false,
|
|
37
38
|
healthCheckIntervalMs: 86400000,
|
|
38
39
|
healthCheckSchedule: undefined,
|
|
39
40
|
removeDevicesFromDatabaseBeforeRunningThePlugin: false,
|
package/package.json
CHANGED
package/schema.json
CHANGED