(Update) TorrentController

Fix the encoding routine to encode with rsskey authenticated user.

Tested in real clients rss feeds.
This commit is contained in:
singularity43
2019-01-13 02:09:50 -05:00
parent 58ceca25f6
commit 3830ce6dc4
+4 -2
View File
@@ -872,11 +872,13 @@ class TorrentController extends Controller
*/
public function download($slug, $id, $rsskey = null)
{
$user = auth()->user();
if (! $user && $rsskey) {
if (!$user && $rsskey) {
$user = User::where('rsskey', '=', $rsskey)->firstOrFail();
}
$torrent = Torrent::withAnyStatus()->findOrFail($id);
// User's ratio is too low
@@ -912,7 +914,7 @@ class TorrentController extends Controller
}
// Get the content of the torrent
$dict = Bencode::bdecode(file_get_contents(getcwd().'/files/torrents/'.$torrent->file_name));
if (auth()->check()) {
if (auth()->check() || ($rsskey && $user)) {
// Set the announce key and add the user passkey
$dict['announce'] = route('announce', ['passkey' => $user->passkey]);
// Remove Other announce url