v2 #1

Merged
sky merged 13 commits from development into main 2025-10-26 12:54:21 -04:00
20 changed files with 1148 additions and 1294 deletions
Showing only changes of commit 31479019f5 - Show all commits

View File

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

View File

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