Browse Source

require app key on crontab/tool http requests

main
ghost 1 year ago
parent
commit
07262f4486
  1. 1
      .env
  2. 2
      README.md
  3. 1
      config/services.yaml
  4. 12
      src/Controller/TorrentController.php

1
.env

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=EDITME
APP_KEY=EDITME
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###

2
README.md

@ -50,7 +50,7 @@ php bin/console doctrine:migrations:migrate @@ -50,7 +50,7 @@ php bin/console doctrine:migrations:migrate
##### Crontab
* `* * * * * /crontab/torrent/scrape` - update seeding stats
* `* * * * * /crontab/torrent/scrape/{%app.key%}` - update seeding stats
##### App settings

1
config/services.yaml

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
parameters:
app.version: '%env(APP_VERSION)%'
app.name: '%env(APP_NAME)%'
app.key: '%env(APP_KEY)%'
app.pagination: '%env(APP_PAGINATION)%'
app.trackers: '%env(APP_TRACKERS)%'
app.locales: '%env(APP_LOCALES)%'

12
src/Controller/TorrentController.php

@ -322,7 +322,7 @@ class TorrentController extends AbstractController @@ -322,7 +322,7 @@ class TorrentController extends AbstractController
}
return $this->render('default/torrent/list.html.twig', [
'query' => urldecode($request->get('query')),
'query' => $request->get('query') ? urldecode($request->get('query')) : '',
'torrents' => $torrents,
'pagination' =>
[
@ -1752,7 +1752,10 @@ class TorrentController extends AbstractController @@ -1752,7 +1752,10 @@ class TorrentController extends AbstractController
// Tools
#[Route(
'/crontab/torrent/scrape',
'/crontab/torrent/scrape/{key}',
requirements: [
'key' => '%app.key%'
],
methods:
[
'GET'
@ -1773,7 +1776,10 @@ class TorrentController extends AbstractController @@ -1773,7 +1776,10 @@ class TorrentController extends AbstractController
}
#[Route(
'/tool/torrent/reindex',
'/tool/torrent/reindex/{key}',
requirements: [
'key' => '%app.key%'
],
methods:
[
'GET'

Loading…
Cancel
Save