js-dos 8.5.1 → 8.5.3

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/index-net.html ADDED
@@ -0,0 +1,137 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>js-dos IPX network repro — "Connection is still being established"</title>
6
+ <script type="module" src="/src/main.tsx"></script>
7
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/js-dos@8.4.1/dist/js-dos.css">
8
+ <style>
9
+ html, body { margin: 0; padding: 0; background: #111; color: #eee; font: 14px/1.4 monospace; }
10
+ #ui { padding: 12px; }
11
+ #ui input, #ui button, #ui select { font: inherit; padding: 4px 8px; margin-right: 6px; }
12
+ #dos { width: 640px; height: 480px; background: #000; }
13
+ #log {
14
+ white-space: pre-wrap;
15
+ background: #000;
16
+ color: #7fff7f;
17
+ padding: 8px;
18
+ height: 260px;
19
+ overflow-y: auto;
20
+ border-top: 2px solid #444;
21
+ }
22
+ #peerid { font-weight: bold; color: #ffd479; }
23
+ </style>
24
+ </head>
25
+ <body>
26
+
27
+ <div id="ui">
28
+ <b>js-dos IPX-over-WebRTC minimal repro</b><br><br>
29
+ Role:
30
+ <select id="role">
31
+ <option value="host">host (startIpxServer)</option>
32
+ <option value="join">join (connectIpxAddress)</option>
33
+ </select>
34
+ Peer id to join (numeric, from host's log): <input id="joinId" placeholder="e.g. 731935952" size="14">
35
+ <button id="go">Start</button>
36
+ <div>My peer id: <span id="peerid">(not yet)</span></div>
37
+ </div>
38
+
39
+ <div id="dos"></div>
40
+ <div id="log"></div>
41
+
42
+ <script>
43
+ // Minimal, self-contained reproduction of:
44
+ // https://github.com/caiiiycuk/js-dos/issues/<this issue>
45
+ //
46
+ // No .jsdos bundle is required to reproduce the bug: Dos() is called with
47
+ // no `url` at all (boots straight to an empty DOSBox-X session), because
48
+ // the failure happens purely inside the IPX network setup
49
+ // (startIpxServer / connectIpxAddress + the WebRTC-NET connection
50
+ // lifecycle), before any game/program ever runs.
51
+ //
52
+ // Steps to reproduce:
53
+ // 1. Open this page in tab A, choose "host", click Start.
54
+ // Wait for "My peer id" to show a number, copy it.
55
+ // 2. Open this page in tab B (can be same machine/browser, or a
56
+ // different machine), choose "join", paste the peer id from
57
+ // step 1 into "Peer id to join", click Start.
58
+ // 3. Watch the log in tab B (the joining side). Signaling + ICE
59
+ // negotiation succeed (icestate: connected, connected channel: ...),
60
+ // but the connection is torn down immediately afterward:
61
+ // "Marking connections closed" (x2), an uncaught rejected promise
62
+ // at protocol.ts:385, then "read from peer ...failed with
63
+ // Connection is still being established" and "closing connection
64
+ // to peer".
65
+ //
66
+ // Reproduces identically with default STUN-only ICE servers (as below,
67
+ // no TURN needed) on js-dos 8.4.0 and 8.4.1.
68
+
69
+ var logEl = document.getElementById("log");
70
+ function log(line) {
71
+ logEl.textContent += line + "\n";
72
+ logEl.scrollTop = logEl.scrollHeight;
73
+ }
74
+
75
+ // Mirror console output into the on-page log too, so this is reproducible
76
+ // without opening devtools.
77
+ ["log", "info", "warn", "error"].forEach(function (level) {
78
+ var orig = console[level];
79
+ console[level] = function () {
80
+ var msg = Array.prototype.slice.call(arguments).map(String).join(" ");
81
+ log("[" + level + "] " + msg);
82
+ orig.apply(console, arguments);
83
+ };
84
+ });
85
+
86
+ document.getElementById("go").addEventListener("click", function () {
87
+ var role = document.getElementById("role").value;
88
+ var joinId = document.getElementById("joinId").value.trim();
89
+ var el = document.getElementById("dos");
90
+
91
+ var opts = {
92
+ backend: "dosboxX",
93
+ pathPrefix: "/emulators/",
94
+ net: {
95
+ token: "jsdos-ipx-repro",
96
+ // Default STUN-only servers — bug reproduces the same with or
97
+ // without a TURN relay configured here.
98
+ iceServers: function () {
99
+ return Promise.resolve([
100
+ { urls: "stun:stun.l.google.com:19302" }
101
+ ]);
102
+ }
103
+ }
104
+ };
105
+
106
+ if (role === "host") {
107
+ opts.startIpxServer = true;
108
+ log("Starting as HOST (startIpxServer: true)...");
109
+ } else {
110
+ if (!joinId) {
111
+ alert("Enter the host's numeric peer id first.");
112
+ return;
113
+ }
114
+ opts.connectIpxAddress = joinId;
115
+ log("Starting as JOIN (connectIpxAddress: " + joinId + ")...");
116
+ }
117
+
118
+ Dos(el, opts);
119
+
120
+ var tries = 0;
121
+ var poll = setInterval(function () {
122
+ tries++;
123
+ var pid = window.net && window.net.peerId;
124
+ if (pid) {
125
+ clearInterval(poll);
126
+ document.getElementById("peerid").textContent = String(pid);
127
+ log("My peer id is " + pid);
128
+ } else if (tries > 60) {
129
+ clearInterval(poll);
130
+ log("(peer id never became available)");
131
+ }
132
+ }, 500);
133
+ });
134
+ </script>
135
+
136
+ </body>
137
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-dos",
3
- "version": "8.5.1",
3
+ "version": "8.5.3",
4
4
  "description": "Full-featured DOS player with multiple emulator backends",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -38,7 +38,7 @@
38
38
  "@vitejs/plugin-basic-ssl": "^2.1.0",
39
39
  "autoprefixer": "^10.4.17",
40
40
  "daisyui": "^3.9.3",
41
- "emulators": "8.5.1",
41
+ "emulators": "8.5.2",
42
42
  "eslint": "^8.56.0",
43
43
  "eslint-config-google": "^0.14.0",
44
44
  "postcss": "^8.4.33",
package/release.zip CHANGED
Binary file