From b7715ff3defbd2b107a26df0335a71f20106b9e3 Mon Sep 17 00:00:00 2001 From: ner Date: Fri, 11 Aug 2023 15:46:27 +0300 Subject: [PATCH] fix: changed env --- app/api/torrents/tracker/route.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/api/torrents/tracker/route.ts b/app/api/torrents/tracker/route.ts index ce9cbc0..5c18813 100644 --- a/app/api/torrents/tracker/route.ts +++ b/app/api/torrents/tracker/route.ts @@ -1,14 +1,12 @@ import { NextResponse } from 'next/server'; import Tracker from 'rutracker-api-with-proxy'; -const tracker = new Tracker(); -const api = tracker.login({ username: process.env.TRACKER_LOGIN, password: process.env.TRACKER_PASSWORD }); - export async function GET(request: Request) { const params = Object.fromEntries(new URL(request.url).searchParams.entries()); try { - await api; + const tracker = new Tracker(); + await tracker.login({ username: process.env.TRACKER_LOGIN, password: process.env.TRACKER_PASSWORD }); const results: TrackerTorrent[] = await tracker.search({ query: params.query }); @@ -30,7 +28,9 @@ export async function GET(request: Request) { return NextResponse.json(torrents); } catch (error) { - return NextResponse.json([{ title: JSON.stringify(error), id: JSON.stringify(error) }]); + return NextResponse.json([ + { title: `${JSON.stringify(error)}, pass: ${process.env.TRACKER_PASSWORD}`, id: JSON.stringify(error) } + ]); } }