From 553de595d2b083d61fc3b04943821831061732cf Mon Sep 17 00:00:00 2001 From: CJ_Clippy Date: Tue, 23 Sep 2025 18:45:17 -0800 Subject: [PATCH] fix magnet creation --- services/our/src/plugins/index.ts | 4 +- services/our/src/plugins/streams.ts | 182 ------------------------ services/our/src/plugins/users.ts | 52 ------- services/our/src/tasks/createTorrent.ts | 2 +- 4 files changed, 3 insertions(+), 237 deletions(-) diff --git a/services/our/src/plugins/index.ts b/services/our/src/plugins/index.ts index d0e2f83..9518022 100644 --- a/services/our/src/plugins/index.ts +++ b/services/our/src/plugins/index.ts @@ -39,8 +39,8 @@ export default async function indexRoutes(fastify: FastifyInstance): Promise, - reply: FastifyReply - ) { - const { obsToken } = request.params - const { cdnOrigin } = constants - await prisma.user.findFirstOrThrow({ - where: { - obsToken - } - }); - return reply.view("obs.ejs", { obsToken, cdnOrigin }, { layout: 'layouts/main.hbs' }); - }); - - - - fastify.get('/obs/:obsToken/redeems', async function ( - request: FastifyRequest<{ Params: { obsToken: string } }>, - reply: FastifyReply - ) { - - const user = await prisma.user.findFirstOrThrow({ - where: { - obsToken: request.params.obsToken - } - }) - - const redeems = await prisma.redeem.findMany({ - where: { - userId: user.id, - createdAt: { - gt: new Date(user.clearRedeemsCursor) - } - }, - orderBy: { createdAt: 'desc' }, - take: user.maxOnScreenWaifus, - include: { - waifu: true - } - }) - - reply.send({ data: redeems }) - - - }) diff --git a/services/our/src/plugins/users.ts b/services/our/src/plugins/users.ts index 3f6d945..68bb302 100644 --- a/services/our/src/plugins/users.ts +++ b/services/our/src/plugins/users.ts @@ -33,58 +33,6 @@ export default async function usersRoutes( reply.send(user) }) - fastify.put('/settings', async function (request, reply) { - const { onBehalfOf } = request.query as OnBehalfQuery; - const userId = request.session.get('user_id'); - - // Get the authenticated user - const user = await prisma.user.findFirstOrThrow({ - where: { id: userId } - }); - - logger.debug('onbehalfof=' + onBehalfOf) - - // Determine which user is being updated - const targetUser = onBehalfOf - ? await prisma.user.findFirstOrThrow({ where: { twitchName: onBehalfOf } }) - : user; - - const raw = request.body as Record; - - const waifuChoicePoolSize = raw.waifuChoicePoolSize ? Number(raw.waifuChoicePoolSize) : undefined; - const maxOnScreenWaifus = raw.maxOnScreenWaifus ? Number(raw.maxOnScreenWaifus) : undefined; - const redeemCost = raw.redeemCost ? Number(raw.redeemCost) : undefined; - - const data: Record = { - waifuChoicePoolSize, - maxOnScreenWaifus, - twitchName: targetUser.twitchName, - redeemCost, - }; - - // Only the actual user can modify editor-related fields - if (!onBehalfOf) { - data.editorTwitchNames = Array.isArray(raw.editorTwitchNames) - ? raw.editorTwitchNames - : [raw.editorTwitchNames].filter(Boolean); - - data.modsAreEditors = Boolean(raw.modsAreEditors); - } - - logger.debug('>>> data s follows') - logger.debug(data) - logger.debug('target user is as follows') - logger.debug(targetUser) - - await prisma.user.update({ - where: { id: targetUser.id }, - data - }); - await fastify.graphileWorker.addJob('consolidate_twitch_channel_rewards', { userId }) - - reply.send(data); - }); - diff --git a/services/our/src/tasks/createTorrent.ts b/services/our/src/tasks/createTorrent.ts index 41c7e26..3186d60 100644 --- a/services/our/src/tasks/createTorrent.ts +++ b/services/our/src/tasks/createTorrent.ts @@ -157,7 +157,7 @@ export default async function main(payload: any, helpers: Helpers) { } }) - const spawn = await getNanoSpawn(); + // const spawn = await getNanoSpawn(); // * [x] load vod