diff --git a/bt/announce.php b/bt/announce.php index aa1ff825d..32510414f 100644 --- a/bt/announce.php +++ b/bt/announce.php @@ -168,8 +168,8 @@ if ($lp_info) { $tor_type = $lp_info['tor_type']; } else { /** - * Поскольку торрент-клиенты в настоящее время обрезают инфо-хэш до 20 символов (независимо от его типа, как известно v1 = 20 символов, а v2 = 32 символа), - * то результатов $is_bt_v2 (исходя из длины строки определяем тип инфо-хэша) проверки нам будет мало, именно поэтому происходит поиск v2 хэша, если торрент является v1 (по длине) и если в tor.info_hash столбце нету v1 хэша. + * Currently torrent clients send truncated v2 hashes (the design raises questions). + * https://github.com/bittorrent/bittorrent.org/issues/145#issuecomment-1720040343 */ $info_hash_sql = rtrim(DB()->escape($info_hash), ' '); $info_hash_where = $is_bt_v2 ? "WHERE tor.info_hash_v2 = '$info_hash_sql'" : "WHERE tor.info_hash = '$info_hash_sql' OR SUBSTRING(tor.info_hash_v2, 1, 20) = '$info_hash_sql'"; @@ -198,10 +198,10 @@ if ($lp_info) { $releaser = (int)($user_id == $row['poster_id']); $tor_type = $row['tor_type']; - // Check hybrid torrents + // Check hybrid status if (!empty($row['info_hash']) && !empty($row['info_hash_v2'])) { $is_hybrid = true; - if ($info_hash === $row['info_hash']) { + if ($info_hash === $row['info_hash']) { // Change this to substr($row['info_hash_v2'], 0, 20) in the future to update statistics, when v2 torrents will be default. $update_hybrid = true; } } diff --git a/bt/scrape.php b/bt/scrape.php index e010eff6c..30511cb88 100644 --- a/bt/scrape.php +++ b/bt/scrape.php @@ -58,6 +58,12 @@ if (!empty($info_hash_count)) { } $info_hashes_sql = implode('\', \'', $info_hashes); + + /** + * Currently torrent clients send truncated v2 hashes (the design raises questions). + * https://github.com/bittorrent/bittorrent.org/issues/145#issuecomment-1720040343 + */ + $info_hash_where = "tor.info_hash IN ('$info_hashes_sql') OR SUBSTRING(tor.info_hash_v2, 1, 20) IN ('$info_hashes_sql')"; $sql = " diff --git a/library/config.php b/library/config.php index 55fdd3b00..485814c41 100644 --- a/library/config.php +++ b/library/config.php @@ -26,7 +26,7 @@ $bb_cfg['tp_release_date'] = '14-11-2023'; $bb_cfg['tp_release_codename'] = 'Cattle'; // Database -// Настройка баз данных ['db']['srv_name'] => (array) srv_cfg; +// Settings for database ['db']['srv_name'] => (array) srv_cfg; $bb_cfg['db'] = [ 'db' => [ // Don't change the settings here!!! Go to .env file @@ -55,7 +55,7 @@ $bb_cfg['db_alias'] = [ // Cache $bb_cfg['cache'] = [ 'pconnect' => true, - 'db_dir' => realpath(BB_ROOT) . '/internal_data/cache/filecache/', + 'db_dir' => realpath(BB_ROOT) . '/internal_data/cache/redis/', 'prefix' => 'tp_', 'memcache' => [ 'host' => '127.0.0.1', @@ -66,7 +66,7 @@ $bb_cfg['cache'] = [ 'redis' => [ 'host' => '127.0.0.1', 'port' => 6379, - 'pconnect' => !PHP_ZTS, + 'pconnect' => !PHP_ZTS, // Redis pconnect supported only for non-thread safe compilations of PHP 'con_required' => true, ], // Available cache types: filecache, memcache, sqlite, redis, apcu (filecache by default) @@ -95,8 +95,8 @@ $bb_cfg['gzip_compress'] = false; // compress output // Tracker $bb_cfg['announce_interval'] = 1800; // Announce interval (default: 1800) -$bb_cfg['scrape_interval'] = 80; // Scrape interval (default: 100) -$bb_cfg['max_scrapes'] = 150; // Allowed number of info-hashes for simultaneous scraping (default: 150) +$bb_cfg['scrape_interval'] = 300; // Scrape interval (default: 300) +$bb_cfg['max_scrapes'] = 150; // Allowed number of info-hashes for simultaneous scraping, only not cached info-hashes will abide by these limits (default: 150) $bb_cfg['passkey_key'] = 'uk'; // Passkey key name in GET request $bb_cfg['ignore_reported_ip'] = false; // Ignore IP reported by client $bb_cfg['verify_reported_ip'] = true; // Verify IP reported by client against $_SERVER['HTTP_X_FORWARDED_FOR'] @@ -113,10 +113,10 @@ $bb_cfg['ocelot'] = [ ]; // FAQ url help link -$bb_cfg['how_to_download_url_help'] = 'viewtopic.php?t=1'; // Как скачивать? -$bb_cfg['what_is_torrent_url_help'] = 'viewtopic.php?t=2'; // Что такое торрент? -$bb_cfg['ratio_url_help'] = 'viewtopic.php?t=3'; // Рейтинг и ограничения -$bb_cfg['search_help_url'] = 'viewtopic.php?t=4'; // Помощь по поиску +$bb_cfg['how_to_download_url_help'] = 'viewtopic.php?t=1'; // How to download? +$bb_cfg['what_is_torrent_url_help'] = 'viewtopic.php?t=2'; // What is a torrent? +$bb_cfg['ratio_url_help'] = 'viewtopic.php?t=3'; // Rating and limits +$bb_cfg['search_help_url'] = 'viewtopic.php?t=4'; // Help doc about performing basic searches // Torrents $bb_cfg['bt_min_ratio_allow_dl_tor'] = 0.3; // 0 - disable @@ -128,8 +128,8 @@ $bb_cfg['show_tor_info_in_dl_list'] = true; $bb_cfg['allow_dl_list_names_mode'] = true; // Days to keep torrent registered -$bb_cfg['seeder_last_seen_days_keep'] = 0; // сколько дней назад был сид последний раз -$bb_cfg['seeder_never_seen_days_keep'] = 0; // сколько дней имеется статус "Сида не было никогда" +$bb_cfg['seeder_last_seen_days_keep'] = 0; // Max time storing for the last seen peer status +$bb_cfg['seeder_never_seen_days_keep'] = 0; // Max time for storing status - Never seen // DL-Status (days to keep user's dlstatus records) $bb_cfg['dl_will_days_keep'] = 360; @@ -153,7 +153,7 @@ $bb_cfg['pm_url'] = 'privmsg.php'; # "http://{$domain_name}/privmsg.php" // Language $bb_cfg['charset'] = 'UTF-8'; // page charset $bb_cfg['lang'] = [ - // Список доступных языков для выбора + // Languages available for selecting 'af' => [ 'name' => 'Afrikaans', 'locale' => 'af_ZA.UTF-8', @@ -346,15 +346,15 @@ $bb_cfg['lang'] = [ // Templates $bb_cfg['templates'] = [ - // Список доступных шаблонов для выбора + // Available templates for selecting 'default' => 'Default', ]; -$bb_cfg['tpl_name'] = 'default'; // Активный шаблон по умолчанию +$bb_cfg['tpl_name'] = 'default'; // Default template $bb_cfg['stylesheet'] = 'main.css'; -$bb_cfg['show_sidebar1_on_every_page'] = false; // Показывать левый сайд-бар на каждой странице -$bb_cfg['show_sidebar2_on_every_page'] = false; // Показывать правый сайд-бар на каждой странице +$bb_cfg['show_sidebar1_on_every_page'] = false; // Show left sidebar in every page +$bb_cfg['show_sidebar2_on_every_page'] = false; // Show right sidebar in every page // Cookie $bb_cfg['cookie_domain'] = in_array($domain_name, [$_SERVER['SERVER_ADDR'], 'localhost'], true) ? '' : ".$domain_name"; @@ -372,19 +372,19 @@ $bb_cfg['max_last_visit_days'] = 14; // days $bb_cfg['last_visit_update_intrv'] = 3600; // sec // Registration -$bb_cfg['invalid_logins'] = 5; // Количество неверных попыток ввода пароля, перед выводом проверки капчей -$bb_cfg['new_user_reg_disabled'] = false; // Запретить регистрацию новых учетных записей -$bb_cfg['unique_ip'] = false; // Запретить регистрацию нескольких учетных записей с одного ip -$bb_cfg['new_user_reg_restricted'] = false; // Ограничить регистрацию новых пользователей по времени по указанному ниже интервалу -$bb_cfg['new_user_reg_interval'] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]; // Допустимые часы регистрации -$bb_cfg['reg_email_activation'] = true; // Требовать активацию учетной записи по email +$bb_cfg['invalid_logins'] = 5; // Max incorrect password submits before showing captcha +$bb_cfg['new_user_reg_disabled'] = false; // Disable registration of new users +$bb_cfg['unique_ip'] = false; // Disallow registration from multiple IP addresses +$bb_cfg['new_user_reg_restricted'] = false; // Disallow registration in below hours +$bb_cfg['new_user_reg_interval'] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]; // Available hours +$bb_cfg['reg_email_activation'] = true; // Demand to activate profile by email confirmation $bb_cfg['password_symbols'] = [ - // Требовать наличие символов в пароле - 'nums' => true, // Цифры - 'spec_symbols' => false, // Спец. символы - 'letters' => [ // Буквы - 'uppercase' => true, // Заглавные буквы - 'lowercase' => true // Строчные буквы + // Whay symbols should be required in the password + 'nums' => true, // Numeric + 'spec_symbols' => false, // Special symbols + 'letters' => [ // Letters + 'uppercase' => true, // Uppercase letters + 'lowercase' => true // Lowercase letters ] ]; $bb_cfg['password_hash_options'] = [ @@ -412,16 +412,16 @@ $bb_cfg['board_email_form'] = false; // can users send email to each other via b $bb_cfg['board_email_sig'] = ''; // this text will be attached to all emails the board sends $bb_cfg['board_email_sitename'] = $domain_name; // sitename used in all emails header -$bb_cfg['topic_notify_enabled'] = true; // отправлять ли уведомление на почту, если в теме которую отслеживает пользователь есть новые ответы -$bb_cfg['pm_notify_enabled'] = true; // отправлять ли уведомление на почту, если пришло личное письмо на сайте -$bb_cfg['group_send_email'] = true; // отправлять ли уведомление на почту, если пользователя приняли в группу, пригласили в группу -$bb_cfg['email_change_disabled'] = false; // отключить возможность изменять почту самим пользователям -$bb_cfg['show_email_visibility_settings'] = true; // разрешать ли пользователям изменять свои настройки отображения почты (Скрыто или нет) +$bb_cfg['topic_notify_enabled'] = true; // Send emails to users if subscribed to the topic +$bb_cfg['pm_notify_enabled'] = true; // Send emails to users if there's a new message in inbox +$bb_cfg['group_send_email'] = true; // Send emails to users if user was invited/added to a group +$bb_cfg['email_change_disabled'] = false; // Allow changing emails for users +$bb_cfg['show_email_visibility_settings'] = true; // Allow changing privacy status of profile for users (e.g. last time seen) $bb_cfg['bounce_email'] = "bounce@$domain_name"; // bounce email address $bb_cfg['tech_admin_email'] = "admin@$domain_name"; // email for sending error reports -$bb_cfg['abuse_email'] = "abuse@$domain_name"; // почта для жалоб (абуз, правообладатели) -$bb_cfg['adv_email'] = "adv@$domain_name"; // почта для рекламных предложений +$bb_cfg['abuse_email'] = "abuse@$domain_name"; // abuse email (e.g. DMCA) +$bb_cfg['adv_email'] = "adv@$domain_name"; // advertisement email // Bugsnag error reporting $bb_cfg['bugsnag'] = [ @@ -446,21 +446,21 @@ $bb_cfg['sf_on_first_page_only'] = true; $bb_cfg['allowed_topics_per_page'] = [50, 100, 150, 200, 250, 300]; // Topics -$bb_cfg['show_quick_reply'] = true; // показывать форму быстрого ответа -$bb_cfg['show_rank_text'] = false; // показывать название лычки в топиках -$bb_cfg['show_rank_image'] = true; // показывать картинку лычки в топиках -$bb_cfg['show_poster_joined'] = true; // показывать дату регистрации пользователя в топиках -$bb_cfg['show_poster_posts'] = true; // показывать количество постов пользователя в топиках -$bb_cfg['show_poster_from'] = true; // показывать страну пользователя -$bb_cfg['show_bot_nick'] = false; // показывать ник бота +$bb_cfg['show_quick_reply'] = true; // Show quick reply forim +$bb_cfg['show_rank_text'] = false; // Show user rank name in topics +$bb_cfg['show_rank_image'] = true; // Show user rank image in topics +$bb_cfg['show_poster_joined'] = true; // Show user's registration date in topics +$bb_cfg['show_poster_posts'] = true; // Show user's post count in topics +$bb_cfg['show_poster_from'] = true; // Show user's country in topics +$bb_cfg['show_bot_nick'] = false; // Show bot's nickname $bb_cfg['text_buttons'] = false; // replace EDIT, QUOTE... images with text links -$bb_cfg['post_date_format'] = 'd-M-Y H:i'; // формат даты публикации в топиках +$bb_cfg['post_date_format'] = 'd-M-Y H:i'; // Date format for topics $bb_cfg['ext_link_new_win'] = true; // open external links in new window $bb_cfg['topic_moved_days_keep'] = 7; // remove topic moved links after xx days (or FALSE to disable) $bb_cfg['allowed_posts_per_page'] = [15, 30, 50, 100]; $bb_cfg['user_signature_start'] = '