Skip to content

Commit

Permalink
add magnet urn link #25
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost committed Oct 19, 2023
1 parent 31bed20 commit 51ee022
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Controller/TorrentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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' =>
[
Expand Down

0 comments on commit 51ee022

Please # to comment.