websocket-text-relay 1.1.3 → 1.1.4
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/changelog.md +4 -0
- package/package.json +1 -1
- package/src/index.js +2 -2
- package/src/websocket-interface/httpServer.js +14 -5
package/changelog.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 1.1.4 - 2025/08/14
|
|
2
|
+
|
|
3
|
+
Fixed a crash that occurred when the status UI requests a file that doesn't exist.
|
|
4
|
+
|
|
1
5
|
## 1.1.3 - 2025/08/13
|
|
2
6
|
|
|
3
7
|
This change consisted entirely of updating dependencies and cleaning up code. There should be no user facing changes with this version.
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JsonRpcInterface } from "./
|
|
2
|
-
import { WebsocketInterface } from "./
|
|
1
|
+
import { JsonRpcInterface } from "./language-server/JsonRpcInterface.js"
|
|
2
|
+
import { WebsocketInterface } from "./websocket-interface/WebsocketInterface.js"
|
|
3
3
|
|
|
4
4
|
const DEFAULT_WS_PORT = 38378
|
|
5
5
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createServer } from "node:http"
|
|
2
2
|
import path from "node:path"
|
|
3
|
-
import
|
|
3
|
+
import { createReadStream } from "node:fs"
|
|
4
|
+
import fs from "node:fs/promises"
|
|
4
5
|
import * as url from "node:url"
|
|
5
6
|
import { isValidOrigin } from "./util.js"
|
|
6
7
|
const parentDir = url.fileURLToPath(new URL("..", import.meta.url))
|
|
@@ -44,10 +45,18 @@ const requestHandler = (allowedHosts) => (req, res) => {
|
|
|
44
45
|
res.end("NOT FOUND!")
|
|
45
46
|
return
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
|
|
49
|
+
fs.access(filePath, fs.constants.R_OK)
|
|
50
|
+
.then(() => {
|
|
51
|
+
res.setHeader("Content-Type", contentType)
|
|
52
|
+
res.writeHead(200)
|
|
53
|
+
const fileStream = createReadStream(filePath)
|
|
54
|
+
fileStream.pipe(res)
|
|
55
|
+
})
|
|
56
|
+
.catch((e) => {
|
|
57
|
+
res.writeHead(404)
|
|
58
|
+
res.end("NOT FOUND!")
|
|
59
|
+
})
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
export const createHttpServer = ({ port, allowedHosts, allowNetworkAccess }) => {
|