Skip to content

Commit

Permalink
适配新版VNet, 去ssrpanel化
Browse files Browse the repository at this point in the history
  • Loading branch information
ZBrettonYe committed Jul 19, 2020
1 parent 692d466 commit 273e00f
Show file tree
Hide file tree
Showing 18 changed files with 128 additions and 207 deletions.
19 changes: 11 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ APP_LOCALE=zh-CN
APP_FALLBACK_LOCALE=en
LOG_CHANNEL=daily

# 数据库
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=SSRPanel_OtakuMod
DB_DATABASE=ProxyPanel
DB_USERNAME=root
DB_PASSWORD=root
DB_STRICT=false
Expand All @@ -21,22 +22,24 @@ BROADCAST_DRIVER=redis
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
SESSION_CONNECTION=session
SESSION_LIFETIME=120

# Redis 设置
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_DRIVER=smtp #或使用 mailgun
# SMTP设置
MAIL_HOST=smtp.exmail.qq.com
MAIL_PORT=465
MAIL_USERNAME=admin@ssrpanel.com
MAIL_USERNAME=admin@proxypanel.ml
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
MAIL_LOG_CHANNEL=daily
MAIL_FROM_ADDRESS=[email protected]
MAIL_FROM_NAME=SSRPanel

MAIL_FROM_ADDRESS=[email protected]
MAIL_FROM_NAME=ProxyPanel
# Mailgun设置
MAILGUN_DOMAIN=
MAILGUN_SECRET=

Expand All @@ -53,4 +56,4 @@ PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

REDIRECT_HTTPS=true
REDIRECT_HTTPS=true
6 changes: 3 additions & 3 deletions app/Http/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ public function setConfig(Request $request): JsonResponse {
// 推送通知测试
public function sendTestNotification(): JsonResponse {
if(self::$systemConfig['is_notification']){
$result = PushNotification::send('这是测试的标题', 'SSRPanel_OM测试内容');
$result = PushNotification::send('这是测试的标题', 'ProxyPanel测试内容');
if($result == false){
return Response::json(['status' => 'fail', 'message' => '发送失败,请重新尝试!']);
}
Expand Down Expand Up @@ -1266,8 +1266,8 @@ public function exportInvite(): void {

$spreadsheet = new Spreadsheet();
$spreadsheet->getProperties()
->setCreator('SSRPanel')
->setLastModifiedBy('SSRPanel')
->setCreator('ProxyPanel')
->setLastModifiedBy('ProxyPanel')
->setTitle('邀请码')
->setSubject('邀请码')
->setDescription('')
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function login(Request $request): ?JsonResponse {
'text' => '',
'buy_link' => '',
'money' => '0.00',
'sspannelName' => 'ssrpanel',
'sspannelName' => 'proxypanel',
'usedTraffic' => flowAutoShow($user->u + $user->d),
'Traffic' => flowAutoShow($user->transfer_enable),
'all' => 1,
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/Api/WebApi/TrojanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function getNodeInfo($id): JsonResponse {
'speed_limit' => $node->speed_limit,
'client_limit' => $node->client_limit,
'push_port' => $node->push_port,
'redirect_url' => Helpers::systemConfig()['redirect_url'],
'trojan_port' => $node->port,
'secret' => $node->auth->secret,
'license' => Helpers::systemConfig()['trojan_license'],
Expand Down
7 changes: 4 additions & 3 deletions app/Http/Controllers/Api/WebApi/V2RayController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ class V2RayController extends BaseController {
// 获取节点信息
public function getNodeInfo($id): JsonResponse {
$node = SsNode::query()->whereId($id)->first();
$nodeTls = NodeCertificate::query()->whereId($node->server)->first();
$nodeDv = NodeCertificate::query()->whereId($node->server)->first();

return $this->returnData('获取节点信息成功', 'success', 200, [
'id' => $node->id,
'is_udp' => $node->is_udp? true : false,
'speed_limit' => $node->speed_limit,
'client_limit' => $node->client_limit,
'push_port' => $node->push_port,
'redirect_url' => Helpers::systemConfig()['redirect_url'],
'secret' => $node->auth->secret,
'key' => $nodeTls? $nodeTls->key : '',
'pem' => $nodeTls? $nodeTls->pem : '',
'key' => $nodeDv? $nodeDv->key : '',
'pem' => $nodeDv? $nodeDv->pem : '',
'v2_license' => Helpers::systemConfig()['v2ray_license'],
'v2_alter_id' => $node->v2_alter_id,
'v2_port' => $node->v2_port,
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Api/WebApi/VNetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Controllers\Api\WebApi;

use App\Components\Helpers;
use App\Models\SsNode;
use App\Models\User;
use Illuminate\Http\JsonResponse;
Expand All @@ -24,7 +25,8 @@ public function getNodeInfo($id): JsonResponse {
'port' => strval($node->port),
'passwd' => $node->passwd?: '',
'push_port' => $node->push_port,
'secret' => $node->auth->secret
'secret' => $node->auth->secret,
'redirect_url' => Helpers::systemConfig()['redirect_url']
]);
}

Expand Down
16 changes: 6 additions & 10 deletions app/Models/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,19 @@
/**
* 审计规则
*
* @property int $id
* @property int $type 类型:1-正则表达式、2-域名、3-IP、4-协议
* @property string $name 规则描述
* @property string $pattern 规则值
* @property \Illuminate\Support\Carbon $created_at
* @property \Illuminate\Support\Carbon $updated_at
* @property-read mixed $type_api_label
* @property-read mixed $type_label
* @property int $id
* @property int $type 类型:1-正则表达式、2-域名、3-IP、4-协议
* @property string $name 规则描述
* @property string $pattern 规则值
* @property-read string $type_api_label
* @property-read string $type_label
* @method static Builder|Rule newModelQuery()
* @method static Builder|Rule newQuery()
* @method static Builder|Rule query()
* @method static Builder|Rule whereCreatedAt($value)
* @method static Builder|Rule whereId($value)
* @method static Builder|Rule whereName($value)
* @method static Builder|Rule wherePattern($value)
* @method static Builder|Rule whereType($value)
* @method static Builder|Rule whereUpdatedAt($value)
* @mixin \Eloquent
*/
class Rule extends Model {
Expand Down
5 changes: 4 additions & 1 deletion app/Models/SsNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
* @property \Illuminate\Support\Carbon $created_at
* @property \Illuminate\Support\Carbon $updated_at
* @property-read \App\Models\NodeAuth|null $auth
* @property-read mixed $type_label
* @property-read string $type_label
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\SsNodeLabel[] $label
* @property-read int|null $label_count
* @method static Builder|SsNode newModelQuery()
Expand Down Expand Up @@ -129,6 +129,9 @@ public function getTypeLabelAttribute(): string {
case 3:
$type_label = 'Trojan';
break;
case 4:
$type_label = 'VNet';
break;
default:
$type_label = 'UnKnown';
}
Expand Down
4 changes: 2 additions & 2 deletions config/version.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

return [
'number' => '210',
'name' => 'SSRPanel_OtakuMod'
'number' => '2.4.a',
'name' => 'ProxyPanel'
];
2 changes: 1 addition & 1 deletion public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @author Taylor Otwell <[email protected]>
*/

// 判断是否安装SSRPanel
// 判断是否安装ProxyPanel
if (!is_file(__DIR__.'/../.env'))
{
header("location:./install.php");
Expand Down
Loading

0 comments on commit 273e00f

Please sign in to comment.