This commit is contained in:
root 2019-10-25 02:03:31 +08:00
parent adcec73982
commit 2afd94b7f4
3 changed files with 23 additions and 7 deletions

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Controllers\Server;
use App\Http\Controllers\Controller as BaseController;
class Controller extends BaseController
{
public function __construct() {
$token = $request->input('token');
if (empty($token)) {
abort(500, 'token is null');
}
if ($token !== config('v2board.server_token')) {
abort(500, 'token is error');
}
}
}

View File

@ -1,16 +1,16 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\Server;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Server\Controller;
use App\Models\User; use App\Models\User;
use App\Models\Plan; use App\Models\Plan;
use App\Models\Server; use App\Models\Server;
use App\Models\ServerLog; use App\Models\ServerLog;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
class ServerController extends Controller class DeepbworkController extends Controller
{ {
CONST SERVER_CONFIG = '{"api":{"services":["HandlerService","StatsService"],"tag":"api"},"stats":{},"inbound":{"port":443,"protocol":"vmess","settings":{"clients":[]},"streamSettings":{"network":"tcp"},"tag":"proxy"},"inboundDetour":[{"listen":"0.0.0.0","port":23333,"protocol":"dokodemo-door","settings":{"address":"0.0.0.0"},"tag":"api"}],"log":{"loglevel":"debug","access":"access.log","error":"error.log"},"outbound":{"protocol":"freedom","settings":{}},"routing":{"settings":{"rules":[{"inboundTag":["api"],"outboundTag":"api","type":"field"}]},"strategy":"rules"},"policy":{"levels":{"0":{"handshake":4,"connIdle":300,"uplinkOnly":5,"downlinkOnly":30,"statsUserUplink":true,"statsUserDownlink":true}}}}'; CONST SERVER_CONFIG = '{"api":{"services":["HandlerService","StatsService"],"tag":"api"},"stats":{},"inbound":{"port":443,"protocol":"vmess","settings":{"clients":[]},"streamSettings":{"network":"tcp"},"tag":"proxy"},"inboundDetour":[{"listen":"0.0.0.0","port":23333,"protocol":"dokodemo-door","settings":{"address":"0.0.0.0"},"tag":"api"}],"log":{"loglevel":"debug","access":"access.log","error":"error.log"},"outbound":{"protocol":"freedom","settings":{}},"routing":{"settings":{"rules":[{"inboundTag":["api"],"outboundTag":"api","type":"field"}]},"strategy":"rules"},"policy":{"levels":{"0":{"handshake":4,"connIdle":300,"uplinkOnly":5,"downlinkOnly":30,"statsUserUplink":true,"statsUserDownlink":true}}}}';
// 后端获取用户 // 后端获取用户

View File

@ -94,11 +94,10 @@ Route::prefix('v1')
}); });
// Server // Server
Route::prefix('server') Route::prefix('server')
->middleware('server')
->group(function () { ->group(function () {
// Server // Server
Route::get('user', 'ServerController@user'); Route::get('deepbwork/user', 'Server\\DeepbworkController@user');
Route::post('submit', 'ServerController@submit'); Route::post('deepbwork/submit', 'Server\\DeepbworkController@submit');
Route::get('config', 'ServerController@config'); Route::get('deepbwork/config', 'Server\\DeepbworkController@config');
}); });
}); });