mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-01-24 21:09:54 -06:00
update: announce controller
- This stops announce from sending peers to the users client that are from the same user. - This does not stop a user from manually adding their other peer to the client to seed to themselves.
This commit is contained in:
@@ -106,7 +106,7 @@ class AnnounceController extends Controller
|
||||
/**
|
||||
* Generate A Response For The Torrent Clent.
|
||||
*/
|
||||
$rep_dict = $this->generateSuccessAnnounceResponse($queries, $torrent);
|
||||
$rep_dict = $this->generateSuccessAnnounceResponse($queries, $torrent, $user);
|
||||
} catch (TrackerException $exception) {
|
||||
$rep_dict = $this->generateFailedAnnounceResponse($exception);
|
||||
} finally {
|
||||
@@ -414,10 +414,11 @@ class AnnounceController extends Controller
|
||||
/**
|
||||
* @param $queries
|
||||
* @param $torrent
|
||||
* @param $user
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function generateSuccessAnnounceResponse($queries, $torrent)
|
||||
private function generateSuccessAnnounceResponse($queries, $torrent, $user)
|
||||
{
|
||||
// Build Response For Bittorrent Client
|
||||
$rep_dict = [
|
||||
@@ -435,7 +436,7 @@ class AnnounceController extends Controller
|
||||
$limit = (int) ($queries['numwant'] <= 50 ? $queries['numwant'] : 50);
|
||||
|
||||
// Get Torrents Peers
|
||||
$peers = Peer::where('torrent_id', '=', $torrent->id)->take($limit)->get()->toArray();
|
||||
$peers = Peer::where('torrent_id', '=', $torrent->id)->where('user_id', '!=', $user->id)->take($limit)->get()->toArray();
|
||||
|
||||
$rep_dict['peers'] = $this->givePeers($peers, $queries['compact'], $queries['no_peer_id'], FILTER_FLAG_IPV4);
|
||||
$rep_dict['peers6'] = $this->givePeers($peers, $queries['compact'], $queries['no_peer_id'], FILTER_FLAG_IPV6);
|
||||
|
||||
Reference in New Issue
Block a user