flop-guild 0.2.1 → 0.2.2
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/server.js +11 -2
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Public site + read-only MCP over streamable HTTP. No signing, no keys, nothing stored:
|
|
3
3
|
// request bodies are parsed in memory and dropped; there is no request logging.
|
|
4
4
|
import { createServer } from "node:http";
|
|
5
|
-
import { readFileSync, readdirSync } from "node:fs";
|
|
5
|
+
import { readFileSync, readdirSync, realpathSync } from "node:fs";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { GUILD_ROOM, GUILD_ROOM_URL, publicHost, render } from "./config.js";
|
|
@@ -398,7 +398,16 @@ export function startServer(port, host = "0.0.0.0") {
|
|
|
398
398
|
server.listen(port, host);
|
|
399
399
|
return server;
|
|
400
400
|
}
|
|
401
|
-
|
|
401
|
+
/** True when this file is the entry point, including through an npm bin symlink. */
|
|
402
|
+
function isMain() {
|
|
403
|
+
try {
|
|
404
|
+
return !!process.argv[1] && realpathSync(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
405
|
+
}
|
|
406
|
+
catch {
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (isMain()) {
|
|
402
411
|
const port = Number(process.env.PORT || 8080);
|
|
403
412
|
startServer(port, process.env.HOST || "0.0.0.0");
|
|
404
413
|
process.stdout.write(`flop-guild site on :${port} for ${publicHost()}\n`);
|
package/package.json
CHANGED