deny Bittorrent Protocol v2 torrents

This commit is contained in:
xiaomlove
2022-02-12 15:08:18 +08:00
parent 186bebfe12
commit 379b84b905
5 changed files with 12 additions and 10 deletions

View File

@@ -15,7 +15,7 @@ return [
'stateful' => explode(',', env(
'SANCTUM_STATEFUL_DOMAINS',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1,'.parse_url(env('APP_URL'), PHP_URL_HOST)
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1,'.parse_url(env('APP_URL', ''), PHP_URL_HOST)
)),
/*

View File

@@ -21,7 +21,7 @@ class CreateMedalsTable extends Migration
$table->string('image_large')->nullable();
$table->string('image_small')->nullable();
$table->integer('price')->default(0);
$table->integer('duration')->default(0);
$table->integer('duration')->nullable();
$table->timestamps();
});
}

View File

@@ -1,6 +1,5 @@
<?php
# IMPORTANT: Do not edit below unless you know what you are doing!
use Illuminate\Support\Facades\DB;
if(!defined('IN_TRACKER'))
die('Hacking attempt!');
@@ -127,12 +126,11 @@ function promotion($class, $down_floor_gb, $minratio, $time_week, $addinvite = 0
function demotion($class,$deratio){
global $lang_cleanup_target;
$newclass = $class - 1;
$minSeedPoints = \App\Models\User::getMinSeedPoints($class);
if ($minSeedPoints === false) {
throw new \RuntimeException("class: $class can't get min seed points.");
}
$res = sql_query("SELECT id FROM users WHERE class = $class AND seed_points < $minSeedPoints AND uploaded / downloaded < $deratio") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0)
$sql = "SELECT id FROM users WHERE class = $class AND uploaded / downloaded < $deratio";
$res = sql_query($sql) or sqlerr(__FILE__, __LINE__);
$matchUserCount = mysql_num_rows($res);
do_log("sql: $sql, match user count: $matchUserCount");
if ($matchUserCount > 0)
{
$dt = sqlesc(date("Y-m-d H:i:s"));
while ($arr = mysql_fetch_assoc($res))
@@ -292,7 +290,7 @@ function docleanup($forceAll = 0, $printProgress = false) {
if ($is_donor == 'yes' && $donortimes_bonus > 0)
$all_bonus = $all_bonus * $donortimes_bonus;
KPS("+",$all_bonus,$arr["userid"]);
\App\Models\User::query()->where('id', $arr["userid"])->update(['seed_points' => new \Illuminate\Database\Query\Expression("seed_points + $seedPoints")]);
sql_query("update users set seed_points = seed_points + $seedPoints where id = {$arr["userid"]}");
}
}
$log = 'calculate seeding bonus';

View File

@@ -98,6 +98,7 @@ return array (
'smtp_from' => NULL,
'smtpaddress' => 'smtp.qq.com',
'smtpport' => '25',
'encryption' => 'ssl',
'accountname' => '',
'accountpassword' => '',
),

View File

@@ -117,6 +117,9 @@ function checkTorrentDict($dict, $key, $type = null)
}
$info = checkTorrentDict($dict, 'info');
if (isset($info['piece layers']) || isset($info['files tree']) || (isset($info['meta version']) && $info['meta version'] == 2)) {
bark('Torrent files created with Bittorrent Protocol v2, or hybrid torrents are not supported.');
}
$plen = checkTorrentDict($info, 'piece length', 'integer'); // Only Check without use
$dname = checkTorrentDict($info, 'name', 'string');
$pieces = checkTorrentDict($info, 'pieces', 'string');