This commit is contained in:
2023-01-02 19:56:44 +08:00
commit e187878b7a
3244 changed files with 260239 additions and 0 deletions
@@ -0,0 +1,15 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
return [];
@@ -0,0 +1,20 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
return [
'' => [
app\middleware\Login::class,
]
];
@@ -0,0 +1,15 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
return [];
@@ -0,0 +1,16 @@
<?php
return [
'enable' => true,
'capacity' => 60, // The number of requests the "bucket" can hold
'seconds' => 60, // The time it takes the "bucket" to completely refill
'cost' => 1, // The number of tokens this action uses.
'customer_handle' => [
'class' => \support\Response::class,
'constructor' => [
429,
array(),
json_encode(['success' => false, 'msg' => '请求次数太频繁'], 256),
],
],
];
@@ -0,0 +1,15 @@
<?php
return [
'enable' => true,
'capacity' => 60, // The number of requests the "bucket" can hold
'seconds' => 60, // The time it takes the "bucket" to completely refill
'cost' => 1, // The number of tokens this action uses.
'customer_handle' => [
'class' => \support\Response::class,
'constructor' => [
429,
array(),
json_encode(['success' => false, 'msg' => '请求次数太频繁'], 256),
],
],
];
@@ -0,0 +1,54 @@
<?php
// +----------------------------------------------------------------------
// | 节流设置
// +----------------------------------------------------------------------
use yzh52521\middleware\Throttle;
use yzh52521\middleware\throttle\CounterFixed;
// use yzh52521\middleware\throttle\CounterSlider;
// use yzh52521\middleware\throttle\TokenBucket;
// use yzh52521\middleware\throttle\LeakyBucket;
use Webman\Http\{Request, Response};
return [
'enable' => true,
// 缓存键前缀,防止键值与其他应用冲突
'prefix' => 'throttle_',
// 缓存的键,true 表示使用来源ip (request->getRealIp(true))
'key' => true,
// 要被限制的请求类型, eg: GET POST PUT DELETE HEAD
'visit_method' => ['GET'],
// 设置访问频率,例如 '10/m' 指的是允许每分钟请求10次。值 null 表示不限制,
// eg: null 10/m 20/h 300/d 200/300
'visit_rate' => '100/m',
// 响应体中设置速率限制的头部信息,含义见:https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting
'visit_enable_show_rate_limit' => true,
// 访问受限时返回的响应( type: null|callable )
'visit_fail_response' => function (Throttle $throttle, Request $request, int $wait_seconds): Response {
return response('Too many requests, try again after ' . $wait_seconds . ' seconds.');
},
/*
* 设置节流算法,组件提供了四种算法:
* - CounterFixed :计数固定窗口
* - CounterSlider: 滑动窗口
* - TokenBucket : 令牌桶算法
* - LeakyBucket : 漏桶限流算法
*/
'driver_name' => CounterFixed::class,
// Psr-16通用缓存库规范: https://blog.csdn.net/maquealone/article/details/79651111
// Cache驱动必须符合PSR-16缓存库规范,最低实现get/set俩个方法 (且需静态化实现)
// static get(string $key, mixed $default=null)
// static set(string $key, mixed $value, int $ttl=0);
//webman默认使用 symfony/cache作为cache组件(https://www.workerman.net/doc/webman/db/cache.html)
'cache_drive' => support\Cache::class,
//使用ThinkCache
//'cache_drive' => think\facade\Cache::class,
];
@@ -0,0 +1,54 @@
<?php
// +----------------------------------------------------------------------
// | 节流设置
// +----------------------------------------------------------------------
use yzh52521\middleware\Throttle;
// use yzh52521\middleware\throttle\CounterFixed;
// use yzh52521\middleware\throttle\CounterSlider;
use yzh52521\middleware\throttle\TokenBucket;
// use yzh52521\middleware\throttle\LeakyBucket;
use Webman\Http\{Request, Response};
return [
'enable' => true,
// 缓存键前缀,防止键值与其他应用冲突
'prefix' => 'throttle_',
// 缓存的键,true 表示使用来源ip (request->getRealIp(true))
'key' => true,
// 要被限制的请求类型, eg: GET POST PUT DELETE HEAD
'visit_method' => ['GET'],
// 设置访问频率,例如 '10/m' 指的是允许每分钟请求10次。值 null 表示不限制,
// eg: null 10/m 20/h 300/d 200/300
'visit_rate' => '10/m',
// 响应体中设置速率限制的头部信息,含义见:https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting
'visit_enable_show_rate_limit' => true,
// 访问受限时返回的响应( type: null|callable )
'visit_fail_response' => function (Throttle $throttle, Request $request, int $wait_seconds): Response {
return response('Too many requests, try again after ' . $wait_seconds . ' seconds.');
},
/*
* 设置节流算法,组件提供了四种算法:
* - CounterFixed :计数固定窗口
* - CounterSlider: 滑动窗口
* - TokenBucket : 令牌桶算法
* - LeakyBucket : 漏桶限流算法
*/
'driver_name' => TokenBucket::class,
// Psr-16通用缓存库规范: https://blog.csdn.net/maquealone/article/details/79651111
// Cache驱动必须符合PSR-16缓存库规范,最低实现get/set俩个方法 (且需静态化实现)
// static get(string $key, mixed $default=null)
// static set(string $key, mixed $value, int $ttl=0);
//webman默认使用 symfony/cache作为cache组件(https://www.workerman.net/doc/webman/db/cache.html)
'cache_drive' => support\Cache::class,
//使用ThinkCache
//'cache_drive' => think\facade\Cache::class,
];
@@ -0,0 +1,54 @@
<?php
// +----------------------------------------------------------------------
// | 节流设置
// +----------------------------------------------------------------------
use yzh52521\middleware\Throttle;
// use yzh52521\middleware\throttle\CounterFixed;
// use yzh52521\middleware\throttle\CounterSlider;
use yzh52521\middleware\throttle\TokenBucket;
// use yzh52521\middleware\throttle\LeakyBucket;
use Webman\Http\{Request, Response};
return [
'enable' => true,
// 缓存键前缀,防止键值与其他应用冲突
'prefix' => 'throttle_',
// 缓存的键,true 表示使用来源ip (request->getRealIp(true))
'key' => true,
// 要被限制的请求类型, eg: GET POST PUT DELETE HEAD
'visit_method' => ['GET'],
// 设置访问频率,例如 '10/m' 指的是允许每分钟请求10次。值 null 表示不限制,
// eg: null 10/m 20/h 300/d 200/300
'visit_rate' => '10/m',
// 响应体中设置速率限制的头部信息,含义见:https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting
'visit_enable_show_rate_limit' => true,
// 访问受限时返回的响应( type: null|callable )
'visit_fail_response' => function (Throttle $throttle, Request $request, int $wait_seconds): Response {
return json(['code'=>999,'msg'=>'请求频率过快,请稍后重试']);
},
/*
* 设置节流算法,组件提供了四种算法:
* - CounterFixed :计数固定窗口
* - CounterSlider: 滑动窗口
* - TokenBucket : 令牌桶算法
* - LeakyBucket : 漏桶限流算法
*/
'driver_name' => TokenBucket::class,
// Psr-16通用缓存库规范: https://blog.csdn.net/maquealone/article/details/79651111
// Cache驱动必须符合PSR-16缓存库规范,最低实现get/set俩个方法 (且需静态化实现)
// static get(string $key, mixed $default=null)
// static set(string $key, mixed $value, int $ttl=0);
//webman默认使用 symfony/cache作为cache组件(https://www.workerman.net/doc/webman/db/cache.html)
'cache_drive' => support\Cache::class,
//使用ThinkCache
//'cache_drive' => think\facade\Cache::class,
];
+22
View File
@@ -0,0 +1,22 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
return [
'default' => [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'database' => 0,
],
];
+22
View File
@@ -0,0 +1,22 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
return [
'default' => [
'host' => getenv('redis.host'),
'password' => getenv('redis.password'),
'port' => getenv('redis.port'),
'database' => getenv('redis.database'),
],
];
+22
View File
@@ -0,0 +1,22 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
return [
'default' => [
'host' => getenv('redis.host'),
'password' => getenv('redis.password'),
'port' => getenv('redis.port'),
'database' => getenv('redis.database'),
],
];
+22
View File
@@ -0,0 +1,22 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
return [
'default' => [
'host' => getenv('redis.host'),
'password' => getenv('redispassword'),
'port' => getenv('redis.port'),
'database' => getenv('redis.database'),
],
];
+22
View File
@@ -0,0 +1,22 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
return [
'default' => [
'host' => getenv('RedisHost'),
'password' => getenv('RedisPassword'),
'port' => getenv('RedisPort'),
'database' => getenv('RedisDatabase'),
],
];
+21
View File
@@ -0,0 +1,21 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
+22
View File
@@ -0,0 +1,22 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::any('/login', [app\controller\IndexController::class, 'login']);
+25
View File
@@ -0,0 +1,25 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
+28
View File
@@ -0,0 +1,28 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
+29
View File
@@ -0,0 +1,29 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/', [app\controller\IndexController::class, 'Index']);
+29
View File
@@ -0,0 +1,29 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/', [app\controller\IndexController::class, 'index']);
+30
View File
@@ -0,0 +1,30 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/', [app\controller\IndexController::class, 'index']);
Route::any('*', [app\controller\IndexController::class, 'index']);
+31
View File
@@ -0,0 +1,31 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::group('/', function () {
Route::any('', [app\controller\IndexController::class, 'index']);
Route::any('*', [app\controller\IndexController::class, 'index']);
});
+30
View File
@@ -0,0 +1,30 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::fallback(function(){
Route::any('', [app\controller\IndexController::class, 'index']);
});
+30
View File
@@ -0,0 +1,30 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::fallback(function(){
Route::any('*', [app\controller\IndexController::class, 'index']);
});
+31
View File
@@ -0,0 +1,31 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::group('/', function () {
Route::any('', [app\controller\IndexController::class, 'index']);
});
+31
View File
@@ -0,0 +1,31 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::fallback(function(){
return (new app\controller\IndexController)->index($request);
});
+31
View File
@@ -0,0 +1,31 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::fallback(function($request){
return (new app\controller\IndexController)->index($request);
});
+38
View File
@@ -0,0 +1,38 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::fallback(function($request){
#return (new app\controller\IndexController)->index($request);
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($id=='blank' || $key='blank'){
return redirect('/login');
}
$route = $request->route;
return view('index',['route'=>$route]);
});
+39
View File
@@ -0,0 +1,39 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'index']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::fallback(function($request){
#return (new app\controller\IndexController)->index($request);
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if($id=='blank' || $key='blank'){
return redirect('/login');
}
$route = $request->route;
return view('index',['route'=>$route]);
});
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'index']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::fallback(function($request){
#return (new app\controller\IndexController)->index($request);
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
echo($key);
if($id=='blank' || $key='blank'){
return redirect('/login');
}
$route = $request->route;
return view('index',['route'=>$route]);
});
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'index']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::fallback(function($request){
#return (new app\controller\IndexController)->index($request);
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
echo($id);
if( $id=='blank' || $key='blank'){
return redirect('/login');
}
$route = $request->route;
return view('index',['route'=>$route]);
});
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'index']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::fallback(function($request){
#return (new app\controller\IndexController)->index($request);
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if( $id=='blank' || $key='blank'){
echo('why?');
return redirect('/login');
}
$route = $request->route;
return view('index',['route'=>$route]);
});
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'index']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::fallback(function($request){
#return (new app\controller\IndexController)->index($request);
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if( $id=='blank' || $key=='blank'){
echo('why?');
return redirect('/login');
}
$route = $request->route;
return view('index',['route'=>$route]);
});
+39
View File
@@ -0,0 +1,39 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'index']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::fallback(function($request){
#return (new app\controller\IndexController)->index($request);
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if( $id=='blank' || $key=='blank'){
return redirect('/login');
}
$route = $request->route;
return view('index',['route'=>$route]);
});
+39
View File
@@ -0,0 +1,39 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'index']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::fallback(function($request){
#return (new app\controller\IndexController)->index($request);
$id=$request->cookie('id', 'blank');
$key=$request->cookie('key', 'blank');
if( $id=='blank' || $key=='blank'){
return redirect('/login');
}
$route = $request->route;
return view('index',['route'=>$route,'id'=>$id]);
});
+32
View File
@@ -0,0 +1,32 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'index']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::fallback(function($request){
return (new app\controller\IndexController)->index($request);
});
+35
View File
@@ -0,0 +1,35 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'index']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/test', function ($request) {
return view('index');
});
Route::fallback(function($request){
return (new app\controller\IndexController)->index($request);
});
+37
View File
@@ -0,0 +1,37 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'index']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/test', function ($request) {
return view('index');
});
Route::any('/login/logout', [app\controller\IndexController::class, 'logout']);
Route::fallback(function($request){
return (new app\controller\IndexController)->index($request);
});
+38
View File
@@ -0,0 +1,38 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'index']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/test', function ($request) {
return view('index');
});
Route::any('/login/logout', [app\controller\IndexController::class, 'logout']);
Route::any('/dl/{id}/{way}', [app\controller\IndexController::class, 'download']);
Route::fallback(function($request){
return (new app\controller\IndexController)->index($request);
});
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'index']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/test', function ($request) {
return view('index');
});
Route::any('/login/logout', [app\controller\IndexController::class, 'logout']);
Route::any('/logout.php', [app\controller\IndexController::class, 'logout']);
Route::any('/dl/{id}/{way}', [app\controller\IndexController::class, 'download']);
Route::fallback(function($request){
return (new app\controller\IndexController)->index($request);
});
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'index']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/test', function ($request) {
return view('index');
});
Route::any('/login/logout', [app\controller\IndexController::class, 'logout']);
Route::any('/logout.php', [app\controller\IndexController::class, 'logout']);
Route::any('/dl/{id}/{way}', [app\controller\IndexController::class, 'download']);
Route::fallback(function($request){
return (new app\controller\IndexController)->index($request);
});
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'file']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/test', function ($request) {
return view('index');
});
Route::any('/login/logout', [app\controller\IndexController::class, 'logout']);
Route::any('/logout.php', [app\controller\IndexController::class, 'logout']);
Route::any('/dl/{id}/{way}', [app\controller\IndexController::class, 'download']);
Route::fallback(function($request){
return (new app\controller\IndexController)->index($request);
});
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy', [app\controller\IndexController::class, 'file']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/test', function ($request) {
return view('index');
});
Route::any('/login/logout', [app\controller\IndexController::class, 'logout']);
Route::any('/logout.php', [app\controller\IndexController::class, 'logout']);
Route::any('/dl/{id}/{way}', [app\controller\IndexController::class, 'download']);
Route::fallback(function($request){
return (new app\controller\IndexController)->index($request);
});
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/zlibproxy/check', [app\controller\File::class, 'check']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/test', function ($request) {
return view('index');
});
Route::any('/login/logout', [app\controller\IndexController::class, 'logout']);
Route::any('/logout.php', [app\controller\IndexController::class, 'logout']);
Route::any('/dl/{id}/{way}', [app\controller\IndexController::class, 'download']);
Route::fallback(function($request){
return (new app\controller\IndexController)->index($request);
});
+48
View File
@@ -0,0 +1,48 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Webman\Route;
Route::disableDefaultRoute();
Route::any('/login', [app\controller\IndexController::class, 'login']);
Route::any('/login/check', [app\controller\IndexController::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/login/code', [app\controller\IndexController::class, 'code'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/test', function ($request) {
return view('index');
});
Route::any('/login/logout', [app\controller\IndexController::class, 'logout']);
Route::any('/logout.php', [app\controller\IndexController::class, 'logout']);
Route::any('/dl/{id}/{way}', [app\controller\IndexController::class, 'download']);
Route::any('/zlibproxy/check', [app\controller\File::class, 'check'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/zlibproxy/download', [app\controller\File::class, 'download'])->middleware([
app\middleware\Throttle::class
]);
Route::any('/zlibproxy/get', [app\controller\File::class, 'get'])->middleware([
app\middleware\Throttle::class
]);
Route::fallback(function($request){
return (new app\controller\IndexController)->index($request);
});
+31
View File
@@ -0,0 +1,31 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
return [
'listen' => 'http://0.0.0.0:8787',
'transport' => 'tcp',
'context' => [],
'name' => 'webman',
'count' => cpu_count() * 4,
'user' => '',
'group' => '',
'reusePort' => false,
'event_loop' => '',
'stop_timeout' => 2,
'pid_file' => runtime_path() . '/webman.pid',
'status_file' => runtime_path() . '/webman.status',
'stdout_file' => runtime_path() . '/logs/stdout.log',
'log_file' => runtime_path() . '/logs/workerman.log',
'max_package_size' => 10 * 1024 * 1024
];
+31
View File
@@ -0,0 +1,31 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
return [
'listen' => 'http://0.0.0.0:19500',
'transport' => 'tcp',
'context' => [],
'name' => 'webman',
'count' => cpu_count() * 4,
'user' => '',
'group' => '',
'reusePort' => false,
'event_loop' => '',
'stop_timeout' => 2,
'pid_file' => runtime_path() . '/webman.pid',
'status_file' => runtime_path() . '/webman.status',
'stdout_file' => runtime_path() . '/logs/stdout.log',
'log_file' => runtime_path() . '/logs/workerman.log',
'max_package_size' => 10 * 1024 * 1024
];