From 51ee02201ab6faae66652e9435ce0fc6590005c8 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 19 Oct 2023 04:58:29 +0300 Subject: [PATCH] add magnet urn link #25 --- src/Controller/TorrentController.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Controller/TorrentController.php b/src/Controller/TorrentController.php index be9fd4d..f30c438 100644 --- a/src/Controller/TorrentController.php +++ b/src/Controller/TorrentController.php @@ -631,6 +631,11 @@ public function jsonRecent( $locales = $request->get('locales') ? explode('|', $request->get('locales')) : explode('|', $this->getParameter('app.locales')); $sensitive = $request->get('sensitive') ? (bool) $request->get('sensitive') : null; + $yggdrasil = $request->get('yggdrasil') ? (bool) $request->get('yggdrasil') : false; + + // Init trackers + $trackers = explode('|', $this->getParameter('app.trackers')); + // Get total torrents $total = $torrentService->findTorrentsTotal( $query, @@ -698,7 +703,16 @@ public function jsonRecent( 'torrentId' => $torrent->getId() ], false - ) + ), + 'urn' => $yggdrasil ? $file->setAnnounceList([$trackers])->getMagnetLink() + : $file->setAnnounceList( + array_unique( + array_merge( + $file->getAnnounceList(), + [$trackers] + ) + ) + )->getMagnetLink() ], 'scrape' => [