mirror of
https://github.com/torrentpier/torrentpier-lts.git
synced 2025-02-28 15:10:54 +03:00
Fixed info hash v2 issue (#233)
* Fixed info hash v2 issue * Update CHANGELOG.md
This commit is contained in:
parent
905b6797f8
commit
474f51185c
@ -6,6 +6,7 @@
|
|||||||
**Merged pull requests:**
|
**Merged pull requests:**
|
||||||
|
|
||||||
- Release v2.1.5-2023.08 🎉
|
- Release v2.1.5-2023.08 🎉
|
||||||
|
- Fixed info hash v2 issue [\#233](https://github.com/torrentpier/torrentpier-lts/pull/233) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- BitTorrent v2 support 🐸 [\#230](https://github.com/torrentpier/torrentpier-lts/pull/230) ([belomaxorka](https://github.com/belomaxorka))
|
- BitTorrent v2 support 🐸 [\#230](https://github.com/torrentpier/torrentpier-lts/pull/230) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Captcha improvements [\#229](https://github.com/torrentpier/torrentpier-lts/pull/229) ([belomaxorka](https://github.com/belomaxorka))
|
- Captcha improvements [\#229](https://github.com/torrentpier/torrentpier-lts/pull/229) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Show renamed topic actions in log actions [\#227](https://github.com/torrentpier/torrentpier-lts/pull/227) ([belomaxorka](https://github.com/belomaxorka))
|
- Show renamed topic actions in log actions [\#227](https://github.com/torrentpier/torrentpier-lts/pull/227) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
|
@ -240,7 +240,11 @@ else
|
|||||||
{
|
{
|
||||||
// Verify if torrent registered on tracker and user authorized
|
// Verify if torrent registered on tracker and user authorized
|
||||||
$info_hash_sql = rtrim(DB()->escape($info_hash), ' ');
|
$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'";
|
/**
|
||||||
|
* Поскольку торрент-клиенты в настоящее время обрезают инфо-хэш до 20 символов (независимо от его типа, как известно v1 = 20 символов, а v2 = 32 символа),
|
||||||
|
* то результатов $is_bt_v2 (исходя из длины строки определяем тип инфо-хэша) проверки нам будет мало, именно поэтому происходит поиск v2 хэша, если торрент является v1 (по длинне) и если в tor.info_hash столбце нету v1 хэша.
|
||||||
|
*/
|
||||||
|
$info_hash_where = $is_bt_v2 ? "WHERE tor.info_hash_v2 = '$info_hash_sql'" : "WHERE tor.info_hash = '$info_hash_sql' OR tor.info_hash_v2 LIKE '$info_hash_sql%'";
|
||||||
$passkey_sql = DB()->escape($passkey);
|
$passkey_sql = DB()->escape($passkey);
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
|
@ -57,7 +57,11 @@ define('TR_ROOT', './');
|
|||||||
require(TR_ROOT . 'includes/init_tr.php');
|
require(TR_ROOT . 'includes/init_tr.php');
|
||||||
|
|
||||||
$info_hash_sql = rtrim(DB()->escape($info_hash), ' ');
|
$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'";
|
/**
|
||||||
|
* Поскольку торрент-клиенты в настоящее время обрезают инфо-хэш до 20 символов (независимо от его типа, как известно v1 = 20 символов, а v2 = 32 символа),
|
||||||
|
* то результатов $is_bt_v2 (исходя из длины строки определяем тип инфо-хэша) проверки нам будет мало, именно поэтому происходит поиск v2 хэша, если торрент является v1 (по длинне) и если в tor.info_hash столбце нету v1 хэша.
|
||||||
|
*/
|
||||||
|
$info_hash_where = $is_bt_v2 ? "WHERE tor.info_hash_v2 = '$info_hash_sql'" : "WHERE tor.info_hash = '$info_hash_sql' OR tor.info_hash_v2 LIKE '$info_hash_sql%'";
|
||||||
|
|
||||||
$row = DB()->fetch_row("
|
$row = DB()->fetch_row("
|
||||||
SELECT tor.complete_count, snap.seeders, snap.leechers
|
SELECT tor.complete_count, snap.seeders, snap.leechers
|
||||||
|
Loading…
Reference in New Issue
Block a user