Use \Arokettu\Bencode\ instead \SandFox\Bencode\ (#932)

This commit is contained in:
Roman Kelesidis 2023-10-02 20:32:56 +07:00 committed by GitHub
commit c6fe4241e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 14 deletions

View file

@ -412,6 +412,6 @@ if (!$output) {
}
// Return data to client
echo \SandFox\Bencode\Bencode::encode($output);
echo \Arokettu\Bencode\Bencode::encode($output);
exit;

View file

@ -23,14 +23,14 @@ if ($bb_cfg['tracker']['bt_off']) {
//
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;
}
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;
}
@ -50,7 +50,7 @@ function drop_fast_announce($lp_info, $lp_cached_peers = [])
function msg_die($msg)
{
$output = \SandFox\Bencode\Bencode::encode([
$output = \Arokettu\Bencode\Bencode::encode([
'min interval' => (int)1800,
'failure reason' => (string)$msg,
]);
@ -74,7 +74,7 @@ function dummy_exit($interval = 1800, $cache_dict = [])
$output['peers'] = $cache_dict['peers'];
}
$output = \SandFox\Bencode\Bencode::encode($output);
$output = \Arokettu\Bencode\Bencode::encode($output);
die($output);
}

View file

@ -43,7 +43,7 @@ if (strlen($info_hash) == 32) {
}
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), ' ');
@ -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);
echo \SandFox\Bencode\Bencode::encode($output);
echo \Arokettu\Bencode\Bencode::encode($output);
exit;

View file

@ -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'];
}

View file

@ -319,14 +319,14 @@ class Torrent
if (!file_exists($filename)) {
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');
}
if ($bb_cfg['bt_disable_dht']) {
$tor['info']['private'] = (int)1;
$fp = fopen($filename, 'wb+');
fwrite($fp, \SandFox\Bencode\Bencode::encode($tor));
fwrite($fp, \Arokettu\Bencode\Bencode::encode($tor));
fclose($fp);
}
@ -362,14 +362,14 @@ class Torrent
// Getting info_hash 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_where = "WHERE info_hash = '$info_hash_sql'";
}
// Getting info_hash 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_sql = rtrim(DB()->escape($info_hash_v2), ' ');
$info_hash_where = "WHERE info_hash_v2 = '$info_hash_v2_sql'";
@ -541,7 +541,7 @@ class Torrent
$ann_url = $bb_cfg['bt_announce_url'];
$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');
}
@ -584,7 +584,7 @@ class Torrent
unset($tor['comment.utf-8']);
// Send torrent
$output = \SandFox\Bencode\Bencode::encode($tor);
$output = \Arokettu\Bencode\Bencode::encode($tor);
$dl_fname = '[' . $bb_cfg['server_name'] . '].t' . $topic_id . '.torrent';
if (!empty($_COOKIE['explain'])) {