diff --git a/.gitignore b/.gitignore index f2c715f..402c9fe 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ /._.DS_Store /.DS_Store /php-cs-fixer.phar +.php_cs.cache diff --git a/app/common/ICheck.php b/app/common/ICheck.php index 65458f3..d663923 100644 --- a/app/common/ICheck.php +++ b/app/common/ICheck.php @@ -72,7 +72,7 @@ class ICheck ]; /** - * 解析运行环境 + * 解析检查运行环境 * @param string $currentOs */ public static function analysis(string $currentOs) diff --git a/app/controller/Api.php b/app/controller/Api.php index 4420202..1acf80f 100644 --- a/app/controller/Api.php +++ b/app/controller/Api.php @@ -143,8 +143,7 @@ class Api extends BaseController } //过滤用户已配置站点 - $filter = $request->get('filter'); - if ($filter) { + if ($request->get('filter')) { domainConfig::disabledUserSites($sites); } ksort($sites); @@ -162,8 +161,8 @@ class Api extends BaseController public function Clear(Request $request): Response { $config = config('server'); - $log_file = Config::set($config['log_file'], date('Y-m-d H:i:s').' 清理日志'.PHP_EOL, 'raw', true); - $stdout_file = Config::set($config['stdout_file'], date('Y-m-d H:i:s').' 清理日志'.PHP_EOL, 'raw', true); + Config::set($config['log_file'], date('Y-m-d H:i:s').' 清理日志'.PHP_EOL, 'raw', true); + Config::set($config['stdout_file'], date('Y-m-d H:i:s').' 清理日志'.PHP_EOL, 'raw', true); return json(['code' => 1, 'msg' => '清理成功', 'data' => []]); } @@ -178,8 +177,7 @@ class Api extends BaseController $sites = domainRss::getAllRssClass(); $sites = domainRss::formatSites($sites); //过滤用户未配置站点 - $filter = $request->get('filter'); - if ($filter) { + if ($request->get('filter')) { domainConfig::disabledNotConfiguredUserSites($sites); } @@ -199,8 +197,7 @@ class Api extends BaseController $sites = domainSpiders::getAllSpidersClass(); $sites = domainSpiders::formatSites($sites); //过滤用户未配置站点 - $filter = $request->get('filter'); - if ($filter) { + if ($request->get('filter')) { domainConfig::disabledNotConfiguredUserSites($sites); } diff --git a/app/controller/BaseController.php b/app/controller/BaseController.php index e85794f..b2a402e 100644 --- a/app/controller/BaseController.php +++ b/app/controller/BaseController.php @@ -19,10 +19,6 @@ class BaseController */ const RS = Constant::RS; - public function __construct() - { - } - /** * 默认控制器 * @descr 检查未登录重定向 diff --git a/app/domain/Config.php b/app/domain/Config.php index f1eed5e..44177a9 100644 --- a/app/domain/Config.php +++ b/app/domain/Config.php @@ -245,6 +245,7 @@ class Config $cron = self::getCrontab(); return array_key_exists($uuid, $cron) ? $cron[$uuid] : []; } + /** * 禁用用户已经配置过的站点 * @param array $sites diff --git a/app/domain/Users.php b/app/domain/Users.php index 1744aa2..d3ee956 100644 --- a/app/domain/Users.php +++ b/app/domain/Users.php @@ -21,8 +21,7 @@ class Users public static function isLogin(Request $request):bool { $session = $request->session(); - $has = $session->has(Constant::Session_Token_Key); - return $has ? true : false; + return $session->has(Constant::Session_Token_Key); } /** @@ -40,13 +39,12 @@ class Users $api_url = Constant::API_BASE; $api_action = Constant::API['sites']; $url = sprintf('%s%s?sign=%s&version=%s', $api_url, $api_action, $token, IYUU_VERSION()); - file_put_contents(db_path().'/_url.json', print_r($url, true)); $res = $curl->get($url); $rs = json_decode($res->response, true); if (empty($res->response) || empty($rs) || !is_array($rs)) { $rs = Constant::RS; $rs['ret'] = 500; - $rs['msg'] = "无法访问{$api_url}接口,请检查本地网络;或重新创建容器,网络模式改为HOST模式。"; + $rs['msg'] = "无法访问{$api_url}接口,请检查本地网络;或重新创建容器,改为HOST网络模式。"; return $rs; } file_put_contents(db_path().'/_response.json', print_r($res->response, true)); @@ -86,7 +84,7 @@ class Users $data = [ 'token' => $token, 'id' => $request->post('id') + 0, - 'passkey'=> sha1($request->post('passkey')), // 避免泄露用户passkey秘钥 + 'passkey'=> sha1($request->post('passkey')), // 避免泄露用户密钥passkey 'site' => $request->post('site'), ]; $res = $curl->get($url, $data); @@ -94,7 +92,7 @@ class Users if (empty($res->response) || empty($rs) || !is_array($rs)) { $rs = Constant::RS; $rs['ret'] = 500; - $rs['msg'] = "无法访问{$url}接口,请检查本地网络;或重新创建容器,网络模式改为HOST模式。"; + $rs['msg'] = "用户绑定出错,无法访问{$url}接口,请检查本地网络;或重新创建容器,网络模式改为HOST模式。"; return $rs; } if (isset($rs['ret']) && ($rs['ret'] === 200) && isset($rs['data']['success']) && $rs['data']['success']) { diff --git a/app/functions.php b/app/functions.php index 8361bd4..6a9839d 100644 --- a/app/functions.php +++ b/app/functions.php @@ -8,7 +8,7 @@ use app\domain\Config as domainConfig; */ function IYUU_VERSION():string { - return '2.0.6'; + return '2.0.7'; } /** diff --git a/config/process.php b/config/process.php index 6b44660..aa74806 100644 --- a/config/process.php +++ b/config/process.php @@ -28,6 +28,7 @@ return [ app_path(), config_path(), base_path() . '/process', + base_path() . '/src', base_path() . '/support', base_path() . '/resource' ], diff --git a/config/server.php b/config/server.php index 45a7f46..579fb55 100644 --- a/config/server.php +++ b/config/server.php @@ -4,7 +4,7 @@ return [ 'transport' => 'tcp', 'context' => [], 'name' => 'IYUUAutoReseed', - 'count' => env('SERVER_PROCESS_COUNT', 1), + 'count' => env('SERVER_PROCESS_COUNT', 2), 'user' => env('SERVER_PROCESS_USER', ''), 'group' => env('SERVER_PROCESS_GROUP', ''), 'pid_file' => runtime_path() . '/webman.pid', diff --git a/process/FileMonitor.php b/process/FileMonitor.php index 8aac4f0..528eca7 100644 --- a/process/FileMonitor.php +++ b/process/FileMonitor.php @@ -103,4 +103,4 @@ class FileMonitor } } } -} \ No newline at end of file +} diff --git a/process/Task.php b/process/Task.php index ccaa06b..86ed1d8 100644 --- a/process/Task.php +++ b/process/Task.php @@ -9,11 +9,6 @@ use app\domain\Crontab as domainCron; class Task { - /** - * pidFile - */ - const pidFile = 'IYUUTask.pid'; - /** * @var string */ @@ -37,17 +32,12 @@ class Task */ public function __construct() { - // 保存当前进程pid - if (function_exists('posix_getpid')) { - \file_put_contents(runtime_path() . \DIRECTORY_SEPARATOR . self::pidFile, \posix_getpid()); - } // 初始化cron domainCron::onWorkerStart(); // 初始化计划任务的绝对路径 self::$cron_dir = cron_path() . DIRECTORY_SEPARATOR . domainCron::cron_dir; //添加扫描器 Timer::add(self::$interval, array($this, 'startScan')); - } /** @@ -55,8 +45,6 @@ class Task */ public function __destruct() { - // 删除当前进程pid文件 - is_file(runtime_path() . \DIRECTORY_SEPARATOR . self::pidFile) and @\unlink(runtime_path() . \DIRECTORY_SEPARATOR . self::pidFile); } /** @@ -65,12 +53,12 @@ class Task public function onWorkerStart() { // 每10秒执行 - new Crontab('*/10 * * * * *', function(){ + new Crontab('*/10 * * * * *', function () { //echo date('Y-m-d H:i:s')."\n"; }); // 每天的10点10执行,注意这里省略了秒位 - new Crontab('10 10 * * *', function(){ + new Crontab('10 10 * * *', function () { //echo date('Y-m-d H:i:s')."\n"; }); } @@ -159,6 +147,7 @@ class Task public function clearTimer(string $filename = '') { $_instances = Crontab::getAll(); // Crontab对象数组 + /** @var Crontab $crontab */ foreach ($_instances as $id => $crontab) { $name = $crontab->getName(); // 关键条件 diff --git a/process/Websocket.php b/process/Websocket.php index 38949f7..2c7cc19 100644 --- a/process/Websocket.php +++ b/process/Websocket.php @@ -37,5 +37,4 @@ class Websocket { echo "onClose\n"; } - } diff --git a/public/page/setting/sites.html b/public/page/setting/sites.html index ca55063..745ae4d 100644 --- a/public/page/setting/sites.html +++ b/public/page/setting/sites.html @@ -206,6 +206,7 @@ case 'hdhome': case 'pthome': case 'hddolby': + case 'audiences': rule.id = true; rule.limitRule = true; rule.downHash.visible = true; diff --git a/public/page/welcome.html b/public/page/welcome.html index d645867..98bba99 100644 --- a/public/page/welcome.html +++ b/public/page/welcome.html @@ -286,7 +286,7 @@

+ 爱语飞飞:爱语飞飞

+ 大卫博客:大卫博客

+ webman开发文档:webman

-

+ layui开发文档:layui

+

+ Layui开发文档:Layui

+ LayuiMini开发文档:LayuiMini

diff --git a/src/Reseed/AutoReseed.php b/src/Reseed/AutoReseed.php index 3a0380b..22fef9f 100644 --- a/src/Reseed/AutoReseed.php +++ b/src/Reseed/AutoReseed.php @@ -845,7 +845,7 @@ class AutoReseed // 循环检查所有项目 foreach ($reseed_check as $item) { echo "clients_".$k."【".self::$links[$k]['_config']['name']."】正在循环检查所有项目... {$siteName}".PHP_EOL; - $item = ($item === 'uid' ? 'id' : $item); // 兼容性处理 + $item = ($item === 'uid' ? 'id' : $item); // 兼容性处理【用户的user_id在配置项内是id】 if (empty(self::$_sites[$siteName]) || empty(self::$_sites[$siteName][$item])) { $msg = '-------因当前' .$siteName. "站点未设置".$item.",已跳过!!【如果确实已设置,请检查辅种任务,是否勾选{$siteName}站点】".PHP_EOL.PHP_EOL; echo $msg; @@ -934,7 +934,7 @@ class AutoReseed if ($reseed_check && is_array($reseed_check)) { $replace = []; foreach ($reseed_check as $value) { - $value = ($value === 'uid' ? 'id' : $value); // 兼容性处理 + $value = ($value === 'uid' ? 'id' : $value); // 兼容性处理【用户的user_id在配置项内是id】 $key = '{' . $value .'}'; $replace[$key] = empty(self::$_sites[$site][$value]) ? '' : self::$_sites[$site][$value]; } @@ -1067,13 +1067,19 @@ class AutoReseed if (!empty($weixin['notify_on_change'])) { switch ($weixin['notify_on_change']) { case 'on': - if (self::$wechatMsg['reseedSuccess'] === 0 && self::$wechatMsg['reseedError'] === 0) return ''; + if (self::$wechatMsg['reseedSuccess'] === 0 && self::$wechatMsg['reseedError'] === 0) { + return ''; + } break; case 'only_success': - if (self::$wechatMsg['reseedSuccess'] === 0) return ''; + if (self::$wechatMsg['reseedSuccess'] === 0) { + return ''; + } break; case 'only_fails': - if (self::$wechatMsg['reseedError'] === 0) return ''; + if (self::$wechatMsg['reseedError'] === 0) { + return ''; + } break; case 'off': default: diff --git a/src/Reseed/MoveTorrent.php b/src/Reseed/MoveTorrent.php index 220d3ef..e6b3c08 100644 --- a/src/Reseed/MoveTorrent.php +++ b/src/Reseed/MoveTorrent.php @@ -315,13 +315,19 @@ class MoveTorrent extends AutoReseed if (!empty($weixin['notify_on_change'])) { switch ($weixin['notify_on_change']) { case 'on': - if (self::$wechatMsg['MoveSuccess'] === 0 && self::$wechatMsg['MoveError'] === 0) return ''; + if (self::$wechatMsg['MoveSuccess'] === 0 && self::$wechatMsg['MoveError'] === 0) { + return ''; + } break; case 'only_success': - if (self::$wechatMsg['MoveSuccess'] === 0) return ''; + if (self::$wechatMsg['MoveSuccess'] === 0) { + return ''; + } break; case 'only_fails': - if (self::$wechatMsg['MoveError'] === 0) return ''; + if (self::$wechatMsg['MoveError'] === 0) { + return ''; + } break; case 'off': default: @@ -337,8 +343,7 @@ class MoveTorrent extends AutoReseed $desp .= '**移动成功:'.static::$wechatMsg['MoveSuccess']. '** [会把hash加入移动缓存]' .$br; $desp .= '**移动失败:'.static::$wechatMsg['MoveError']. '** [解决错误提示,可以重试]' .$br; $desp .= '**如需重新移动,请删除 ./torrent/cachemove 移动缓存。**'.$br; - } - else{ + } else { $desp .= $br.'----------'.$br; $desp .= $br.'转移任务完成,未发现种子需要转移'.$br; $desp .= $br.'----------'.$br; diff --git a/support/Db.php b/support/Db.php index 8592832..e1956c3 100644 --- a/support/Db.php +++ b/support/Db.php @@ -21,5 +21,4 @@ use Illuminate\Database\Capsule\Manager; */ class Db extends Manager { - -} \ No newline at end of file +} diff --git a/support/Model.php b/support/Model.php index 6f0fb3a..1796d56 100644 --- a/support/Model.php +++ b/support/Model.php @@ -18,5 +18,4 @@ use Illuminate\Database\Eloquent\Model as BaseModel; class Model extends BaseModel { - -} \ No newline at end of file +} diff --git a/support/Request.php b/support/Request.php index 7621c07..0928c86 100644 --- a/support/Request.php +++ b/support/Request.php @@ -19,5 +19,4 @@ namespace support; */ class Request extends \Webman\Http\Request { - -} \ No newline at end of file +} diff --git a/support/Response.php b/support/Response.php index 62989f3..67781f0 100644 --- a/support/Response.php +++ b/support/Response.php @@ -19,5 +19,4 @@ namespace support; */ class Response extends \Webman\Http\Response { - -} \ No newline at end of file +} diff --git a/support/bootstrap/Container.php b/support/bootstrap/Container.php index 4af86d3..dcce045 100644 --- a/support/bootstrap/Container.php +++ b/support/bootstrap/Container.php @@ -58,4 +58,4 @@ class Container implements Bootstrap { return static::$_instance; } -} \ No newline at end of file +} diff --git a/support/bootstrap/Log.php b/support/bootstrap/Log.php index 0bb0472..e62bacc 100644 --- a/support/bootstrap/Log.php +++ b/support/bootstrap/Log.php @@ -30,7 +30,8 @@ use Monolog\Logger; * @method static void alert($message, array $context = []) * @method static void emergency($message, array $context = []) */ -class Log implements Bootstrap { +class Log implements Bootstrap +{ /** * @var array @@ -76,4 +77,4 @@ class Log implements Bootstrap { { return static::channel('default')->{$name}(... $arguments); } -} \ No newline at end of file +} diff --git a/support/bootstrap/Redis.php b/support/bootstrap/Redis.php index 3d2c472..ee3e69a 100644 --- a/support/bootstrap/Redis.php +++ b/support/bootstrap/Redis.php @@ -197,7 +197,8 @@ use Illuminate\Redis\RedisManager; * @method static mixed getPersistentID() * @method static mixed getAuth() */ -class Redis implements Bootstrap { +class Redis implements Bootstrap +{ /** * @var RedisManager @@ -221,7 +222,8 @@ class Redis implements Bootstrap { * @param string $name * @return \Illuminate\Redis\Connections\Connection */ - public static function connection($name = 'default') { + public static function connection($name = 'default') + { return static::$_manager->connection($name); } diff --git a/support/bootstrap/Session.php b/support/bootstrap/Session.php index 49be215..2446bb8 100644 --- a/support/bootstrap/Session.php +++ b/support/bootstrap/Session.php @@ -22,7 +22,8 @@ use Workerman\Worker; * Class Session * @package support */ -class Session implements Bootstrap { +class Session implements Bootstrap +{ /** * @param Worker $worker @@ -35,4 +36,4 @@ class Session implements Bootstrap { SessionBase::handlerClass($config['handler'], $config['config'][$config['type']]); //session_set_cookie_params(0, $config['path'], $config['domain'], $config['secure'], $config['http_only']); } -} \ No newline at end of file +} diff --git a/support/bootstrap/Translation.php b/support/bootstrap/Translation.php index 6671c03..ee52924 100644 --- a/support/bootstrap/Translation.php +++ b/support/bootstrap/Translation.php @@ -24,7 +24,8 @@ use Symfony\Component\Translation\Loader\PhpFileLoader; * @method static void setLocale(string $locale) * @method static string getLocale() */ -class Translation implements Bootstrap { +class Translation implements Bootstrap +{ /** * @var array diff --git a/support/bootstrap/db/Heartbeat.php b/support/bootstrap/db/Heartbeat.php index a616a6e..23ab1b5 100644 --- a/support/bootstrap/db/Heartbeat.php +++ b/support/bootstrap/db/Heartbeat.php @@ -30,7 +30,7 @@ class Heartbeat implements Bootstrap */ public static function start($worker) { - \Workerman\Timer::add(55, function (){ + \Workerman\Timer::add(55, function () { Db::select('select 1 limit 1'); }); } diff --git a/support/bootstrap/db/Laravel.php b/support/bootstrap/db/Laravel.php index 7e14c11..6635712 100644 --- a/support/bootstrap/db/Laravel.php +++ b/support/bootstrap/db/Laravel.php @@ -39,7 +39,7 @@ class Laravel implements Bootstrap $capsule = new Capsule; $configs = config('database'); - $capsule->getDatabaseManager()->extend('mongodb', function($config, $name) { + $capsule->getDatabaseManager()->extend('mongodb', function ($config, $name) { $config['name'] = $name; return new Connection($config); diff --git a/support/exception/BusinessException.php b/support/exception/BusinessException.php index 6ba57c6..783cb67 100644 --- a/support/exception/BusinessException.php +++ b/support/exception/BusinessException.php @@ -21,5 +21,4 @@ use Exception; */ class BusinessException extends Exception { - -} \ No newline at end of file +} diff --git a/support/exception/Handler.php b/support/exception/Handler.php index 7089d9c..af0aa2f 100644 --- a/support/exception/Handler.php +++ b/support/exception/Handler.php @@ -37,5 +37,4 @@ class Handler extends ExceptionHandler { return parent::render($request, $exception); } - -} \ No newline at end of file +} diff --git a/support/helpers.php b/support/helpers.php index 768d590..0609d3e 100644 --- a/support/helpers.php +++ b/support/helpers.php @@ -238,7 +238,8 @@ function locale(string $locale) * @param $worker * @param $class */ -function worker_bind($worker, $class) { +function worker_bind($worker, $class) +{ $callback_map = [ 'onConnect', 'onMessage', @@ -262,7 +263,8 @@ function worker_bind($worker, $class) { /** * @return int */ -function cpu_count() { +function cpu_count() +{ if (strtolower(PHP_OS) === 'darwin') { $count = shell_exec('sysctl -n machdep.cpu.core_count'); } else { diff --git a/support/middleware/AuthCheckTest.php b/support/middleware/AuthCheckTest.php index c0f3063..39af98a 100644 --- a/support/middleware/AuthCheckTest.php +++ b/support/middleware/AuthCheckTest.php @@ -28,4 +28,4 @@ class AuthCheckTest implements MiddlewareInterface } return $next($request); } -} \ No newline at end of file +} diff --git a/support/view/Blade.php b/support/view/Blade.php index 74bae9f..ce2fcdb 100644 --- a/support/view/Blade.php +++ b/support/view/Blade.php @@ -41,4 +41,4 @@ class Blade implements View } return $balde->render($view_path, $vars); } -} \ No newline at end of file +} diff --git a/support/view/Raw.php b/support/view/Raw.php index bc33029..812aea2 100644 --- a/support/view/Raw.php +++ b/support/view/Raw.php @@ -41,4 +41,4 @@ class Raw implements View } return \ob_get_clean(); } -} \ No newline at end of file +} diff --git a/support/view/ThinkPHP.php b/support/view/ThinkPHP.php index cc518e3..51522c8 100644 --- a/support/view/ThinkPHP.php +++ b/support/view/ThinkPHP.php @@ -47,4 +47,4 @@ class ThinkPHP implements View $content = \ob_get_clean(); return $content; } -} \ No newline at end of file +} diff --git a/support/view/Twig.php b/support/view/Twig.php index 8c9a411..48fe791 100644 --- a/support/view/Twig.php +++ b/support/view/Twig.php @@ -42,4 +42,4 @@ class Twig implements View } return $view->render($view_path, $vars); } -} \ No newline at end of file +} diff --git a/vendor/ledccn/bittorrentclient/src/transmission/transmission.php b/vendor/ledccn/bittorrentclient/src/transmission/transmission.php index 94eb7a2..2224b7f 100644 --- a/vendor/ledccn/bittorrentclient/src/transmission/transmission.php +++ b/vendor/ledccn/bittorrentclient/src/transmission/transmission.php @@ -82,6 +82,7 @@ class transmission extends AbstractClient $this->curl = new Curl(); $this->curl->setOpt(CURLOPT_CONNECTTIMEOUT, 60); // 超时 $this->curl->setOpt(CURLOPT_TIMEOUT, 600); // 超时 + $this->curl->setOpt(CURLOPT_SSL_VERIFYPEER, false); } /**