Browse Source

disable activity log by crawler requests #24

main
ghost 1 year ago
parent
commit
4a801fa809
  1. 2
      .env
  2. 1
      config/services.yaml
  3. 18
      src/Controller/TorrentController.php

2
.env

@ -64,4 +64,6 @@ APP_YGGDRASIL=1
APP_TRACKERS=http://[201:23b4:991a:634d:8359:4521:5576:15b7]:2023/announce|http://[200:1e2f:e608:eb3a:2bf:1e62:87ba:e2f7]/announce|http://[316:c51a:62a3:8b9::5]/announce APP_TRACKERS=http://[201:23b4:991a:634d:8359:4521:5576:15b7]:2023/announce|http://[200:1e2f:e608:eb3a:2bf:1e62:87ba:e2f7]/announce|http://[316:c51a:62a3:8b9::5]/announce
APP_CRAWLERS=30a:5fad::e
APP_TORRENT_FILE_SIZE_MAX=1024000 APP_TORRENT_FILE_SIZE_MAX=1024000

1
config/services.yaml

@ -9,6 +9,7 @@ parameters:
app.key: '%env(APP_KEY)%' app.key: '%env(APP_KEY)%'
app.pagination: '%env(APP_PAGINATION)%' app.pagination: '%env(APP_PAGINATION)%'
app.trackers: '%env(APP_TRACKERS)%' app.trackers: '%env(APP_TRACKERS)%'
app.crawlers: '%env(APP_CRAWLERS)%'
app.locales: '%env(APP_LOCALES)%' app.locales: '%env(APP_LOCALES)%'
app.themes: '%env(APP_THEMES)%' app.themes: '%env(APP_THEMES)%'
app.locale: '%env(APP_LOCALE)%' app.locale: '%env(APP_LOCALE)%'

18
src/Controller/TorrentController.php

@ -1564,6 +1564,12 @@ class TorrentController extends AbstractController
); );
} }
// Block crawler requests
if (in_array($request->getClientIp(), explode('|', $this->getParameter('app.crawlers'))))
{
throw $this->createNotFoundException();
}
// Init torrent // Init torrent
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) if (!$torrent = $torrentService->getTorrent($request->get('torrentId')))
{ {
@ -1643,6 +1649,12 @@ class TorrentController extends AbstractController
); );
} }
// Block crawler requests
if (in_array($request->getClientIp(), explode('|', $this->getParameter('app.crawlers'))))
{
throw $this->createNotFoundException();
}
// Init torrent // Init torrent
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) if (!$torrent = $torrentService->getTorrent($request->get('torrentId')))
{ {
@ -1764,6 +1776,12 @@ class TorrentController extends AbstractController
); );
} }
// Block crawler requests
if (in_array($request->getClientIp(), explode('|', $this->getParameter('app.crawlers'))))
{
throw $this->createNotFoundException();
}
// Init torrent // Init torrent
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) if (!$torrent = $torrentService->getTorrent($request->get('torrentId')))
{ {

Loading…
Cancel
Save