@midscene/android-playground 1.6.1-beta-20260331083547.0 → 1.6.1

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/dist/es/bin.mjs CHANGED
@@ -146,11 +146,14 @@ const LOOPBACK_HOSTS = new Set([
146
146
  '::1',
147
147
  '[::1]'
148
148
  ]);
149
- function isLoopbackOrigin(origin) {
149
+ function isPrivateIP(hostname) {
150
+ return LOOPBACK_HOSTS.has(hostname) || /^10\./.test(hostname) || /^172\.(1[6-9]|2\d|3[01])\./.test(hostname) || /^192\.168\./.test(hostname) || /^100\.(6[4-9]|[7-9]\d|1[0-2]\d)\./.test(hostname);
151
+ }
152
+ function isAllowedOrigin(origin) {
150
153
  if (!origin) return true;
151
154
  try {
152
155
  const url = new URL(origin);
153
- return LOOPBACK_HOSTS.has(url.hostname);
156
+ return isPrivateIP(url.hostname);
154
157
  } catch {
155
158
  return false;
156
159
  }
@@ -422,8 +425,9 @@ class ScrcpyServer {
422
425
  async launch(port) {
423
426
  this.port = port || this.defaultPort;
424
427
  return new Promise((resolve)=>{
425
- this.httpServer.listen(this.port, ()=>{
426
- console.log(`Scrcpy server running at: http://localhost:${this.port}`);
428
+ const listenPort = this.port ?? this.defaultPort;
429
+ this.httpServer.listen(listenPort, '0.0.0.0', ()=>{
430
+ console.log(`Scrcpy server running at: http://0.0.0.0:${this.port}`);
427
431
  this.startDeviceMonitoring();
428
432
  resolve(this);
429
433
  });
@@ -476,7 +480,7 @@ class ScrcpyServer {
476
480
  this.io = new Server(this.httpServer, {
477
481
  cors: {
478
482
  origin (origin, callback) {
479
- callback(null, isLoopbackOrigin(origin));
483
+ callback(null, isAllowedOrigin(origin));
480
484
  },
481
485
  methods: [
482
486
  'GET',
@@ -487,7 +491,7 @@ class ScrcpyServer {
487
491
  });
488
492
  this.app.use(cors({
489
493
  origin (origin, callback) {
490
- callback(null, isLoopbackOrigin(origin));
494
+ callback(null, isAllowedOrigin(origin));
491
495
  },
492
496
  credentials: true
493
497
  }));
package/dist/es/index.mjs CHANGED
@@ -146,11 +146,14 @@ const LOOPBACK_HOSTS = new Set([
146
146
  '::1',
147
147
  '[::1]'
148
148
  ]);
149
- function isLoopbackOrigin(origin) {
149
+ function isPrivateIP(hostname) {
150
+ return LOOPBACK_HOSTS.has(hostname) || /^10\./.test(hostname) || /^172\.(1[6-9]|2\d|3[01])\./.test(hostname) || /^192\.168\./.test(hostname) || /^100\.(6[4-9]|[7-9]\d|1[0-2]\d)\./.test(hostname);
151
+ }
152
+ function isAllowedOrigin(origin) {
150
153
  if (!origin) return true;
151
154
  try {
152
155
  const url = new URL(origin);
153
- return LOOPBACK_HOSTS.has(url.hostname);
156
+ return isPrivateIP(url.hostname);
154
157
  } catch {
155
158
  return false;
156
159
  }
@@ -422,8 +425,9 @@ class ScrcpyServer {
422
425
  async launch(port) {
423
426
  this.port = port || this.defaultPort;
424
427
  return new Promise((resolve)=>{
425
- this.httpServer.listen(this.port, ()=>{
426
- console.log(`Scrcpy server running at: http://localhost:${this.port}`);
428
+ const listenPort = this.port ?? this.defaultPort;
429
+ this.httpServer.listen(listenPort, '0.0.0.0', ()=>{
430
+ console.log(`Scrcpy server running at: http://0.0.0.0:${this.port}`);
427
431
  this.startDeviceMonitoring();
428
432
  resolve(this);
429
433
  });
@@ -476,7 +480,7 @@ class ScrcpyServer {
476
480
  this.io = new Server(this.httpServer, {
477
481
  cors: {
478
482
  origin (origin, callback) {
479
- callback(null, isLoopbackOrigin(origin));
483
+ callback(null, isAllowedOrigin(origin));
480
484
  },
481
485
  methods: [
482
486
  'GET',
@@ -487,7 +491,7 @@ class ScrcpyServer {
487
491
  });
488
492
  this.app.use(cors({
489
493
  origin (origin, callback) {
490
- callback(null, isLoopbackOrigin(origin));
494
+ callback(null, isAllowedOrigin(origin));
491
495
  },
492
496
  credentials: true
493
497
  }));
package/dist/lib/bin.js CHANGED
@@ -172,11 +172,14 @@ const LOOPBACK_HOSTS = new Set([
172
172
  '::1',
173
173
  '[::1]'
174
174
  ]);
175
- function isLoopbackOrigin(origin) {
175
+ function isPrivateIP(hostname) {
176
+ return LOOPBACK_HOSTS.has(hostname) || /^10\./.test(hostname) || /^172\.(1[6-9]|2\d|3[01])\./.test(hostname) || /^192\.168\./.test(hostname) || /^100\.(6[4-9]|[7-9]\d|1[0-2]\d)\./.test(hostname);
177
+ }
178
+ function isAllowedOrigin(origin) {
176
179
  if (!origin) return true;
177
180
  try {
178
181
  const url = new URL(origin);
179
- return LOOPBACK_HOSTS.has(url.hostname);
182
+ return isPrivateIP(url.hostname);
180
183
  } catch {
181
184
  return false;
182
185
  }
@@ -448,8 +451,9 @@ class ScrcpyServer {
448
451
  async launch(port) {
449
452
  this.port = port || this.defaultPort;
450
453
  return new Promise((resolve)=>{
451
- this.httpServer.listen(this.port, ()=>{
452
- console.log(`Scrcpy server running at: http://localhost:${this.port}`);
454
+ const listenPort = this.port ?? this.defaultPort;
455
+ this.httpServer.listen(listenPort, '0.0.0.0', ()=>{
456
+ console.log(`Scrcpy server running at: http://0.0.0.0:${this.port}`);
453
457
  this.startDeviceMonitoring();
454
458
  resolve(this);
455
459
  });
@@ -502,7 +506,7 @@ class ScrcpyServer {
502
506
  this.io = new external_socket_io_namespaceObject.Server(this.httpServer, {
503
507
  cors: {
504
508
  origin (origin, callback) {
505
- callback(null, isLoopbackOrigin(origin));
509
+ callback(null, isAllowedOrigin(origin));
506
510
  },
507
511
  methods: [
508
512
  'GET',
@@ -513,7 +517,7 @@ class ScrcpyServer {
513
517
  });
514
518
  this.app.use(external_cors_default()({
515
519
  origin (origin, callback) {
516
- callback(null, isLoopbackOrigin(origin));
520
+ callback(null, isAllowedOrigin(origin));
517
521
  },
518
522
  credentials: true
519
523
  }));
package/dist/lib/index.js CHANGED
@@ -187,11 +187,14 @@ const LOOPBACK_HOSTS = new Set([
187
187
  '::1',
188
188
  '[::1]'
189
189
  ]);
190
- function isLoopbackOrigin(origin) {
190
+ function isPrivateIP(hostname) {
191
+ return LOOPBACK_HOSTS.has(hostname) || /^10\./.test(hostname) || /^172\.(1[6-9]|2\d|3[01])\./.test(hostname) || /^192\.168\./.test(hostname) || /^100\.(6[4-9]|[7-9]\d|1[0-2]\d)\./.test(hostname);
192
+ }
193
+ function isAllowedOrigin(origin) {
191
194
  if (!origin) return true;
192
195
  try {
193
196
  const url = new URL(origin);
194
- return LOOPBACK_HOSTS.has(url.hostname);
197
+ return isPrivateIP(url.hostname);
195
198
  } catch {
196
199
  return false;
197
200
  }
@@ -463,8 +466,9 @@ class ScrcpyServer {
463
466
  async launch(port) {
464
467
  this.port = port || this.defaultPort;
465
468
  return new Promise((resolve)=>{
466
- this.httpServer.listen(this.port, ()=>{
467
- console.log(`Scrcpy server running at: http://localhost:${this.port}`);
469
+ const listenPort = this.port ?? this.defaultPort;
470
+ this.httpServer.listen(listenPort, '0.0.0.0', ()=>{
471
+ console.log(`Scrcpy server running at: http://0.0.0.0:${this.port}`);
468
472
  this.startDeviceMonitoring();
469
473
  resolve(this);
470
474
  });
@@ -517,7 +521,7 @@ class ScrcpyServer {
517
521
  this.io = new external_socket_io_namespaceObject.Server(this.httpServer, {
518
522
  cors: {
519
523
  origin (origin, callback) {
520
- callback(null, isLoopbackOrigin(origin));
524
+ callback(null, isAllowedOrigin(origin));
521
525
  },
522
526
  methods: [
523
527
  'GET',
@@ -528,7 +532,7 @@ class ScrcpyServer {
528
532
  });
529
533
  this.app.use(external_cors_default()({
530
534
  origin (origin, callback) {
531
- callback(null, isLoopbackOrigin(origin));
535
+ callback(null, isAllowedOrigin(origin));
532
536
  },
533
537
  credentials: true
534
538
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/android-playground",
3
- "version": "1.6.1-beta-20260331083547.0",
3
+ "version": "1.6.1",
4
4
  "description": "Android playground for Midscene",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -34,10 +34,10 @@
34
34
  "express": "^4.21.2",
35
35
  "open": "10.1.0",
36
36
  "socket.io": "^4.8.1",
37
- "@midscene/android": "1.6.1-beta-20260331083547.0",
38
- "@midscene/core": "1.6.1-beta-20260331083547.0",
39
- "@midscene/playground": "1.6.1-beta-20260331083547.0",
40
- "@midscene/shared": "1.6.1-beta-20260331083547.0"
37
+ "@midscene/core": "1.6.1",
38
+ "@midscene/android": "1.6.1",
39
+ "@midscene/playground": "1.6.1",
40
+ "@midscene/shared": "1.6.1"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@rslib/core": "^0.18.3",
package/static/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html><head><title>Midscene Android Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.ed140d90.js"></script><script defer src="/static/js/259.4cdd8e11.js"></script><script defer src="/static/js/index.2c508696.js"></script><link href="/static/css/index.1c539585.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
1
+ <!doctype html><html><head><title>Midscene Android Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.ed140d90.js"></script><script defer src="/static/js/807.fe401934.js"></script><script defer src="/static/js/index.69733560.js"></script><link href="/static/css/index.1c539585.css" rel="stylesheet"></head><body><div id="root"></div></body></html>