1
0
M1Screw 1 жил өмнө
parent
commit
46bc74a7a7

+ 53 - 52
composer.lock

@@ -622,16 +622,16 @@
         },
         {
             "name": "aws/aws-sdk-php",
-            "version": "3.301.9",
+            "version": "3.302.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/aws/aws-sdk-php.git",
-                "reference": "23eda9eeb6c44a3ed6a12951b61020dc6048f7f5"
+                "reference": "cb343ed4fc5d86c0ddf8e948f0271052f183f937"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/23eda9eeb6c44a3ed6a12951b61020dc6048f7f5",
-                "reference": "23eda9eeb6c44a3ed6a12951b61020dc6048f7f5",
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/cb343ed4fc5d86c0ddf8e948f0271052f183f937",
+                "reference": "cb343ed4fc5d86c0ddf8e948f0271052f183f937",
                 "shasum": ""
             },
             "require": {
@@ -711,9 +711,9 @@
             "support": {
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.301.9"
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.302.0"
             },
-            "time": "2024-03-27T18:26:04+00:00"
+            "time": "2024-03-29T18:07:04+00:00"
         },
         {
             "name": "bacon/bacon-qr-code",
@@ -1703,7 +1703,7 @@
         },
         {
             "name": "illuminate/collections",
-            "version": "v11.1.0",
+            "version": "v11.1.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/collections.git",
@@ -1758,7 +1758,7 @@
         },
         {
             "name": "illuminate/conditionable",
-            "version": "v11.1.0",
+            "version": "v11.1.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/conditionable.git",
@@ -1804,7 +1804,7 @@
         },
         {
             "name": "illuminate/container",
-            "version": "v11.1.0",
+            "version": "v11.1.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/container.git",
@@ -1855,7 +1855,7 @@
         },
         {
             "name": "illuminate/contracts",
-            "version": "v11.1.0",
+            "version": "v11.1.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/contracts.git",
@@ -1903,16 +1903,16 @@
         },
         {
             "name": "illuminate/database",
-            "version": "v11.1.0",
+            "version": "v11.1.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/database.git",
-                "reference": "1789c7522ca0fcd5a1979ec980fb9a1636d1197a"
+                "reference": "3e4e41b278146ad645ccc5901ccaf343efd850ea"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/illuminate/database/zipball/1789c7522ca0fcd5a1979ec980fb9a1636d1197a",
-                "reference": "1789c7522ca0fcd5a1979ec980fb9a1636d1197a",
+                "url": "https://api.github.com/repos/illuminate/database/zipball/3e4e41b278146ad645ccc5901ccaf343efd850ea",
+                "reference": "3e4e41b278146ad645ccc5901ccaf343efd850ea",
                 "shasum": ""
             },
             "require": {
@@ -1967,11 +1967,11 @@
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
             },
-            "time": "2024-03-25T16:55:47+00:00"
+            "time": "2024-03-28T14:12:19+00:00"
         },
         {
             "name": "illuminate/macroable",
-            "version": "v11.1.0",
+            "version": "v11.1.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/macroable.git",
@@ -2017,7 +2017,7 @@
         },
         {
             "name": "illuminate/pagination",
-            "version": "v11.1.0",
+            "version": "v11.1.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/pagination.git",
@@ -2067,16 +2067,16 @@
         },
         {
             "name": "illuminate/support",
-            "version": "v11.1.0",
+            "version": "v11.1.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/support.git",
-                "reference": "0bdb04e24289f2a92e6d5e01c385b9cc8343696d"
+                "reference": "9fdd4fc622524787185264faeadfe14f2f0e356b"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/illuminate/support/zipball/0bdb04e24289f2a92e6d5e01c385b9cc8343696d",
-                "reference": "0bdb04e24289f2a92e6d5e01c385b9cc8343696d",
+                "url": "https://api.github.com/repos/illuminate/support/zipball/9fdd4fc622524787185264faeadfe14f2f0e356b",
+                "reference": "9fdd4fc622524787185264faeadfe14f2f0e356b",
                 "shasum": ""
             },
             "require": {
@@ -2137,7 +2137,7 @@
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
             },
-            "time": "2024-03-25T16:55:47+00:00"
+            "time": "2024-03-27T16:39:25+00:00"
         },
         {
             "name": "irazasyed/telegram-bot-sdk",
@@ -2762,16 +2762,16 @@
         },
         {
             "name": "nesbot/carbon",
-            "version": "3.2.1",
+            "version": "3.2.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/briannesbitt/Carbon.git",
-                "reference": "b4272c2e78d30f9085b079aedb692b2da879b313"
+                "reference": "2d69b6de67e2a3c0652d0c9dfcfda8b4563c4cee"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/b4272c2e78d30f9085b079aedb692b2da879b313",
-                "reference": "b4272c2e78d30f9085b079aedb692b2da879b313",
+                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/2d69b6de67e2a3c0652d0c9dfcfda8b4563c4cee",
+                "reference": "2d69b6de67e2a3c0652d0c9dfcfda8b4563c4cee",
                 "shasum": ""
             },
             "require": {
@@ -2864,7 +2864,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2024-03-27T21:37:24+00:00"
+            "time": "2024-03-28T12:59:49+00:00"
         },
         {
             "name": "nikic/fast-route",
@@ -3189,16 +3189,16 @@
         },
         {
             "name": "php-http/discovery",
-            "version": "1.19.2",
+            "version": "1.19.4",
             "source": {
                 "type": "git",
                 "url": "https://github.com/php-http/discovery.git",
-                "reference": "61e1a1eb69c92741f5896d9e05fb8e9d7e8bb0cb"
+                "reference": "0700efda8d7526335132360167315fdab3aeb599"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/php-http/discovery/zipball/61e1a1eb69c92741f5896d9e05fb8e9d7e8bb0cb",
-                "reference": "61e1a1eb69c92741f5896d9e05fb8e9d7e8bb0cb",
+                "url": "https://api.github.com/repos/php-http/discovery/zipball/0700efda8d7526335132360167315fdab3aeb599",
+                "reference": "0700efda8d7526335132360167315fdab3aeb599",
                 "shasum": ""
             },
             "require": {
@@ -3222,7 +3222,8 @@
                 "php-http/httplug": "^1.0 || ^2.0",
                 "php-http/message-factory": "^1.0",
                 "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3",
-                "symfony/phpunit-bridge": "^6.2"
+                "sebastian/comparator": "^3.0.5 || ^4.0.8",
+                "symfony/phpunit-bridge": "^6.4.4 || ^7.0.1"
             },
             "type": "composer-plugin",
             "extra": {
@@ -3261,9 +3262,9 @@
             ],
             "support": {
                 "issues": "https://github.com/php-http/discovery/issues",
-                "source": "https://github.com/php-http/discovery/tree/1.19.2"
+                "source": "https://github.com/php-http/discovery/tree/1.19.4"
             },
-            "time": "2023-11-30T16:49:05+00:00"
+            "time": "2024-03-29T13:00:05+00:00"
         },
         {
             "name": "php-http/httplug",
@@ -4854,16 +4855,16 @@
         },
         {
             "name": "smarty/smarty",
-            "version": "v5.0.1",
+            "version": "v5.0.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/smarty-php/smarty.git",
-                "reference": "4fec27ccc274ff615df13612637160264b343bd9"
+                "reference": "bbd09c7bfaa6c2c091adc4568a944f765bb4f1d9"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/smarty-php/smarty/zipball/4fec27ccc274ff615df13612637160264b343bd9",
-                "reference": "4fec27ccc274ff615df13612637160264b343bd9",
+                "url": "https://api.github.com/repos/smarty-php/smarty/zipball/bbd09c7bfaa6c2c091adc4568a944f765bb4f1d9",
+                "reference": "bbd09c7bfaa6c2c091adc4568a944f765bb4f1d9",
                 "shasum": ""
             },
             "require": {
@@ -4918,9 +4919,9 @@
             "support": {
                 "forum": "https://github.com/smarty-php/smarty/discussions",
                 "issues": "https://github.com/smarty-php/smarty/issues",
-                "source": "https://github.com/smarty-php/smarty/tree/v5.0.1"
+                "source": "https://github.com/smarty-php/smarty/tree/v5.0.2"
             },
-            "time": "2024-03-27T22:05:16+00:00"
+            "time": "2024-03-28T10:23:18+00:00"
         },
         {
             "name": "srmklive/paypal",
@@ -5033,16 +5034,16 @@
         },
         {
             "name": "stripe/stripe-php",
-            "version": "v13.15.0",
+            "version": "v13.16.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/stripe/stripe-php.git",
-                "reference": "22963c3596eb198e3dd56fbd95d7de9bc4d44f8f"
+                "reference": "b122efcf4ee02256e4a9ae60783cbf1c3f702503"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/stripe/stripe-php/zipball/22963c3596eb198e3dd56fbd95d7de9bc4d44f8f",
-                "reference": "22963c3596eb198e3dd56fbd95d7de9bc4d44f8f",
+                "url": "https://api.github.com/repos/stripe/stripe-php/zipball/b122efcf4ee02256e4a9ae60783cbf1c3f702503",
+                "reference": "b122efcf4ee02256e4a9ae60783cbf1c3f702503",
                 "shasum": ""
             },
             "require": {
@@ -5086,9 +5087,9 @@
             ],
             "support": {
                 "issues": "https://github.com/stripe/stripe-php/issues",
-                "source": "https://github.com/stripe/stripe-php/tree/v13.15.0"
+                "source": "https://github.com/stripe/stripe-php/tree/v13.16.0"
             },
-            "time": "2024-03-21T21:05:10+00:00"
+            "time": "2024-03-28T19:17:08+00:00"
         },
         {
             "name": "symfony/clock",
@@ -8282,16 +8283,16 @@
         },
         {
             "name": "phpunit/phpunit",
-            "version": "10.5.15",
+            "version": "10.5.16",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
-                "reference": "86376e05e8745ed81d88232ff92fee868247b07b"
+                "reference": "18f8d4a5f52b61fdd9370aaae3167daa0eeb69cd"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86376e05e8745ed81d88232ff92fee868247b07b",
-                "reference": "86376e05e8745ed81d88232ff92fee868247b07b",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/18f8d4a5f52b61fdd9370aaae3167daa0eeb69cd",
+                "reference": "18f8d4a5f52b61fdd9370aaae3167daa0eeb69cd",
                 "shasum": ""
             },
             "require": {
@@ -8363,7 +8364,7 @@
             "support": {
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
                 "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
-                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.15"
+                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.16"
             },
             "funding": [
                 {
@@ -8379,7 +8380,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2024-03-22T04:17:47+00:00"
+            "time": "2024-03-28T10:08:10+00:00"
         },
         {
             "name": "psr/cache",

+ 64 - 64
config/.config.example.php

@@ -1,99 +1,99 @@
 <?php
 
 //基本设置--------------------------------------------------------------------------------------------
-$_ENV['key']        = 'ChangeMe';            // Cookie加密密钥,请务必修改此key为随机字符串
-$_ENV['pwdMethod']  = 'bcrypt';              // 密码加密 可选 bcrypt, argon2i, argon2id
-$_ENV['salt']       = '';                    // bcrypt/argon2i/argon2id 会忽略此项
+$_ENV['key'] = 'ChangeMe';            // Cookie加密密钥,请务必修改此key为随机字符串
+$_ENV['pwdMethod'] = 'bcrypt';              // 密码加密 可选 bcrypt, argon2i, argon2id
+$_ENV['salt'] = '';                    // bcrypt/argon2i/argon2id 会忽略此项
 
-$_ENV['debug']      = false;                 // debug模式开关,生产环境请保持为false
-$_ENV['appName']    = 'SSPanel-UIM';         // 站点名称
-$_ENV['baseUrl']    = 'https://example.com'; // 站点地址,必须以https://开头,不要以/结尾
+$_ENV['debug'] = false;                 // debug模式开关,生产环境请保持为false
+$_ENV['appName'] = 'SSPanel-UIM';         // 站点名称
+$_ENV['baseUrl'] = 'https://example.com'; // 站点地址,必须以https://开头,不要以/结尾
 
 // WebAPI
-$_ENV['webAPI']      = true;               // 是否开启WebAPI功能
-$_ENV['webAPIUrl']   = $_ENV['baseUrl'];   // WebAPI地址,如需和站点地址相同,请不要修改
-$_ENV['muKey']       = 'ChangeMe';         // WebAPI密钥,用于节点服务端与面板通信,请务必修改此key为随机字符串
+$_ENV['webAPI'] = true;               // 是否开启WebAPI功能
+$_ENV['webAPIUrl'] = $_ENV['baseUrl'];   // WebAPI地址,如需和站点地址相同,请不要修改
+$_ENV['muKey'] = 'ChangeMe';         // WebAPI密钥,用于节点服务端与面板通信,请务必修改此key为随机字符串
 $_ENV['checkNodeIp'] = true;               // 是否webapi验证节点ip
 
 //数据库设置-------------------------------------------------------------------------------------------
 // db_host|db_socket 二选一,若设置 db_socket 则 db_host 会被忽略,不用请留空
 // db_host 例: localhost(可解析的主机名), 127.0.0.1(IP 地址)
 // db_socket 例:/var/run/mysqld/mysqld.sock(需使用绝对地址)
-$_ENV['db_host']      = '';
-$_ENV['db_socket']    = '';
-$_ENV['db_database']  = 'sspanel';           // 数据库名
-$_ENV['db_username']  = 'root';              // 数据库用户名
-$_ENV['db_password']  = 'sspanel';           // 用户密码
-$_ENV['db_port']      = '3306';              // 端口
+$_ENV['db_host'] = '';
+$_ENV['db_socket'] = '';
+$_ENV['db_database'] = 'sspanel';           // 数据库名
+$_ENV['db_username'] = 'root';              // 数据库用户名
+$_ENV['db_password'] = 'sspanel';           // 用户密码
+$_ENV['db_port'] = '3306';              // 端口
 #读写分离相关配置
 $_ENV['enable_db_rw_split'] = false;         // 是否开启读写分离
-$_ENV['read_db_hosts']      = [''];          // 从库地址,可配置多个
-$_ENV['write_db_host']      = '';            // 主库地址
+$_ENV['read_db_hosts'] = [''];          // 从库地址,可配置多个
+$_ENV['write_db_host'] = '';            // 主库地址
 #高级
-$_ENV['db_charset']   = 'utf8mb4';
+$_ENV['db_charset'] = 'utf8mb4';
 $_ENV['db_collation'] = 'utf8mb4_unicode_ci';
-$_ENV['db_prefix']    = '';
+$_ENV['db_prefix'] = '';
 
 //Redis设置-------------------------------------------------------------------------------------------
-$_ENV['redis_host']            = '127.0.0.1'; // Redis地址,使用unix domain socket时填写文件路径
-$_ENV['redis_port']            = 6379;        // Redis端口,使用unix domain socket时填写-1
+$_ENV['redis_host'] = '127.0.0.1'; // Redis地址,使用unix domain socket时填写文件路径
+$_ENV['redis_port'] = 6379;        // Redis端口,使用unix domain socket时填写-1
 $_ENV['redis_connect_timeout'] = 2.0;         // Redis连接超时时间,单位秒
-$_ENV['redis_read_timeout']    = 8.0;         // Redis读取超时时间,单位秒
-$_ENV['redis_username']        = '';          // Redis用户名,留空则不使用用户名连接
-$_ENV['redis_password']        = '';          // Redis密码,留空则无密码
-$_ENV['redis_ssl']             = false;       // 是否使用SSL连接Redis,如果使用了SSL,那么Redis端口应为Redis实例的TLS端口
-$_ENV['redis_ssl_context']     = [];          // 使用SSL时的上下文选项,参考 https://www.php.net/manual/zh/context.ssl.php
+$_ENV['redis_read_timeout'] = 8.0;         // Redis读取超时时间,单位秒
+$_ENV['redis_username'] = '';          // Redis用户名,留空则不使用用户名连接
+$_ENV['redis_password'] = '';          // Redis密码,留空则无密码
+$_ENV['redis_ssl'] = false;       // 是否使用SSL连接Redis,如果使用了SSL,那么Redis端口应为Redis实例的TLS端口
+$_ENV['redis_ssl_context'] = [];          // 使用SSL时的上下文选项,参考 https://www.php.net/manual/zh/context.ssl.php
 
 //Rate Limit设置--------------------------------------------------------------------------------------------
-$_ENV['enable_rate_limit']    = true;         // 是否开启请求限制
-$_ENV['rate_limit_ip']        = 120;          // 每分钟每个IP的全局请求限制
-$_ENV['rate_limit_sub']       = 30;           // 每分钟每个用户的订阅链接请求限制
-$_ENV['rate_limit_webapi']    = 600;          // 每分钟每个节点WebAPI密钥请求限制
-$_ENV['rate_limit_user_api']  = 60;           // 每分钟每个用户的API请求限制
+$_ENV['enable_rate_limit'] = true;         // 是否开启请求限制
+$_ENV['rate_limit_ip'] = 120;          // 每分钟每个IP的全局请求限制
+$_ENV['rate_limit_sub'] = 30;           // 每分钟每个用户的订阅链接请求限制
+$_ENV['rate_limit_webapi'] = 600;          // 每分钟每个节点WebAPI密钥请求限制
+$_ENV['rate_limit_user_api'] = 60;           // 每分钟每个用户的API请求限制
 $_ENV['rate_limit_admin_api'] = 60;           // 每分钟每个管理员的API请求限制
 
 //邮件设置--------------------------------------------------------------------------------------------
-$_ENV['mail_filter']        = 0;            // 0: 关闭; 1: 白名单模式; 2; 黑名单模式;
-$_ENV['mail_filter_list']   = [];
+$_ENV['mail_filter'] = 0;            // 0: 关闭; 1: 白名单模式; 2; 黑名单模式;
+$_ENV['mail_filter_list'] = [];
 
 //已注册用户设置---------------------------------------------------------------------------------------
 #高级
 $_ENV['class_expire_reset_traffic'] = 0;            // 等级到期时重置为的流量值,单位GB,小于0时不重置
-$_ENV['enable_kill']                = true;         // 是否允许用户注销账户
-$_ENV['enable_change_email']        = true;         // 是否允许用户更改賬戶郵箱
+$_ENV['enable_kill'] = true;         // 是否允许用户注销账户
+$_ENV['enable_change_email'] = true;         // 是否允许用户更改賬戶郵箱
 
 #用户流量余量不足邮件提醒
-$_ENV['notify_limit_mode']          = false;         // false为关闭,per为按照百分比提醒,mb为按照固定剩余流量提醒
-$_ENV['notify_limit_value']         = 500;           // 当上一项为per时,此处填写百分比;当上一项为mb时,此处填写流量
+$_ENV['notify_limit_mode'] = false;         // false为关闭,per为按照百分比提醒,mb为按照固定剩余流量提醒
+$_ENV['notify_limit_value'] = 500;           // 当上一项为per时,此处填写百分比;当上一项为mb时,此处填写流量
 
 //订阅设置---------------------------------------------------------------------------------------
-$_ENV['Subscribe']                  = true;              // 本站是否提供订阅功能
-$_ENV['subUrl']                     = $_ENV['baseUrl'];  // 订阅地址,如需和站点名称相同,请不要修改
-$_ENV['sub_token_len']              = 16;                // 订阅token长度
+$_ENV['Subscribe'] = true;              // 本站是否提供订阅功能
+$_ENV['subUrl'] = $_ENV['baseUrl'];  // 订阅地址,如需和站点名称相同,请不要修改
+$_ENV['sub_token_len'] = 16;                // 订阅token长度
 
 //审计自动封禁设置--------------------------------------------------------------------------------------------
 $_ENV['auto_detect_ban_allow_admin'] = true;        // 管理员不受审计限制
 $_ENV['auto_detect_ban_allow_users'] = [];          // 审计封禁的例外用户 ID
-$_ENV['auto_detect_ban_number']      = 30;          // 每次执行封禁所需的触发次数
-$_ENV['auto_detect_ban_time']        = 60;          // 每次封禁的时长 (分钟)
+$_ENV['auto_detect_ban_number'] = 30;          // 每次执行封禁所需的触发次数
+$_ENV['auto_detect_ban_time'] = 60;          // 每次封禁的时长 (分钟)
 
 //节点检测-----------------------------------------------------------------------------------------------
 #GFW检测
-$_ENV['detect_gfw_port']     = 443;                                                  //所有节点服务器都打开的TCP端口
-$_ENV['detect_gfw_url']      = 'http://example.com:8080/v1/tcping?ip={ip}&port={port}'; //检测节点是否被gfw墙了的API的URL
+$_ENV['detect_gfw_port'] = 443;                                                  //所有节点服务器都打开的TCP端口
+$_ENV['detect_gfw_url'] = 'http://example.com:8080/v1/tcping?ip={ip}&port={port}'; //检测节点是否被gfw墙了的API的URL
 
 #离线检测
-$_ENV['enable_detect_offline']  = true;
+$_ENV['enable_detect_offline'] = true;
 
 //高级设置-----------------------------------------------------------------------------------------------
-$_ENV['enable_login_bind_ip']     = true;             //是否将登陆线程和IP绑定
+$_ENV['enable_login_bind_ip'] = true;             //是否将登陆线程和IP绑定
 $_ENV['enable_login_bind_device'] = true;             //是否将登陆线程和设备绑定
-$_ENV['rememberMeDuration']       = 7;                //登录时记住账号时长天数
-$_ENV['timeZone']                 = 'Asia/Taipei';    //需使用 PHP 兼容的时区格式
-$_ENV['theme']                    = 'tabler';         //默认主题
-$_ENV['locale']                   = 'zh-TW';          //默认语言
-$_ENV['jump_delay']               = 1200;             //跳转延时,单位ms
-$_ENV['keep_connect']             = false;            // 流量耗尽用户限速至 1Mbps
+$_ENV['rememberMeDuration'] = 7;                //登录时记住账号时长天数
+$_ENV['timeZone'] = 'Asia/Taipei';    //需使用 PHP 兼容的时区格式
+$_ENV['theme'] = 'tabler';         //默认主题
+$_ENV['locale'] = 'zh-TW';          //默认语言
+$_ENV['jump_delay'] = 1200;             //跳转延时,单位ms
+$_ENV['keep_connect'] = false;            // 流量耗尽用户限速至 1Mbps
 
 // cdn.jsdelivr.net / fastly.jsdelivr.net / testingcf.jsdelivr.net
 $_ENV['jsdelivr_url'] = 'fastly.jsdelivr.net';
@@ -103,28 +103,28 @@ $_ENV['sentry_dsn'] = '';
 
 // Maxmind GeoIP2 database
 $_ENV['maxmind_license_key'] = '';
-$_ENV['geoip_locale']        = 'en';
+$_ENV['geoip_locale'] = 'en';
 
 // Large language model powered ticket reply and more
 $_ENV['llm_backend'] = 'openai'; // openai/google-ai/huggingface/cf-workers-ai/anthropic
 // OpenAI ChatGPT
 $_ENV['openai_api_key'] = '';
-$_ENV['openai_model']   = 'gpt-4-turbo-preview';
+$_ENV['openai_model'] = 'gpt-4-turbo-preview';
 // Google AI API
-$_ENV['google_ai_api_key']  = '';
+$_ENV['google_ai_api_key'] = '';
 $_ENV['google_ai_model_id'] = 'gemini-1.5-pro-latest';
 // Vertex AI API
-$_ENV['vertex_ai_access_token']  = '';
+$_ENV['vertex_ai_access_token'] = '';
 $_ENV['vertex_ai_location'] = 'us-central1';
 $_ENV['vertex_ai_model_id'] = 'gemini-1.0-pro';
 $_ENV['vertex_ai_project_id'] = '';
 // Hugging Face Inference API
-$_ENV['huggingface_api_key']      = '';
+$_ENV['huggingface_api_key'] = '';
 $_ENV['huggingface_endpoint_url'] = '';
 // Cloudflare Workers AI
 $_ENV['cf_workers_ai_account_id'] = '';
-$_ENV['cf_workers_ai_api_token']  = '';
-$_ENV['cf_workers_ai_model_id']   = '@cf/meta/llama-2-7b-chat-int8';
+$_ENV['cf_workers_ai_api_token'] = '';
+$_ENV['cf_workers_ai_model_id'] = '@cf/meta/llama-2-7b-chat-int8';
 // Anthropic
 $_ENV['anthropic_api_key'] = '';
 $_ENV['anthropic_model_id'] = 'claude-3-opus-20240229';
@@ -133,9 +133,9 @@ $_ENV['anthropic_model_id'] = 'claude-3-opus-20240229';
 $_ENV['github_access_token'] = '';
 
 // use Cloudflare R2 for clients download
-$_ENV['enable_r2_client_download']  = false;
-$_ENV['r2_bucket_name']             = '';
-$_ENV['r2_account_id']              = '';
-$_ENV['r2_access_key_id']           = '';
-$_ENV['r2_access_key_secret']       = '';
+$_ENV['enable_r2_client_download'] = false;
+$_ENV['r2_bucket_name'] = '';
+$_ENV['r2_account_id'] = '';
+$_ENV['r2_access_key_id'] = '';
+$_ENV['r2_access_key_secret'] = '';
 $_ENV['r2_client_download_timeout'] = 10;

+ 5 - 2
src/Controllers/Admin/DocsController.php

@@ -9,7 +9,6 @@ use App\Models\Docs;
 use App\Services\LLM;
 use App\Utils\Tools;
 use Exception;
-use GuzzleHttp\Exception\GuzzleException;
 use Psr\Http\Message\ResponseInterface;
 use Slim\Http\Response;
 use Slim\Http\ServerRequest;
@@ -90,7 +89,11 @@ final class DocsController extends BaseController
     /**
      * 使用LLM生成文档
      *
-     * @throws GuzzleException
+     * @param ServerRequest $request
+     * @param Response $response
+     * @param array $args
+     *
+     * @return Response|ResponseInterface
      */
     public function generate(ServerRequest $request, Response $response, array $args): Response|ResponseInterface
     {

+ 9 - 7
src/Controllers/AuthController.php

@@ -11,6 +11,7 @@ use App\Models\User;
 use App\Services\Auth;
 use App\Services\Cache;
 use App\Services\Captcha;
+use App\Services\Filter;
 use App\Services\Mail;
 use App\Services\MFA;
 use App\Services\RateLimit;
@@ -150,9 +151,10 @@ final class AuthController extends BaseController
             }
 
             // check email format
-            $check_res = Tools::isEmailLegal($email);
-            if ($check_res['ret'] === 0) {
-                return $response->withJson($check_res);
+            $email_check = Filter::checkEmailFilter($email);
+
+            if (! $email_check) {
+                return ResponseHelper::error($response, '无效的邮箱');
             }
 
             if (! RateLimit::checkEmailIpLimit($request->getServerParam('REMOTE_ADDR')) ||
@@ -334,16 +336,16 @@ final class AuthController extends BaseController
         $imvalue = '';
 
         // check email format
-        $check_res = Tools::isEmailLegal($email);
+        $email_check = Filter::checkEmailFilter($email);
 
-        if ($check_res['ret'] === 0) {
-            return $response->withJson($check_res);
+        if (! $email_check) {
+            return ResponseHelper::error($response, '无效的邮箱');
         }
         // check email
         $user = (new User())->where('email', $email)->first();
 
         if ($user !== null) {
-            return ResponseHelper::error($response, '邮箱已经被注册了');
+            return ResponseHelper::error($response, '无效的邮箱');
         }
 
         if (Config::obtain('reg_email_verify')) {

+ 4 - 3
src/Controllers/User/InfoController.php

@@ -9,6 +9,7 @@ use App\Models\Config;
 use App\Models\User;
 use App\Services\Auth;
 use App\Services\Cache;
+use App\Services\Filter;
 use App\Services\MFA;
 use App\Utils\Hash;
 use App\Utils\ResponseHelper;
@@ -60,10 +61,10 @@ final class InfoController extends BaseController
             return ResponseHelper::error($response, '未填写邮箱');
         }
 
-        $check_res = Tools::isEmailLegal($new_email);
+        $email_check = Filter::checkEmailFilter($email);
 
-        if ($check_res['ret'] !== 1) {
-            return $response->withJson($check_res);
+        if (! $email_check) {
+            return ResponseHelper::error($response, '无效的邮箱');
         }
 
         $exist_user = (new User())->where('email', $new_email)->first();

+ 45 - 0
src/Services/Filter.php

@@ -0,0 +1,45 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Services;
+
+use App\Utils\Tools;
+use function explode;
+use function in_array;
+
+final class Filter
+{
+    public static function checkEmailFilter(string $email): bool
+    {
+        if (! Tools::isEmail($email)) {
+            return false;
+        }
+
+        $res = false;
+        $mail_suffix = explode('@', $email)[1];
+        $mail_filter = $_ENV['mail_filter'] ?? 0;
+        $mail_filter_list = $_ENV['mail_filter_list'] ?? [];
+
+        switch ($mail_filter) {
+            case 1:
+                // Whitelist
+                if (in_array($mail_suffix, $mail_filter_list)) {
+                    $res = true;
+                }
+
+                break;
+            case 2:
+                // Blacklist
+                if (! in_array($mail_suffix, $mail_filter_list)) {
+                    $res = true;
+                }
+
+                break;
+            default:
+                $res = true;
+        }
+
+        return $res;
+    }
+}

+ 0 - 44
src/Utils/Tools.php

@@ -17,7 +17,6 @@ use function bin2hex;
 use function closedir;
 use function count;
 use function date;
-use function explode;
 use function filter_var;
 use function floor;
 use function hash;
@@ -296,49 +295,6 @@ final class Tools
         };
     }
 
-    /**
-     * @param $email
-     *
-     * @return array
-     */
-    public static function isEmailLegal($email): array
-    {
-        $res = [];
-        $res['ret'] = 0;
-
-        if (! self::isEmail($email)) {
-            $res['msg'] = '邮箱不规范';
-            return $res;
-        }
-
-        $mail_suffix = explode('@', $email)[1];
-        $mail_filter_list = $_ENV['mail_filter_list'];
-
-        switch ($_ENV['mail_filter']) {
-            case 1:
-                // 白名单
-                if (in_array($mail_suffix, $mail_filter_list)) {
-                    $res['ret'] = 1;
-                } else {
-                    $res['msg'] = '邮箱域名 ' . $mail_suffix . ' 无效,请更换邮件地址';
-                }
-
-                return $res;
-            case 2:
-                // 黑名单
-                if (! in_array($mail_suffix, $mail_filter_list)) {
-                    $res['ret'] = 1;
-                } else {
-                    $res['msg'] = '邮箱域名 ' . $mail_suffix . ' 无效,请更换邮件地址';
-                }
-
-                return $res;
-            default:
-                $res['ret'] = 1;
-                return $res;
-        }
-    }
-
     public static function isEmail($input): bool
     {
         if (! filter_var($input, FILTER_VALIDATE_EMAIL)) {

+ 68 - 0
tests/App/Services/FilterTest.php

@@ -0,0 +1,68 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Services;
+
+use App\Services\Filter;
+use PHPUnit\Framework\TestCase;
+
+final class FilterTest extends TestCase
+{
+    /**
+     * @covers App\Services\Filter::checkEmailFilter
+     */
+    public function testCheckEmailFilterWithValidEmailAndWhitelist(): void
+    {
+        $_ENV['mail_filter'] = 1;
+        $_ENV['mail_filter_list'] = ['example.com'];
+        $this->assertTrue(Filter::checkEmailFilter('[email protected]'));
+    }
+
+    /**
+     * @covers App\Services\Filter::checkEmailFilter
+     */
+    public function testCheckEmailFilterWithValidEmailAndBlacklist(): void
+    {
+        $_ENV['mail_filter'] = 2;
+        $_ENV['mail_filter_list'] = ['example.com'];
+        $this->assertFalse(Filter::checkEmailFilter('[email protected]'));
+    }
+
+    /**
+     * @covers App\Services\Filter::checkEmailFilter
+     */
+    public function testCheckEmailFilterWithInvalidEmail(): void
+    {
+        $this->assertFalse(Filter::checkEmailFilter('invalid_email'));
+    }
+
+    /**
+     * @covers App\Services\Filter::checkEmailFilter
+     */
+    public function testCheckEmailFilterWithNoMailFilter(): void
+    {
+        $_ENV['mail_filter'] = 0;
+        $this->assertTrue(Filter::checkEmailFilter('[email protected]'));
+    }
+
+    /**
+     * @covers App\Services\Filter::checkEmailFilter
+     */
+    public function testCheckEmailFilterWithValidEmailNotInWhitelist(): void
+    {
+        $_ENV['mail_filter'] = 1;
+        $_ENV['mail_filter_list'] = ['example.com'];
+        $this->assertFalse(Filter::checkEmailFilter('[email protected]'));
+    }
+
+    /**
+     * @covers App\Services\Filter::checkEmailFilter
+     */
+    public function testCheckEmailFilterWithValidEmailNotInBlacklist(): void
+    {
+        $_ENV['mail_filter'] = 2;
+        $_ENV['mail_filter_list'] = ['example.com'];
+        $this->assertTrue(Filter::checkEmailFilter('[email protected]'));
+    }
+}

+ 0 - 18
tests/App/Utils/ToolsTest.php

@@ -220,24 +220,6 @@ class ToolsTest extends TestCase
         $this->assertEquals($expected4, $result4);
     }
 
-    /**
-     * @covers App\Utils\Tools::isEmailLegal
-     */
-    public function testIsEmailLegal()
-    {
-        $_ENV['mail_filter'] = 1;
-        $_ENV['mail_filter_list'] = ['example.com'];
-
-        $email1 = '[email protected]';
-        $email2 = '[email protected]';
-
-        $expected1 = ['ret' => 1];
-        $expected2 = ['ret' => 0, 'msg' => '邮箱域名 example.org 无效,请更换邮件地址'];
-
-        $this->assertEquals($expected1, Tools::isEmailLegal($email1));
-        $this->assertEquals($expected2, Tools::isEmailLegal($email2));
-    }
-
     /**
      * @covers App\Utils\Tools::isEmail
      */