Loading packages/server/src/api.ts +8 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,14 @@ app.get("/callback", async (req, res) => { }), }).then((a) => a.json()); if (!who.success) { res.json({ error: "AUTHENTICATION FAILED", error_message: who.error || "no error specified", }); return; } const [username, hostname] = who.user.sub.split("@"); await prisma.user.upsert({ Loading packages/server/src/lib/Canvas.ts +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ class Canvas { size: this.CANVAS_SIZE, zoom: 7, pixel: { cooldown: 60, cooldown: 10, multiplier: 3, maxStack: 6, }, Loading packages/server/src/lib/SocketServer.ts +11 −6 Original line number Diff line number Diff line Loading @@ -80,19 +80,22 @@ export class SocketServer { // - needs to be exponential (takes longer to aquire more pixels stacked) // - convert to config options instead of hard-coded setInterval(async () => { Logger.debug("Running pixel stacking..."); const DEBUG = false; if (DEBUG) Logger.debug("Running pixel stacking..."); const redis = await Redis.getClient(); const sockets = await this.io.local.fetchSockets(); for (const socket of sockets) { const sub = await redis.get(Redis.key("socketToSub", socket.id)); if (!sub) { Logger.warn(`Socket ${socket.id} has no user`); if (DEBUG) Logger.warn(`Socket ${socket.id} has no user`); continue; } const user = await User.fromSub(sub); if (!user) { if (DEBUG) Logger.warn( `Socket ${socket.id}'s user (${sub}) does not exist in the database` ); Loading @@ -116,6 +119,8 @@ export class SocketServer { user.pixelStack < getClientConfig().canvas.pixel.maxStack ) { await user.modifyStack(1); if (DEBUG) Logger.debug(sub + " has gained another pixel in their stack"); } } Loading Loading
packages/server/src/api.ts +8 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,14 @@ app.get("/callback", async (req, res) => { }), }).then((a) => a.json()); if (!who.success) { res.json({ error: "AUTHENTICATION FAILED", error_message: who.error || "no error specified", }); return; } const [username, hostname] = who.user.sub.split("@"); await prisma.user.upsert({ Loading
packages/server/src/lib/Canvas.ts +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ class Canvas { size: this.CANVAS_SIZE, zoom: 7, pixel: { cooldown: 60, cooldown: 10, multiplier: 3, maxStack: 6, }, Loading
packages/server/src/lib/SocketServer.ts +11 −6 Original line number Diff line number Diff line Loading @@ -80,19 +80,22 @@ export class SocketServer { // - needs to be exponential (takes longer to aquire more pixels stacked) // - convert to config options instead of hard-coded setInterval(async () => { Logger.debug("Running pixel stacking..."); const DEBUG = false; if (DEBUG) Logger.debug("Running pixel stacking..."); const redis = await Redis.getClient(); const sockets = await this.io.local.fetchSockets(); for (const socket of sockets) { const sub = await redis.get(Redis.key("socketToSub", socket.id)); if (!sub) { Logger.warn(`Socket ${socket.id} has no user`); if (DEBUG) Logger.warn(`Socket ${socket.id} has no user`); continue; } const user = await User.fromSub(sub); if (!user) { if (DEBUG) Logger.warn( `Socket ${socket.id}'s user (${sub}) does not exist in the database` ); Loading @@ -116,6 +119,8 @@ export class SocketServer { user.pixelStack < getClientConfig().canvas.pixel.maxStack ) { await user.modifyStack(1); if (DEBUG) Logger.debug(sub + " has gained another pixel in their stack"); } } Loading