claude-code-rehab 1.0.0 → 1.0.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/index.mjs +22 -9
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -106,12 +106,25 @@ const server = createServer(async (req, res) => {
|
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
function tryListen(port) {
|
|
110
|
+
server.listen(port, "0.0.0.0", () => {
|
|
111
|
+
const ips = getLocalIPs();
|
|
112
|
+
console.log("\n Claude Code Rehab — Data Server\n");
|
|
113
|
+
console.log(` Local: http://localhost:${port}`);
|
|
114
|
+
ips.forEach(ip => console.log(` Network: http://${ip}:${port}`));
|
|
115
|
+
console.log(`\n Open the app on your phone and enter:`);
|
|
116
|
+
ips.forEach(ip => console.log(` ${ip}:${port}`));
|
|
117
|
+
console.log("\n Ctrl+C to stop\n");
|
|
118
|
+
});
|
|
119
|
+
server.on("error", (e) => {
|
|
120
|
+
if (e.code === "EADDRINUSE" && port < PORT + 10) {
|
|
121
|
+
console.log(` Port ${port} in use, trying ${port + 1}...`);
|
|
122
|
+
server.close();
|
|
123
|
+
tryListen(port + 1);
|
|
124
|
+
} else {
|
|
125
|
+
console.error(` Error: ${e.message}`);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
tryListen(PORT);
|