Skip to content

Commit 8c254db

Browse files
committed
build-and-run.sh is a separate script
1 parent 633da22 commit 8c254db

File tree

6 files changed

+22
-20
lines changed

6 files changed

+22
-20
lines changed

README.md

+14-16
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,25 @@
77
Install `node` and `npm`. (For NixOS, see `./*.nixos.sh` for convenience.)
88

99
```
10-
./run.sh
10+
./build-and-run.sh
1111
```
1212

1313
To allow external device access: (Note: The security of this project has not been thoroughly audited. Use at your own risk.)
1414

1515
```diff
16-
diff --git a/lib/server.js b/lib/server.js
17-
index a0d9906..f3e06ac 100644
18-
--- a/lib/server.js
19-
+++ b/lib/server.js
20-
@@ -23,8 +23,8 @@ function main() {
21-
webSocketServer.on("connection", function(socket) {
22-
handleNewSocket(socket);
23-
});
24-
- httpServer.listen(25407, "127.0.0.1", function(err) {
25-
- console.log("serving: http://127.0.0.1:25407/");
26-
+ httpServer.listen(25407, "0.0.0.0", function(err) {
27-
+ console.log("serving: http://0.0.0.0:25407/");
28-
});
29-
});
30-
}
16+
diff --git a/lib/server.ts b/lib/server.ts
17+
index eedb131..b4f8699 100644
18+
--- a/lib/server.ts
19+
+++ b/lib/server.ts
20+
@@ -5,7 +5,7 @@ import {WebSocket, WebSocketServer} from "ws";
21+
import database from "./database";
22+
import defaultRoomState from "./defaultRoom";
23+
24+
-const bindIpAddress = "127.0.0.1";
25+
+const bindIpAddress = "0.0.0.0";
26+
27+
function main() {
28+
var app = express();
3129
```
3230

3331
## Status

build-and-run.nixos.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exec nix-shell --pure -p nodejs --run 'exec ./build-and-run.sh'

build-and-run.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./build.sh && exec npm run run

lib/server.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {WebSocket, WebSocketServer} from "ws";
55
import database from "./database";
66
import defaultRoomState from "./defaultRoom";
77

8+
const bindIpAddress = "127.0.0.1";
9+
810
function main() {
911
var app = express();
1012
app.use(express.static("../public"));
@@ -16,8 +18,8 @@ function main() {
1618
wss.on("connection", function(socket) {
1719
handleNewSocket(socket);
1820
});
19-
httpServer.listen(25407, "127.0.0.1", function() {
20-
console.log("serving: http://127.0.0.1:25407/");
21+
httpServer.listen(25407, bindIpAddress, function() {
22+
console.log(`serving: http://${bindIpAddress}:25407/`);
2123
});
2224
}
2325

public/ui_layout.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function submitRoomCode() {
192192
const loadingMessageDiv = document.getElementById("loadingMessageDiv") as HTMLDivElement;
193193
export function setScreenMode(newMode: ScreenMode) {
194194
screenMode = newMode;
195-
let loadingMessage = null;
195+
let loadingMessage: string | null = null;
196196
let activeDivId = (function () {
197197
switch (screenMode) {
198198
case ScreenMode.PLAY: return "roomDiv";

run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
./build.sh && exec npm run run
1+
cd lib && exec node server.js

0 commit comments

Comments
 (0)