diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-26 22:29:30 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-26 22:41:21 +1000 |
commit | 99ee7e9400f06e8718612d8b52d15215dc620774 (patch) | |
tree | 08de8c5d3985b9c2eaa419f5198f891ecd82d012 /src/bundle | |
parent | Remove the cdn storage location log (diff) | |
download | server-99ee7e9400f06e8718612d8b52d15215dc620774.tar.xz |
Prettier
Diffstat (limited to 'src/bundle')
-rw-r--r-- | src/bundle/Server.ts | 25 | ||||
-rw-r--r-- | src/bundle/index.ts | 2 | ||||
-rw-r--r-- | src/bundle/start.ts | 22 | ||||
-rw-r--r-- | src/bundle/stats.ts | 11 |
4 files changed, 36 insertions, 24 deletions
diff --git a/src/bundle/Server.ts b/src/bundle/Server.ts index c85daf40..dd75e777 100644 --- a/src/bundle/Server.ts +++ b/src/bundle/Server.ts @@ -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; diff --git a/src/bundle/index.ts b/src/bundle/index.ts index 960d4dc0..45f084c5 100644 --- a/src/bundle/index.ts +++ b/src/bundle/index.ts @@ -1,4 +1,4 @@ export * from "@fosscord/api"; export * from "@fosscord/util"; export * from "@fosscord/gateway"; -export * from "@fosscord/cdn"; \ No newline at end of file +export * from "@fosscord/cdn"; diff --git a/src/bundle/start.ts b/src/bundle/start.ts index 2a1e6520..0c85b58d 100644 --- a/src/bundle/start.ts +++ b/src/bundle/start.ts @@ -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(); }); diff --git a/src/bundle/stats.ts b/src/bundle/stats.ts index 0234e0b4..3a9b2d85 100644 --- a/src/bundle/stats.ts +++ b/src/bundle/stats.ts @@ -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.`, + ), ); } |