mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 13:32:41 +08:00
deny Bittorrent Protocol v2 torrents
This commit is contained in:
@@ -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)
|
||||
)),
|
||||
|
||||
/*
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -98,6 +98,7 @@ return array (
|
||||
'smtp_from' => NULL,
|
||||
'smtpaddress' => 'smtp.qq.com',
|
||||
'smtpport' => '25',
|
||||
'encryption' => 'ssl',
|
||||
'accountname' => '',
|
||||
'accountpassword' => '',
|
||||
),
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user