prut
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { crackdown } from "../utils/crackdown.js";
|
||||
import { parseArgs } from "../utils/parseArgs.js";
|
||||
import { MessageType } from "../utils/messages.js";
|
||||
import { sprintf } from "sprintf-js";
|
||||
import { Config } from "../config.js";
|
||||
|
||||
/** Regex to validate if a :help [topic] command i entered correctly */
|
||||
const helpRegex = /^:help(?:\s+(.*))?$/;
|
||||
@@ -72,7 +74,10 @@ class MUDClient {
|
||||
|
||||
connect() {
|
||||
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
||||
const wsUrl = `${protocol}//${window.location.host}`;
|
||||
|
||||
const wsUrl = `${protocol}//${window.location.host}`.replace(/:\d+$/, Config.port);
|
||||
|
||||
console.log(window.location);
|
||||
|
||||
this.updateStatus("Connecting...", "connecting");
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
<title>WebSocket MUD</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link rel="stylesheet" href="style.sass" />
|
||||
<link rel="stylesheet" href="style.scss" />
|
||||
<link rel="manifest" href="manifest.json" />
|
||||
<lin rel="icon" href="favicon.ico" />
|
||||
<lin rel="icon" href="/favicon.ico" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
@@ -28,5 +28,6 @@
|
||||
</div>
|
||||
|
||||
<script type="module" src="client.js"></script>
|
||||
//# sourceMappingURL=
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1 +1,20 @@
|
||||
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
||||
{
|
||||
"name": "",
|
||||
"short_name": "",
|
||||
"icons": [
|
||||
{
|
||||
"src": "./img/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "./img/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
||||
|
||||
|
||||
@@ -26,20 +26,20 @@ body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* #output { */
|
||||
/* flex: 1; */
|
||||
/* background-color: #000; */
|
||||
/* border: 2px solid #333; */
|
||||
/* padding: 15px; */
|
||||
/* overflow-y: auto; */
|
||||
/* white-space: pre-wrap; */
|
||||
/* line-height: 1.4; */
|
||||
/* margin-bottom: 20px; */
|
||||
/* font-family: "Fira Code", monospace; */
|
||||
/* font-optical-sizing: auto; */
|
||||
/* font-size: 14px; */
|
||||
/* width: 100ch; */
|
||||
/* } */
|
||||
#output {
|
||||
flex: 1;
|
||||
background-color: #000;
|
||||
border: 2px solid #333;
|
||||
padding: 15px;
|
||||
overflow-y: auto;
|
||||
white-space: pre-wrap;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 20px;
|
||||
font-family: "Fira Code", monospace;
|
||||
font-optical-sizing: auto;
|
||||
font-size: 14px;
|
||||
width: 100ch;
|
||||
}
|
||||
|
||||
#input-container {
|
||||
display: flex;
|
||||
@@ -1,8 +1,12 @@
|
||||
export default {
|
||||
import { defineConfig } from "vite";
|
||||
import devtoolsJson from "vite-plugin-devtools-json";
|
||||
|
||||
export default defineConfig({
|
||||
root: ".",
|
||||
plugins: [devtoolsJson()],
|
||||
build: {
|
||||
outDir: "../public/",
|
||||
emptyOutDir: true, // also necessary
|
||||
sourcemap: "inline",
|
||||
sourcemap: true,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
30
server/package-lock.json
generated
30
server/package-lock.json
generated
@@ -18,7 +18,8 @@
|
||||
"nodemon": "^3.0.1",
|
||||
"prettier": "3.6.2",
|
||||
"sass-embedded": "^1.92.1",
|
||||
"vite": "^7.1.5"
|
||||
"vite": "^7.1.5",
|
||||
"vite-plugin-devtools-json": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
@@ -2464,6 +2465,20 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
|
||||
"integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
"https://github.com/sponsors/broofa",
|
||||
"https://github.com/sponsors/ctavan"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist/esm/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/varint": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz",
|
||||
@@ -2546,6 +2561,19 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-devtools-json": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vite-plugin-devtools-json/-/vite-plugin-devtools-json-1.0.0.tgz",
|
||||
"integrity": "sha512-MobvwqX76Vqt/O4AbnNMNWoXWGrKUqZbphCUle/J2KXH82yKQiunOeKnz/nqEPosPsoWWPP9FtNuPBSYpiiwkw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"uuid": "^11.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vite/node_modules/fdir": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
"nodemon": "^3.0.1",
|
||||
"prettier": "3.6.2",
|
||||
"sass-embedded": "^1.92.1",
|
||||
"vite": "^7.1.5"
|
||||
"vite": "^7.1.5",
|
||||
"vite-plugin-devtools-json": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>WebSocket MUD</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link rel="manifest" href="/assets/manifest-BwHFeIBa.json" />
|
||||
<script type="module" crossorigin src="/assets/index-Dz3BJtZ6.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DHjAscAP.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<div id="status" class="connecting">Connecting...</div>
|
||||
<div id="output"></div>
|
||||
<div id="input-container">
|
||||
<input
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
id="input"
|
||||
placeholder="Enter command..."
|
||||
disabled
|
||||
autocorrect="off"
|
||||
autocomplete="off"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,3 +1,4 @@
|
||||
import { sprintf } from "sprintf-js";
|
||||
import { Session } from "../models/session.js";
|
||||
import { Prompt } from "./prompt.js";
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ class MudServer {
|
||||
".css": "text/css",
|
||||
".html": "text/html",
|
||||
".ico": "image/x-icon",
|
||||
".map": "application/json",
|
||||
".js": "application/javascript",
|
||||
".json": "application/json",
|
||||
".png": "image/png",
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
class Mufassa {
|
||||
x = 42;
|
||||
}
|
||||
const foo = new Mufassa();
|
||||
2
server/utils/parseArgs.js
Normal file → Executable file
2
server/utils/parseArgs.js
Normal file → Executable file
@@ -5,7 +5,7 @@
|
||||
* @returns {(string|number)[]} Command arguments
|
||||
*/
|
||||
export function parseArgs(cmdString) {
|
||||
if (typeof cmdString === "string") {
|
||||
if (typeof cmdString !== "string") {
|
||||
throw new Error("Expected string. GoT a finger in the eye instead");
|
||||
}
|
||||
const args = [];
|
||||
|
||||
Reference in New Issue
Block a user