optimizations

This commit is contained in:
sky
2025-09-27 20:54:40 -04:00
parent 36bb49aa80
commit 31479019f5
2 changed files with 11 additions and 9 deletions

View File

@ -27,15 +27,15 @@ app.use(cookieParser());
app.use(express.json({ limit: "10mb" }));
app.use(express.urlencoded({ extended: false }));
app.use(express.text());
app.use("/", (req, res, next) => {
next();
});
// app.use("/", (req, res, next) => {
// next();
// });
// setInterval(()=>{
// }, 1000)
import WebSocket, { WebSocketServer } from "ws";
const wss = new WebSocketServer({ noServer: true });
let openSockets = 0;
// let openSockets = 0;
wss.on("connection", function connection(ws, req, res) {
ws.send(`online=${wss.clients.size}`);
setInterval(() => {
@ -125,7 +125,7 @@ app.post("/api/account/upload", async (req, res, next) => {
res.status(400).send(status);
}
} else {
return "KILL YOURSELF";
// return "KILL YOURSELF";
}
});
@ -243,14 +243,12 @@ app.use("/data/:id/:file", async (req, res) => {
const filePath = path.join(process.env.DATA_PATH, "data", id, file);
try {
await fs.access(filePath);
const image = await fs.readFile(filePath);
if (mime.lookup(filePath) == "image/webp") {
res.type("image/webp");
res.status(200).send(image);
res.status(200).send(await fs.readFile(filePath));
} else if (mime.lookup(filePath) == "audio/ogg") {
res.type("audio/ogg");
res.status(200).send(image);
res.status(200).send(await fs.readFile(filePath));
} else {
res.status(404).send("File not found");
}

View File

@ -2,4 +2,8 @@ module.exports = {
name: "Selenite", // Name of your application
script: "index.js", // Entry point of your application
interpreter: "bun", // Path to the Bun interpreter
watch: true,
cron_restart: '0 0 * * *',
instances : "max",
exec_mode : "cluster"
};