Tracker announce & scrape improvements 🥳 (#901)

* Tracker announce & scrape improvements

* Fixed null variables

Co-Authored-By: Constantine Kovalensky <45331093+kovalensky@users.noreply.github.com>

* Hybrid topics handling in announcer

* Updated

* Use correct data types

* Revert "Use correct data types"

This reverts commit bc9f0e4d6f.

* Update announce.php

* Showing downloaded times in stats

* Updated

* Updated

* Debugging variables

* Update scrape.php

* Updated

* Update announce.php

* Update announce.php

* Code re-formatting

* Code re-formatting

* Updated

* Update config.php

* Update tr_make_snapshot.php

* Update tr_complete_count.php

* Stopped event should be handled before cache check

* Include torrent download name in magnet link

* Magnet name re-formatting

* Smart cache management

---------

Co-authored-by: Constantine Kovalensky <45331093+kovalensky@users.noreply.github.com>
This commit is contained in:
Roman Kelesidis 2023-09-14 08:38:07 +07:00 committed by GitHub
commit c654a9ae36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 125 additions and 86 deletions

View file

@ -37,7 +37,7 @@ function error_exit($msg = '')
exit;
}
function drop_fast_announce($lp_info)
function drop_fast_announce($lp_info, $lp_cached_peers = [])
{
global $announce_interval;
@ -47,7 +47,7 @@ function drop_fast_announce($lp_info)
$new_ann_intrv = $lp_info['update_time'] + $announce_interval - TIMENOW;
dummy_exit($new_ann_intrv);
dummy_exit($new_ann_intrv, $lp_cached_peers);
}
function msg_die($msg)
@ -55,19 +55,28 @@ function msg_die($msg)
$output = \SandFox\Bencode\Bencode::encode([
'min interval' => (int)1800,
'failure reason' => (string)$msg,
'warning message' => (string)$msg,
]);
die($output);
}
function dummy_exit($interval = 1800)
function dummy_exit($interval = 1800, $cache_dict = [])
{
$output = \SandFox\Bencode\Bencode::encode([
$output = [
'interval' => (int)$interval,
'min interval' => (int)$interval,
'peers' => (string)DUMMY_PEER,
]);
];
if (!empty($cache_dict)) {
$output['complete'] = $cache_dict['complete'];
$output['incomplete'] = $cache_dict['incomplete'];
$output['downloaded'] = $cache_dict['downloaded'];
$output['warning message'] = 'Next statistics update in: ' . (floor($interval / 60) % 60) . ' minutes';
$output['peers'] = $cache_dict['peers'];
}
$output = \SandFox\Bencode\Bencode::encode($output);
die($output);
}