mirror of
https://github.com/spacebarchat/server.git
synced 2026-03-30 13:55:39 +00:00
properly mark unused params
This commit is contained in:
43
.idea/workspace.xml
generated
43
.idea/workspace.xml
generated
@@ -12,6 +12,18 @@
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="CopilotPersistence">
|
||||
<persistenceIdMap>
|
||||
<entry key="_/home/Rory/git/spacebar/server-master" value="2oJ9u2nkEFq1qQW1NFF69ECjiYu" />
|
||||
</persistenceIdMap>
|
||||
</component>
|
||||
<component name="CopilotUserSelectedModel">
|
||||
<selectedModels>
|
||||
<entry key="chat-panel" value="Gemini 3 Pro (Preview)" />
|
||||
<entry key="agent-panel" value="Gemini 3 Pro (Preview)" />
|
||||
<entry key="edit-panel" value="GPT-5 mini" />
|
||||
</selectedModels>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
@@ -42,7 +54,7 @@
|
||||
<scope name="src" pattern="!file[server]:*/||file[server]:src//*" />
|
||||
</component>
|
||||
<component name="ProblemsViewState">
|
||||
<option name="selectedTabId" value="ProjectErrors" />
|
||||
<option name="selectedTabId" value="QODANA_PROBLEMS_VIEW_TAB" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"customColor": "",
|
||||
@@ -99,6 +111,24 @@
|
||||
]
|
||||
}
|
||||
}</component>
|
||||
<component name="QodanaHighlightedReportService">
|
||||
<option name="localRunNotPublishedPersistedInfo">
|
||||
<LocalReportPersistedInfo>
|
||||
<option name="path" value="/tmp/qodana_output1/qodana.sarif.json" />
|
||||
<option name="reportGuid" value="ffc75f9a-8af2-4039-9caf-5031bc73d78a" />
|
||||
<option name="reportName" value="server-master/qodana/2026-03-14" />
|
||||
</LocalReportPersistedInfo>
|
||||
</option>
|
||||
</component>
|
||||
<component name="QodanaIsSelectedPersistenceService">
|
||||
<option name="selectedOrLoading" value="true" />
|
||||
</component>
|
||||
<component name="QodanaReportsService">
|
||||
<option name="descriptions">
|
||||
<ReportDescription localRun="true" path="/tmp/qodana_output/qodana.sarif.json" reportGuid="23b693fa-9bcf-42d2-b172-3372ba9c21ff" reportId="server-master/qodana/2026-03-14" />
|
||||
<ReportDescription localRun="true" path="/tmp/qodana_output1/qodana.sarif.json" reportGuid="ffc75f9a-8af2-4039-9caf-5031bc73d78a" reportId="server-master/qodana/2026-03-14" />
|
||||
</option>
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/nix/modules/default" />
|
||||
@@ -130,8 +160,6 @@
|
||||
<entry key="Start CDN" value="STOPPED" />
|
||||
<entry key="Start Gateway" value="STOPPED" />
|
||||
<entry key="Start bundle" value="STOPPED" />
|
||||
<entry key="build:src:tsgo" value="STOPPED" />
|
||||
<entry key="build:tsgo" value="STOPPED" />
|
||||
</map>
|
||||
</value>
|
||||
</entry>
|
||||
@@ -194,6 +222,7 @@
|
||||
<workItem from="1772714447261" duration="12025000" />
|
||||
<workItem from="1772830175841" duration="4576000" />
|
||||
<workItem from="1772918744394" duration="70646000" />
|
||||
<workItem from="1773448797192" duration="8146000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@@ -232,4 +261,12 @@
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
<component name="github-copilot-workspace">
|
||||
<instructionFileLocations>
|
||||
<option value=".github/instructions" />
|
||||
</instructionFileLocations>
|
||||
<promptFileLocations>
|
||||
<option value=".github/prompts" />
|
||||
</promptFileLocations>
|
||||
</component>
|
||||
</project>
|
||||
@@ -210,11 +210,11 @@ async function main() {
|
||||
for (const defKey in schema.definitions) {
|
||||
if (definitions[defKey] && deepEqual(definitions[defKey], schema.definitions[defKey])) {
|
||||
// console.log("Definition", defKey, "from schema", schemaName, "is identical to existing definition, skipping.");
|
||||
schema.definitions = Object.fromEntries(Object.entries(schema.definitions).filter(([k, v]) => k !== defKey));
|
||||
schema.definitions = Object.fromEntries(Object.entries(schema.definitions).filter(([k, _]) => k !== defKey));
|
||||
process.stdout.write(greenBright("T"));
|
||||
} else if (!nestedDefinitions[defKey]) {
|
||||
nestedDefinitions[defKey] = schema.definitions[defKey];
|
||||
schema.definitions = Object.fromEntries(Object.entries(schema.definitions).filter(([k, v]) => k !== defKey));
|
||||
schema.definitions = Object.fromEntries(Object.entries(schema.definitions).filter(([k, _]) => k !== defKey));
|
||||
// console.log("Tracking sub-definition", defKey, "from schema", schemaName);
|
||||
process.stdout.write(green("N"));
|
||||
} else if (!deepEqual(nestedDefinitions[defKey], schema.definitions[defKey])) {
|
||||
@@ -222,7 +222,7 @@ async function main() {
|
||||
console.log(columnizedObjectDiff(nestedDefinitions[defKey], schema.definitions[defKey], true));
|
||||
} else {
|
||||
// console.log("Definition", defKey, "from schema", schemaName, "is identical to existing definition, skipping.");
|
||||
schema.definitions = Object.fromEntries(Object.entries(schema.definitions).filter(([k, v]) => k !== defKey));
|
||||
schema.definitions = Object.fromEntries(Object.entries(schema.definitions).filter(([k, _]) => k !== defKey));
|
||||
process.stdout.write(greenBright("M"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ const express = require("express");
|
||||
const path = require("path");
|
||||
const { traverseDirectory } = require("lambert-server");
|
||||
const RouteUtility = require("../../dist/api/util/handlers/route.js");
|
||||
const { bgRedBright, greenBright, yellowBright, blueBright, redBright, underline, bold, bgYellow, black } = require("picocolors");
|
||||
const { greenBright, yellowBright, blueBright, redBright, underline, bgYellow, black } = require("picocolors");
|
||||
|
||||
const methods = ["get", "post", "put", "delete", "patch"];
|
||||
const routes = new Map();
|
||||
|
||||
@@ -120,7 +120,7 @@ export async function Authentication(req: Request, res: Response, next: NextFunc
|
||||
if (!req.headers.authorization) return next(new HTTPError("Missing Authorization Header", 401));
|
||||
|
||||
try {
|
||||
const { decoded, user, session, tokenVersion } = (req.tokenData = await checkToken(req.headers.authorization, {
|
||||
const { decoded, user, session } = (req.tokenData = await checkToken(req.headers.authorization, {
|
||||
ipAddress: req.ip,
|
||||
fingerprint: req.fingerprint,
|
||||
}));
|
||||
|
||||
@@ -50,12 +50,14 @@ router.get(
|
||||
limit = undefined;
|
||||
}
|
||||
|
||||
return await ThreadMember.find({
|
||||
where: { channel: { id: channel_id }, ...(after ? { user_id: MoreThan(after) } : {}) },
|
||||
take: limit ? parseInt(limit) : 50,
|
||||
order: { member_idx: "ASC" },
|
||||
relations: { ...(with_member ? { member: true } : {}) },
|
||||
});
|
||||
return res.send(
|
||||
await ThreadMember.find({
|
||||
where: { channel: { id: channel_id }, ...(after ? { user_id: MoreThan(after) } : {}) },
|
||||
take: limit ? parseInt(limit) : 50,
|
||||
order: { member_idx: "ASC" },
|
||||
relations: { ...(with_member ? { member: true } : {}) },
|
||||
}),
|
||||
);
|
||||
},
|
||||
);
|
||||
router.post(
|
||||
|
||||
@@ -217,6 +217,7 @@ router.get(
|
||||
},
|
||||
}),
|
||||
async (req: Request, res: Response) => {
|
||||
// noinspection JSUnusedLocalSymbols - ???
|
||||
const { name, slop, tag, tag_setting, archived, sort_by, sort_order, limit, offset, max_id, min_id } = req.query as Record<string, string | undefined>;
|
||||
const tags = tag ? tag.split(",") : [];
|
||||
const { channel_id } = req.params as Record<string, string>;
|
||||
|
||||
@@ -59,6 +59,7 @@ router.post(
|
||||
},
|
||||
);
|
||||
|
||||
// noinspection JSUnusedLocalSymbols - TODO: implement
|
||||
router.post(
|
||||
"/verify-code",
|
||||
route({
|
||||
|
||||
@@ -66,6 +66,7 @@ for (const type of Object.values(ReportMenuTypeNames)) {
|
||||
},
|
||||
);
|
||||
if (process.env.LOG_ROUTES !== "false") console.log(`[Server] Route /reporting/menu/${type} registered (reports).`);
|
||||
// noinspection JSUnusedLocalSymbols - TODO: implement
|
||||
router.post(
|
||||
`/${type}`,
|
||||
route({
|
||||
|
||||
@@ -149,6 +149,7 @@ router.patch(
|
||||
},
|
||||
}),
|
||||
async (req: Request, res: Response) => {
|
||||
// noinspection JSUnusedLocalSymbols - TODO: shouldnt token be checked?
|
||||
const { webhook_id, token } = req.params as { [key: string]: string };
|
||||
const body = req.body as WebhookUpdateSchema;
|
||||
|
||||
|
||||
@@ -228,6 +228,7 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> {
|
||||
}
|
||||
} else {
|
||||
permission ||= await getPermission(opts.author_id, channel.guild_id, channel);
|
||||
if (permission === null) throw new HTTPError("permission was null after getPermission", 500);
|
||||
permission.hasThrow("SEND_MESSAGES");
|
||||
if (permission.cache.member) {
|
||||
message.member = permission.cache.member;
|
||||
@@ -238,7 +239,7 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> {
|
||||
permission.hasThrow("READ_MESSAGE_HISTORY");
|
||||
// code below has to be redone when we add custom message routing
|
||||
if (message.guild_id !== null) {
|
||||
const guild = await Guild.findOneOrFail({
|
||||
await Guild.findOneOrFail({
|
||||
where: { id: channel.guild_id },
|
||||
});
|
||||
if (!opts.message_reference.guild_id) opts.message_reference.guild_id = channel.guild_id;
|
||||
|
||||
@@ -28,4 +28,4 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
main().then((r) => console.log("meow"));
|
||||
main().then(() => console.log("meow"));
|
||||
|
||||
@@ -38,9 +38,9 @@ export class Server {
|
||||
|
||||
if (server) this.server = server;
|
||||
else {
|
||||
const elu = [1, 5, 15].map((x) => performance.eventLoopUtilization());
|
||||
const eluP = [1, 5, 15].map((x) => performance.eventLoopUtilization());
|
||||
const cpu = [1, 5, 15].map((x) => process.cpuUsage());
|
||||
const elu = [1, 5, 15].map(() => performance.eventLoopUtilization());
|
||||
const eluP = [1, 5, 15].map(() => performance.eventLoopUtilization());
|
||||
const cpu = [1, 5, 15].map(() => process.cpuUsage());
|
||||
let sec = 0;
|
||||
setInterval(() => {
|
||||
sec += 1;
|
||||
|
||||
@@ -64,11 +64,6 @@ import { ChannelType, DefaultUserGuildSettings, DMChannel, IdentifySchema, Priva
|
||||
// TODO: user sharding
|
||||
// TODO: check privileged intents, if defined in the config
|
||||
|
||||
function logAuth(message: string) {
|
||||
if (process.env.LOG_AUTH != "true") return;
|
||||
console.log(`[Gateway/Auth] ${message}`);
|
||||
}
|
||||
|
||||
export async function onIdentify(this: WebSocket, data: Payload) {
|
||||
const totalSw = Stopwatch.startNew();
|
||||
const taskSw = Stopwatch.startNew();
|
||||
|
||||
@@ -158,6 +158,7 @@ export async function onLazyRequest(this: WebSocket, { d }: Payload) {
|
||||
const startTime = Date.now();
|
||||
// TODO: check data
|
||||
check.call(this, LazyRequestSchema, d);
|
||||
// noinspection JSUnusedLocalSymbols - TODO: implement typing/activities subscriptions
|
||||
const { guild_id, typing, channels, activities, members } = d as LazyRequestSchema;
|
||||
|
||||
if (members) {
|
||||
|
||||
@@ -21,6 +21,7 @@ export async function onStreamDelete(this: WebSocket, data: Payload) {
|
||||
return this.close(4000, "Invalid stream key");
|
||||
}
|
||||
|
||||
// noinspection JSUnusedLocalSymbols - TODO: what is type here?
|
||||
const { userId, channelId, guildId, type } = parsedKey;
|
||||
|
||||
// when a user selects to stop watching another user stream, this event gets triggered
|
||||
|
||||
@@ -58,7 +58,7 @@ export async function cleanupOnStartup(): Promise<void> {
|
||||
|
||||
console.log("[Gateway] Starting async voice state wipe...");
|
||||
VoiceState.clear()
|
||||
.then((e) => console.log("[Gateway] Successfully cleaned voice states"))
|
||||
.then(() => console.log("[Gateway] Successfully cleaned voice states"))
|
||||
.catch((e) => console.error("[Gateway] Error cleaning voice states on startup:", e));
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ export class UrlSignResult {
|
||||
}
|
||||
|
||||
export const getUrlSignature = (data: NewUrlSignatureData): UrlSignResult => {
|
||||
const { cdnSignatureKey, cdnSignatureDuration } = Config.get().security;
|
||||
const { cdnSignatureDuration } = Config.get().security;
|
||||
|
||||
// calculate the expiration time
|
||||
const now = Date.now();
|
||||
|
||||
@@ -99,7 +99,7 @@ export class UserSettingsProtos extends BaseClassWithoutId {
|
||||
}
|
||||
|
||||
static async getOrDefault(user_id: string, save: boolean = false): Promise<UserSettingsProtos> {
|
||||
const user = await User.findOneOrFail({
|
||||
await User.findOneOrFail({
|
||||
where: { id: user_id },
|
||||
select: { settings: true },
|
||||
});
|
||||
|
||||
@@ -719,7 +719,7 @@ export class initial0 implements MigrationInterface {
|
||||
await queryRunner.query(`ALTER TABLE ONLY public.team_members ADD CONSTRAINT "FK_fdad7d5768277e60c40e01cdcea" FOREIGN KEY (team_id) REFERENCES public.teams(id) ON DELETE CASCADE;`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
public async down(_: QueryRunner): Promise<void> {
|
||||
throw new Error("Can't revert this: just throw away your database lol");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,5 +6,5 @@ export class DeleteBotUsersWithoutAnApplication1761113394664 implements Migratio
|
||||
await queryRunner.query(`DELETE FROM users WHERE bot = true AND id NOT IN (SELECT bot_user_id FROM applications);`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {}
|
||||
public async down(_: QueryRunner): Promise<void> {}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,8 @@ if (!isHeadlessProcess) {
|
||||
);
|
||||
console.log(`[Database] ${red(`If you would like to try *anyways*, see the error below:`)}`);
|
||||
try {
|
||||
const _ = require("sqlite3");
|
||||
// TODO: fully remove sqlite3
|
||||
require("sqlite3");
|
||||
} catch (e) {
|
||||
console.log(`[Database] ${red(`Failed to load sqlite3 package. Please install it with 'npm install --no-save sqlite3', or switch to a real database like Postgres.`)}`);
|
||||
process.exit(1);
|
||||
|
||||
@@ -33,6 +33,8 @@ export class BaseEmailClient implements IEmailClient {
|
||||
return;
|
||||
}
|
||||
sendMail(email: IEmail): Promise<void> {
|
||||
// noinspection JSUnusedLocalSymbols - parameter exists for public API reasons
|
||||
const _ = email;
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ function getNextWorker(): Worker {
|
||||
return worker;
|
||||
}
|
||||
|
||||
// noinspection JSUnusedLocalSymbols - TODO: implement options
|
||||
export class JsonSerializer {
|
||||
public static Serialize<T>(value: T, opts?: JsonSerializerOptions): string {
|
||||
return JSON.stringify(value);
|
||||
|
||||
@@ -21,13 +21,6 @@ import { Tuple } from "lambert-server";
|
||||
import OPCodeHandlers from "../opcodes";
|
||||
import { VoiceOPCodes, VoicePayload, WebRtcWebSocket } from "../util";
|
||||
|
||||
const PayloadSchema = {
|
||||
op: Number,
|
||||
$d: new Tuple(Object, Number), // or number for heartbeat sequence
|
||||
$s: Number,
|
||||
$t: String,
|
||||
};
|
||||
|
||||
export async function onMessage(this: WebRtcWebSocket, buffer: Buffer) {
|
||||
try {
|
||||
const data: VoicePayload = JSON.parse(buffer.toString());
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { VoiceOPCodes, VoicePayload, WebRtcWebSocket, Send } from "../util";
|
||||
|
||||
export async function onBackendVersion(this: WebRtcWebSocket, data: VoicePayload) {
|
||||
export async function onBackendVersion(this: WebRtcWebSocket, _: VoicePayload) {
|
||||
await Send(this, {
|
||||
op: VoiceOPCodes.VOICE_BACKEND_VERSION,
|
||||
d: { voice: "0.8.43", rtc_worker: "0.3.26" },
|
||||
|
||||
@@ -25,6 +25,7 @@ import { subscribeToProducers } from "./Video";
|
||||
|
||||
export async function onIdentify(this: WebRtcWebSocket, data: VoicePayload) {
|
||||
clearTimeout(this.readyTimeout);
|
||||
// noinspection JSUnusedLocalSymbols - TODO: use video?
|
||||
const { server_id, user_id, session_id, token, streams, video } = validateSchema("VoiceIdentifySchema", data.d) as VoiceIdentifySchema;
|
||||
|
||||
// server_id can be one of the following: a unique id for a GO Live stream, a channel id for a DM voice call, or a guild id for a guild voice channel
|
||||
|
||||
@@ -53,7 +53,7 @@ export async function onVideo(this: WebRtcWebSocket, payload: VoicePayload) {
|
||||
if (wantsToProduceAudio) {
|
||||
try {
|
||||
await Promise.race([
|
||||
new Promise<void>((resolve, reject) => {
|
||||
new Promise<void>((resolve, _) => {
|
||||
this.webRtcClient?.emitter.once("connected", () => resolve());
|
||||
}),
|
||||
new Promise<void>((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user