mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-19 21:03:54 -07:00
Use \Arokettu\Bencode\ instead \SandFox\Bencode\ (#932)
This commit is contained in:
parent
cb4516f869
commit
c6fe4241e3
5 changed files with 14 additions and 14 deletions
|
@ -412,6 +412,6 @@ if (!$output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return data to client
|
// Return data to client
|
||||||
echo \SandFox\Bencode\Bencode::encode($output);
|
echo \Arokettu\Bencode\Bencode::encode($output);
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -23,14 +23,14 @@ if ($bb_cfg['tracker']['bt_off']) {
|
||||||
//
|
//
|
||||||
function silent_exit($msg = '')
|
function silent_exit($msg = '')
|
||||||
{
|
{
|
||||||
echo \SandFox\Bencode\Bencode::encode(['warning message' => str_compact($msg)]);
|
echo \Arokettu\Bencode\Bencode::encode(['warning message' => str_compact($msg)]);
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
function error_exit($msg = '')
|
function error_exit($msg = '')
|
||||||
{
|
{
|
||||||
echo \SandFox\Bencode\Bencode::encode(['failure reason' => str_compact($msg)]);
|
echo \Arokettu\Bencode\Bencode::encode(['failure reason' => str_compact($msg)]);
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ function drop_fast_announce($lp_info, $lp_cached_peers = [])
|
||||||
|
|
||||||
function msg_die($msg)
|
function msg_die($msg)
|
||||||
{
|
{
|
||||||
$output = \SandFox\Bencode\Bencode::encode([
|
$output = \Arokettu\Bencode\Bencode::encode([
|
||||||
'min interval' => (int)1800,
|
'min interval' => (int)1800,
|
||||||
'failure reason' => (string)$msg,
|
'failure reason' => (string)$msg,
|
||||||
]);
|
]);
|
||||||
|
@ -74,7 +74,7 @@ function dummy_exit($interval = 1800, $cache_dict = [])
|
||||||
$output['peers'] = $cache_dict['peers'];
|
$output['peers'] = $cache_dict['peers'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = \SandFox\Bencode\Bencode::encode($output);
|
$output = \Arokettu\Bencode\Bencode::encode($output);
|
||||||
|
|
||||||
die($output);
|
die($output);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ if (strlen($info_hash) == 32) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($lp_scrape_info = CACHE('tr_cache')->get(SCRAPE_LIST_PREFIX . $info_hash_hex)) {
|
if ($lp_scrape_info = CACHE('tr_cache')->get(SCRAPE_LIST_PREFIX . $info_hash_hex)) {
|
||||||
die(\SandFox\Bencode\Bencode::encode($lp_scrape_info));
|
die(\Arokettu\Bencode\Bencode::encode($lp_scrape_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
$info_hash_sql = rtrim(DB()->escape($info_hash), ' ');
|
$info_hash_sql = rtrim(DB()->escape($info_hash), ' ');
|
||||||
|
@ -73,6 +73,6 @@ $output['files'][$info_hash] = [
|
||||||
|
|
||||||
$peers_list_cached = CACHE('tr_cache')->set(SCRAPE_LIST_PREFIX . $info_hash_hex, $output, SCRAPE_LIST_EXPIRE);
|
$peers_list_cached = CACHE('tr_cache')->set(SCRAPE_LIST_PREFIX . $info_hash_hex, $output, SCRAPE_LIST_EXPIRE);
|
||||||
|
|
||||||
echo \SandFox\Bencode\Bencode::encode($output);
|
echo \Arokettu\Bencode\Bencode::encode($output);
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -32,7 +32,7 @@ if (!file_exists($filename) || !$file_contents = file_get_contents($filename)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$tor = \SandFox\Bencode\Bencode::decode($file_contents)) {
|
if (!$tor = \Arokettu\Bencode\Bencode::decode($file_contents)) {
|
||||||
return $lang['TORFILE_INVALID'];
|
return $lang['TORFILE_INVALID'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -319,14 +319,14 @@ class Torrent
|
||||||
if (!file_exists($filename)) {
|
if (!file_exists($filename)) {
|
||||||
return self::torrent_error_exit('File not exists');
|
return self::torrent_error_exit('File not exists');
|
||||||
}
|
}
|
||||||
if (!$tor = \SandFox\Bencode\Bencode::decode($file_contents)) {
|
if (!$tor = \Arokettu\Bencode\Bencode::decode($file_contents)) {
|
||||||
return self::torrent_error_exit('This is not a bencoded file');
|
return self::torrent_error_exit('This is not a bencoded file');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bb_cfg['bt_disable_dht']) {
|
if ($bb_cfg['bt_disable_dht']) {
|
||||||
$tor['info']['private'] = (int)1;
|
$tor['info']['private'] = (int)1;
|
||||||
$fp = fopen($filename, 'wb+');
|
$fp = fopen($filename, 'wb+');
|
||||||
fwrite($fp, \SandFox\Bencode\Bencode::encode($tor));
|
fwrite($fp, \Arokettu\Bencode\Bencode::encode($tor));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,14 +362,14 @@ class Torrent
|
||||||
|
|
||||||
// Getting info_hash v1
|
// Getting info_hash v1
|
||||||
if ($bt_v1) {
|
if ($bt_v1) {
|
||||||
$info_hash = pack('H*', hash('sha1', \SandFox\Bencode\Bencode::encode($info)));
|
$info_hash = pack('H*', hash('sha1', \Arokettu\Bencode\Bencode::encode($info)));
|
||||||
$info_hash_sql = rtrim(DB()->escape($info_hash), ' ');
|
$info_hash_sql = rtrim(DB()->escape($info_hash), ' ');
|
||||||
$info_hash_where = "WHERE info_hash = '$info_hash_sql'";
|
$info_hash_where = "WHERE info_hash = '$info_hash_sql'";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getting info_hash v2
|
// Getting info_hash v2
|
||||||
if ($bt_v2) {
|
if ($bt_v2) {
|
||||||
$v2_hash = hash('sha256', \SandFox\Bencode\Bencode::encode($info));
|
$v2_hash = hash('sha256', \Arokettu\Bencode\Bencode::encode($info));
|
||||||
$info_hash_v2 = pack('H*', $v2_hash);
|
$info_hash_v2 = pack('H*', $v2_hash);
|
||||||
$info_hash_v2_sql = rtrim(DB()->escape($info_hash_v2), ' ');
|
$info_hash_v2_sql = rtrim(DB()->escape($info_hash_v2), ' ');
|
||||||
$info_hash_where = "WHERE info_hash_v2 = '$info_hash_v2_sql'";
|
$info_hash_where = "WHERE info_hash_v2 = '$info_hash_v2_sql'";
|
||||||
|
@ -541,7 +541,7 @@ class Torrent
|
||||||
$ann_url = $bb_cfg['bt_announce_url'];
|
$ann_url = $bb_cfg['bt_announce_url'];
|
||||||
|
|
||||||
$file_contents = file_get_contents($filename);
|
$file_contents = file_get_contents($filename);
|
||||||
if (!$tor = \SandFox\Bencode\Bencode::decode($file_contents)) {
|
if (!$tor = \Arokettu\Bencode\Bencode::decode($file_contents)) {
|
||||||
bb_die('This is not a bencoded file');
|
bb_die('This is not a bencoded file');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,7 +584,7 @@ class Torrent
|
||||||
unset($tor['comment.utf-8']);
|
unset($tor['comment.utf-8']);
|
||||||
|
|
||||||
// Send torrent
|
// Send torrent
|
||||||
$output = \SandFox\Bencode\Bencode::encode($tor);
|
$output = \Arokettu\Bencode\Bencode::encode($tor);
|
||||||
$dl_fname = '[' . $bb_cfg['server_name'] . '].t' . $topic_id . '.torrent';
|
$dl_fname = '[' . $bb_cfg['server_name'] . '].t' . $topic_id . '.torrent';
|
||||||
|
|
||||||
if (!empty($_COOKIE['explain'])) {
|
if (!empty($_COOKIE['explain'])) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue