This commit is contained in:
Madeline
2022-09-26 22:41:21 +10:00
parent fcc0884e36
commit 99ee7e9400
280 changed files with 6778 additions and 3908 deletions
+18 -7
View File
@@ -22,7 +22,7 @@ const cdn = new CDNServer({ server, port, production, app });
const gateway = new Gateway.Server({ server, port, production });
//this is what has been added for the /stop API route
process.on('SIGTERM', () => {
process.on("SIGTERM", () => {
server.close(() => {
console.log("Stop API has been successfully POSTed, SIGTERM sent");
});
@@ -66,7 +66,9 @@ async function main() {
//Sentry
if (Config.get().sentry.enabled) {
console.log(
`[Bundle] ${yellow("You are using Sentry! This may slightly impact performance on large loads!")}`
`[Bundle] ${yellow(
"You are using Sentry! This may slightly impact performance on large loads!",
)}`,
);
Sentry.init({
dsn: Config.get().sentry.endpoint,
@@ -81,7 +83,10 @@ async function main() {
Sentry.addGlobalEventProcessor((event, hint) => {
if (event.transaction) {
event.transaction = event.transaction.split("/").map(x => !parseInt(x) ? x : ":id").join("/");
event.transaction = event.transaction
.split("/")
.map((x) => (!parseInt(x) ? x : ":id"))
.join("/");
}
delete event.request?.cookies;
@@ -93,14 +98,20 @@ async function main() {
}
if (event.breadcrumbs) {
event.breadcrumbs = event.breadcrumbs.filter(x => {
event.breadcrumbs = event.breadcrumbs.filter((x) => {
if (x.message?.includes("identified as")) return false;
if (x.message?.includes("[WebSocket] closed")) return false;
if (x.message?.includes("Got Resume -> cancel not implemented")) return false;
if (x.message?.includes("[Gateway] New connection from")) return false;
if (
x.message?.includes(
"Got Resume -> cancel not implemented",
)
)
return false;
if (x.message?.includes("[Gateway] New connection from"))
return false;
return true;
})
});
}
return event;
+1 -1
View File
@@ -1,4 +1,4 @@
export * from "@fosscord/api";
export * from "@fosscord/util";
export * from "@fosscord/gateway";
export * from "@fosscord/cdn";
export * from "@fosscord/cdn";
+12 -10
View File
@@ -1,5 +1,5 @@
// process.env.MONGOMS_DEBUG = "true";
require('module-alias/register');
require("module-alias/register");
import "reflect-metadata";
import cluster, { Worker } from "cluster";
import os from "os";
@@ -37,18 +37,20 @@ if (cluster.isMaster) {
╚═╝ ╚═════╝ ╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝
fosscord-server | ${yellow(
`Pre-release (${commit !== null
? commit.slice(0, 7)
: "Unknown (Git cannot be found)"
})`
`Pre-release (${
commit !== null
? commit.slice(0, 7)
: "Unknown (Git cannot be found)"
})`,
)}
Commit Hash: ${commit !== null
Commit Hash: ${
commit !== null
? `${cyan(commit)} (${yellow(commit.slice(0, 7))})`
: "Unknown (Git cannot be found)"
}
}
Cores: ${cyan(os.cpus().length)} (Using ${cores} thread(s).)
`)
`),
);
if (commit == null) {
@@ -85,8 +87,8 @@ Cores: ${cyan(os.cpus().length)} (Using ${cores} thread(s).)
cluster.on("exit", (worker: any, code: any, signal: any) => {
console.log(
`[Worker] ${red(
`died with PID: ${worker.process.pid} , restarting ...`
)}`
`died with PID: ${worker.process.pid} , restarting ...`,
)}`,
);
cluster.fork();
});
+5 -6
View File
@@ -6,18 +6,17 @@ export function initStats() {
console.log(`[Path] running in ${__dirname}`);
try {
console.log(`[CPU] ${osu.cpu.model()} Cores x${osu.cpu.count()}`);
} catch {
console.log("[CPU] Failed to get cpu model!");
}
catch {
console.log('[CPU] Failed to get cpu model!')
}
console.log(`[System] ${os.platform()} ${os.arch()}`);
console.log(`[Process] running with PID: ${process.pid}`);
if (process.getuid && process.getuid() === 0) {
console.warn(
red(
`[Process] Warning fosscord is running as root, this highly discouraged and might expose your system vulnerable to attackers. Please run fosscord as a user without root privileges.`
)
`[Process] Warning fosscord is running as root, this highly discouraged and might expose your system vulnerable to attackers. Please run fosscord as a user without root privileges.`,
),
);
}