textbrowser 0.43.0 → 0.44.0
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/CHANGES.md +5 -1
- package/package.json +1 -1
- package/server/main.js +19 -4
package/CHANGES.md
CHANGED
package/package.json
CHANGED
package/server/main.js
CHANGED
|
@@ -122,6 +122,19 @@ const srv = http.createServer(async (req, res) => {
|
|
|
122
122
|
}
|
|
123
123
|
fileServer.serve(req, res);
|
|
124
124
|
};
|
|
125
|
+
|
|
126
|
+
const next = function () {
|
|
127
|
+
req.addListener('end', staticServer).resume();
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @returns {Promise<void>}
|
|
132
|
+
*/
|
|
133
|
+
const runHttpServer = async function () {
|
|
134
|
+
// eslint-disable-next-line no-unsanitized/method -- Site-specified plugin
|
|
135
|
+
const server = (await import(userParams.httpServer)).default();
|
|
136
|
+
server(req, res, next);
|
|
137
|
+
};
|
|
125
138
|
if (userParams.expressServer) {
|
|
126
139
|
// eslint-disable-next-line no-unsanitized/method -- Site-specified plugin
|
|
127
140
|
const app = (await import(userParams.expressServer)).default();
|
|
@@ -131,18 +144,20 @@ const srv = http.createServer(async (req, res) => {
|
|
|
131
144
|
// not get any other)
|
|
132
145
|
return regexp.source !== '^\\/?(?=\\/|$)' && regexp.test(req.url);
|
|
133
146
|
})) {
|
|
134
|
-
|
|
135
|
-
const server = (await import(userParams.httpServer)).default();
|
|
136
|
-
server(req, res);
|
|
147
|
+
runHttpServer();
|
|
137
148
|
return;
|
|
138
149
|
}
|
|
139
150
|
|
|
140
151
|
app.get('*', staticServer);
|
|
141
152
|
app(req, res);
|
|
142
153
|
|
|
154
|
+
return;
|
|
155
|
+
} else if (userParams.httpServer) {
|
|
156
|
+
runHttpServer();
|
|
143
157
|
return;
|
|
144
158
|
}
|
|
145
|
-
|
|
159
|
+
|
|
160
|
+
next();
|
|
146
161
|
/*
|
|
147
162
|
res.writeHead(404, {'Content-Type': 'text/html'});
|
|
148
163
|
res.end('<h1>File not found</h1>');
|