mirror of
https://github.com/misenhower/splatoon3.ink.git
synced 2026-08-26 10:34:32 -05:00
- Removed mkdirp in favor of native fs.mkdir({ recursive: true })
- Replaced ecstatic (unmaintained since 2021) with sirv
- Replaced jsonpath (security vulnerability) with jsonpath-plus
- Added jsonpathQuery/jsonpathApply helpers in app/common/util.mjs
- Updated sharp: 0.32.6 → 0.34.5
- Updated puppeteer-core: 23.8.0 → 24.37.3
Vulnerabilities reduced from 40 to 1 (only remaining: axios in
threads-api transitive dependency).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
33 lines
610 B
JavaScript
33 lines
610 B
JavaScript
import http from 'http';
|
|
import sirv from 'sirv';
|
|
|
|
export default class HttpServer
|
|
{
|
|
/** @member {http.Server} */
|
|
#server = null;
|
|
|
|
get port() {
|
|
return this.#server.address().port;
|
|
}
|
|
|
|
open() {
|
|
return new Promise((resolve, reject) => {
|
|
if (this.#server) {
|
|
return resolve();
|
|
}
|
|
|
|
const handler = sirv('./dist');
|
|
this.#server = http.createServer(handler);
|
|
this.#server.on('listening', () => resolve());
|
|
this.#server.listen();
|
|
});
|
|
}
|
|
|
|
async close() {
|
|
if (this.#server) {
|
|
await this.#server.close();
|
|
this.#server = null;
|
|
}
|
|
}
|
|
}
|