mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
remove composer autoload files
This commit is contained in:
@@ -63,3 +63,5 @@ GOOGLE_DRIVE_FOLDER_ID=
|
||||
|
||||
GEOIP2_DATABASE=
|
||||
EXAM_PROGRESS_UPDATE_PROBABILITY=20
|
||||
|
||||
ANNOUNCE_API_LOCAL_HOST=
|
||||
|
||||
@@ -76,15 +76,25 @@ class TrackerRepository extends BaseRepository
|
||||
$this->updateSnatch($peerSelf, $queries, $dataTraffic);
|
||||
$this->updateTorrent($torrent, $queries);
|
||||
|
||||
$this->userUpdates['uploaded'] = DB::raw('uploaded + ' . $dataTraffic['uploaded_increment_for_user']);
|
||||
$this->userUpdates['downloaded'] = DB::raw('downloaded + ' . $dataTraffic['downloaded_increment_for_user']);
|
||||
$this->userUpdates['clientselect'] = $clientAllow->id;
|
||||
$this->userUpdates['showclienterror'] = 'no';
|
||||
if ($dataTraffic['uploaded_increment_for_user'] > 0) {
|
||||
$this->userUpdates['uploaded'] = DB::raw('uploaded + ' . $dataTraffic['uploaded_increment_for_user']);
|
||||
}
|
||||
if ($dataTraffic['downloaded_increment_for_user'] > 0) {
|
||||
$this->userUpdates['downloaded'] = DB::raw('downloaded + ' . $dataTraffic['downloaded_increment_for_user']);
|
||||
}
|
||||
if ($user->clientselect != $clientAllow->id) {
|
||||
$this->userUpdates['clientselect'] = $clientAllow->id;
|
||||
}
|
||||
if ($user->showclienterror == 'yes') {
|
||||
$this->userUpdates['showclienterror'] = 'no';
|
||||
}
|
||||
}
|
||||
$repDict = $this->generateSuccessAnnounceResponse($torrent, $queries, $user, $withPeers);
|
||||
} catch (ClientNotAllowedException $exception) {
|
||||
do_log("[ClientNotAllowedException] " . $exception->getMessage());
|
||||
$this->userUpdates['showclienterror'] = 'yes';
|
||||
if (isset($user) && $user->showclienterror == 'no') {
|
||||
$this->userUpdates['showclienterror'] = 'yes';
|
||||
}
|
||||
$repDict = $this->generateFailedAnnounceResponse($exception->getMessage());
|
||||
} catch (TrackerException $exception) {
|
||||
$repDict = $this->generateFailedAnnounceResponse($exception->getMessage());
|
||||
@@ -105,6 +115,7 @@ class TrackerRepository extends BaseRepository
|
||||
* @param Request $request
|
||||
* @throws ClientNotAllowedException
|
||||
* @throws TrackerException
|
||||
* @refs
|
||||
*/
|
||||
protected function checkClient(Request $request)
|
||||
{
|
||||
@@ -180,6 +191,11 @@ class TrackerRepository extends BaseRepository
|
||||
return compact('torrentId', 'uid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return array
|
||||
* @throws TrackerException
|
||||
*/
|
||||
protected function checkAnnounceFields(Request $request): array
|
||||
{
|
||||
$queries = [];
|
||||
@@ -336,7 +352,7 @@ class TrackerRepository extends BaseRepository
|
||||
$ratio = ($user->downloaded > 0) ? ($user->uploaded / $user->downloaded) : 1;
|
||||
$settingsMain = Setting::get('main');
|
||||
if ($settingsMain['waitsystem'] == 'yes') {
|
||||
$elapsed = Carbon::now()->diffInSeconds($torrent->added);
|
||||
$elapsed = Carbon::now()->diffInHours($torrent->added);
|
||||
if ($ratio < 0.4) $wait = 24;
|
||||
elseif ($ratio < 0.5) $wait = 12;
|
||||
elseif ($ratio < 0.6) $wait = 6;
|
||||
|
||||
2
artisan
2
artisan
@@ -14,6 +14,8 @@ define('LARAVEL_START', microtime(true));
|
||||
| loading of any our classes "manually". Feels great to relax.
|
||||
|
|
||||
*/
|
||||
require __DIR__ . '/include/globalfunctions.php';
|
||||
require __DIR__ . '/include/functions.php';
|
||||
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
},
|
||||
"files": [
|
||||
"include/globalfunctions.php",
|
||||
"include/functions.php"
|
||||
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
|
||||
@@ -3,6 +3,8 @@ define('NEXUS_START', microtime(true));
|
||||
define('IN_NEXUS', true);
|
||||
$rootpath = dirname(__DIR__) . '/';
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . $rootpath);
|
||||
require $rootpath . 'include/globalfunctions.php';
|
||||
require $rootpath . 'include/functions.php';
|
||||
require $rootpath . 'include/core.php';
|
||||
require $rootpath . 'classes/class_advertisement.php';
|
||||
require $rootpath . 'classes/class_attendance.php';
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<?php
|
||||
define('NEXUS_START', microtime(true));
|
||||
define('IN_NEXUS', true);
|
||||
defined('NEXUS_START') || define('NEXUS_START', microtime(true));
|
||||
defined('IN_NEXUS') || define('IN_NEXUS', true);
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', true);
|
||||
$rootpath= dirname(__DIR__) . '/';
|
||||
require_once $rootpath . 'include/globalfunctions.php';
|
||||
require_once $rootpath . 'include/functions_announce.php';
|
||||
require $rootpath . 'include/core.php';
|
||||
require $rootpath . 'include/functions_announce.php';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require __DIR__ . '/constants.php';
|
||||
require_once __DIR__ . '/constants.php';
|
||||
require $rootpath . 'vendor/autoload.php';
|
||||
if (!file_exists($rootpath . '.env')) {
|
||||
$installScriptRelativePath = 'install/install.php';
|
||||
|
||||
@@ -336,4 +336,5 @@ function check_client($peer_id, $agent, &$agent_familyid)
|
||||
return "Banned Client, Please goto $BASEURL/faq.php#id29 for a list of acceptable clients";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -159,20 +159,11 @@ function do_log($log, $level = 'info')
|
||||
if (is_null($setLogLevel)) {
|
||||
$setLogLevel = nexus_env('LOG_LEVEL', 'debug');
|
||||
}
|
||||
$logLevels = [
|
||||
\Psr\Log\LogLevel::DEBUG,
|
||||
\Psr\Log\LogLevel::INFO,
|
||||
\Psr\Log\LogLevel::NOTICE,
|
||||
\Psr\Log\LogLevel::WARNING,
|
||||
\Psr\Log\LogLevel::ERROR,
|
||||
\Psr\Log\LogLevel::CRITICAL,
|
||||
\Psr\Log\LogLevel::ALERT,
|
||||
\Psr\Log\LogLevel::EMERGENCY,
|
||||
];
|
||||
$logLevels = ['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency'];
|
||||
$setLogLevelKey = array_search($setLogLevel, $logLevels);
|
||||
$currentLogLevelKey = array_search($level, $logLevels);
|
||||
if ($currentLogLevelKey === false) {
|
||||
$level = \Psr\log\LogLevel::ERROR;
|
||||
$level = 'error';
|
||||
$log = "[ERROR_LOG_LEVEL] $log";
|
||||
$currentLogLevelKey = array_search($level, $logLevels);
|
||||
}
|
||||
@@ -310,7 +301,7 @@ function nexus_env($key = null, $default = null)
|
||||
{
|
||||
static $env;
|
||||
if (is_null($env)) {
|
||||
$envFile = defined('ROOT_PATH') ? ROOT_PATH . '.env' : base_path('.env');
|
||||
$envFile = dirname(__DIR__) . '/.env';
|
||||
$env = readEnvFile($envFile);
|
||||
}
|
||||
if (is_null($key)) {
|
||||
@@ -678,3 +669,24 @@ function get_hr_ratio($uped, $downed)
|
||||
|
||||
return $ratio;
|
||||
}
|
||||
|
||||
function request_local_announce_api($announceApiLocalHost)
|
||||
{
|
||||
$start = microtime(true);
|
||||
$ch = curl_init();
|
||||
$options = [
|
||||
CURLOPT_URL => sprintf('%s/api/announce?%s', trim($announceApiLocalHost, '/'), $_SERVER['QUERY_STRING']),
|
||||
CURLOPT_USERAGENT => $_SERVER["HTTP_USER_AGENT"],
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_TIMEOUT => 60,
|
||||
];
|
||||
curl_setopt_array($ch, $options);
|
||||
$response = curl_exec($ch);
|
||||
$log = sprintf(
|
||||
"[LOCAL_ANNOUNCE_API] [%s] options: %s, response(%s): %s",
|
||||
number_format(microtime(true) - $start, 3), json_encode($options), gettype($response), $response
|
||||
);
|
||||
do_log($log);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ ini_set('error_reporting', E_ALL);
|
||||
ini_set('display_errors', 0);
|
||||
define('IN_NEXUS', true);
|
||||
define('NEXUS_START', microtime(true));
|
||||
require ROOT_PATH . 'include/globalfunctions.php';
|
||||
require ROOT_PATH . 'include/functions.php';
|
||||
require ROOT_PATH . 'vendor/autoload.php';
|
||||
require ROOT_PATH . 'nexus/Database/helpers.php';
|
||||
require ROOT_PATH . 'include/constants.php';
|
||||
|
||||
@@ -1,6 +1,22 @@
|
||||
<?php
|
||||
defined('NEXUS_START') || define('NEXUS_START', microtime(true));
|
||||
defined('IN_NEXUS') || define('IN_NEXUS', true);
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', true);
|
||||
require __DIR__ . '/../include/constants.php';
|
||||
require __DIR__ . '/../include/globalfunctions.php';
|
||||
require __DIR__ . '/../include/functions_announce.php';
|
||||
$announceApiLocalHost = nexus_env('ANNOUNCE_API_LOCAL_HOST');
|
||||
if ($announceApiLocalHost) {
|
||||
do_log("[GOING_TO_REQUEST_LOCAL_ANNOUNCE_URL] $announceApiLocalHost");
|
||||
$response = request_local_announce_api($announceApiLocalHost);
|
||||
if (empty($response)) {
|
||||
err("error from ANNOUNCE_API_LOCAL_HOST");
|
||||
} else {
|
||||
exit(benc_resp_raw($response));
|
||||
}
|
||||
}
|
||||
//continue the normal process
|
||||
require_once('../include/bittorrent_announce.php');
|
||||
//require_once('../include/benc.php');
|
||||
dbconn_announce();
|
||||
do_log(nexus_json_encode($_SERVER));
|
||||
//1. BLOCK ACCESS WITH WEB BROWSERS AND CHEATS!
|
||||
|
||||
@@ -31,6 +31,9 @@ if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) {
|
||||
|
|
||||
*/
|
||||
|
||||
require dirname(__DIR__) . '/include/globalfunctions.php';
|
||||
require dirname(__DIR__) . '/include/functions.php';
|
||||
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user