this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow passing options into LabelerServer#start

futurGH 29794f54 2c8a1010

+24 -3
+24 -3
src/LabelerServer.ts
··· 6 6 ToolsOzoneModerationEmitEvent, 7 7 } from "@atcute/client/lexicons"; 8 8 import { fastifyWebsocket } from "@fastify/websocket"; 9 - import fastify, { type FastifyInstance, type FastifyRequest } from "fastify"; 9 + import fastify, { 10 + type FastifyInstance, 11 + type FastifyListenOptions, 12 + type FastifyRequest, 13 + } from "fastify"; 10 14 import Database, { type Database as SQLiteDatabase } from "libsql"; 11 15 import type { WebSocket } from "ws"; 12 16 import { parsePrivateKey, verifyJwt } from "./util/crypto.js"; ··· 123 127 * @param port The port to listen on. 124 128 * @param callback A callback to run when the server is started. 125 129 */ 126 - start(port: number, callback: (error: Error | null, address: string) => void = () => {}) { 127 - this.app.listen({ port }, callback); 130 + start(port: number, callback: (error: Error | null, address: string) => void): void; 131 + /** 132 + * Start the server. 133 + * @param options Options for the server. 134 + * @param callback A callback to run when the server is started. 135 + */ 136 + start( 137 + options: FastifyListenOptions, 138 + callback: (error: Error | null, address: string) => void, 139 + ): void; 140 + start( 141 + portOrOptions: number | FastifyListenOptions, 142 + callback: (error: Error | null, address: string) => void = () => {}, 143 + ) { 144 + if (typeof portOrOptions === "number") { 145 + this.app.listen({ port: portOrOptions }, callback); 146 + } else { 147 + this.app.listen(portOrOptions, callback); 148 + } 128 149 } 129 150 130 151 /**