mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
ELECTRON: Specify mime type when loading wasm files (#2262)
This commit is contained in:
@@ -219,7 +219,11 @@ app.on("ready", async () => {
|
||||
relativePath = path.relative(__dirname, realPath);
|
||||
// Only allow access to files in "dist" folder or html files in the same directory
|
||||
if (method === "GET" && (relativePath.startsWith("dist") || relativePath.match(/^[a-zA-Z-_]*\.html/))) {
|
||||
return new Response(readFileSync(realPath));
|
||||
const customHeaders = {};
|
||||
if (relativePath.endsWith(".wasm")) {
|
||||
customHeaders["Content-Type"] = "application/wasm";
|
||||
}
|
||||
return new Response(readFileSync(realPath), { headers: new Headers(customHeaders) });
|
||||
}
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
|
||||
Reference in New Issue
Block a user