diff --git a/app/Controllers/LinkController.php b/app/Controllers/LinkController.php index 1aed9f22..8141051c 100644 --- a/app/Controllers/LinkController.php +++ b/app/Controllers/LinkController.php @@ -173,7 +173,6 @@ class LinkController extends BaseController return $proxy_group; } } - public static function GetQuantumult($user, $mu = 0, $quantumult = 0) { $proxys = []; diff --git a/app/Utils/TelegramProcess.php b/app/Utils/TelegramProcess.php index f47bb1fd..0b13eac8 100644 --- a/app/Utils/TelegramProcess.php +++ b/app/Utils/TelegramProcess.php @@ -10,9 +10,15 @@ class TelegramProcess { private static $all_rss = [ "?mu=0" => "SSR普通订阅" , "?mu=1" => "SSR单端口订阅", - "?mu=3"=> "SS/SSD订阅", + "?mu=3" => "SS/SSD订阅", "?mu=2" => "V2ray订阅", - "?mu=4"=> "Clash订阅"]; + "?mu=4" => "Clash订阅", + "?mu=0&app=1" => "Shadowrocket(普通订阅)", + "?mu=1&app=1" => "Shadowrocket(单端口)", + "?mu=0&app=2" => "Kitsunebi(普通订阅)", + "?mu=1&app=2" => "Kitsunebi(单端口节点订阅)", + "?mu=0&quantumult=1" => "Quantumult(Vmess订阅)", + "?mu=0&quantumult=2" => "Quantumult(完整配置)"]; private static function callback_bind_method($bot,$message,$command){ @@ -20,10 +26,28 @@ class TelegramProcess $user = User::where('telegram_id', $message->getFrom()->getId())->first(); if ($user != null) { switch (true){ + case $command=="?mu=0&quantumult=2": + $ssr_sub_token = LinkController::GenerateSSRSubCode($user->id, 0); + $baseUrl =Config::get('baseUrl'); + $keyboard = new \TelegramBot\Api\Types\Inline\InlineKeyboardMarkup( + [ + [ + ['text' => '点击跳转', 'url' => $baseUrl."/jump.html?url=quantumult://settings?configuration=clipboard"] + ] + ] + ); + $bot->sendMessage($user->get_user_attributes("telegram_id"), "两种方法:\n 方法一:\n 1.点击打开以下配置文件\n 2. 选择分享->拷贝到\"Quantumult\"\n 3.选择更新配置\n 方法二:\n 1.长按配置文件\n 2. 选择更多->分享->拷贝\n 3.点击跳转APP,到Quan中保存" , $parseMode = null, $disablePreview = false, $replyToMessageId = null,$replyMarkup=$keyboard); + $filepath ='/tmp/tg_'.$ssr_sub_token.'.txt'; + $fh = fopen($filepath, 'w+'); + $string = LinkController::GetQuantumult($user,0,2); + fwrite($fh, $string); + fclose($fh); + $bot->sendDocument($user->get_user_attributes("telegram_id"), new \CURLFile($filepath,'','quantumult_'.$ssr_sub_token.'.conf')); + break; case (strpos($command,"mu")): $ssr_sub_token = LinkController::GenerateSSRSubCode($user->id, 0); $subUrl = Config::get('subUrl'); - $reply_message = self::$all_rss[$command].": ".$subUrl.$ssr_sub_token.$command."\n"; + $reply_message = self::$all_rss[$command].": ".$subUrl.$ssr_sub_token.$command.PHP_EOL; $bot->sendMessage($message->getChat()->getId(), $reply_message , $parseMode = null, $disablePreview = false, $replyToMessageId = $reply_to); break; default: @@ -31,7 +55,7 @@ class TelegramProcess } } -} + } private static function needbind_method($bot, $message, $command, $user, $reply_to = null) { if ($user != null) { @@ -275,7 +299,6 @@ class TelegramProcess $bot = new \TelegramBot\Api\Client(Config::get('telegram_token')); // or initialize with botan.io tracker api key // $bot = new \TelegramBot\Api\Client('YOUR_BOT_API_TOKEN', 'YOUR_BOTAN_TRACKER_API_KEY'); - $command_list = array("ping", "chat", "traffic", "help", "prpr", "checkin", "rss"); foreach ($command_list as $command) { $bot->command($command, function ($message) use ($bot, $command) { diff --git a/app/Utils/URL.php b/app/Utils/URL.php index 69570f80..9ed2fd03 100644 --- a/app/Utils/URL.php +++ b/app/Utils/URL.php @@ -494,18 +494,30 @@ class URL if (count($node_explode) >= 6) { $item = array_merge($item, URL::parse_args($node_explode[5])); + + if (array_key_exists("server",$item)){ + $item['add']=$item['server']; + unset($item['server']); + } } return $item; } public static function getAllV2ray($user) { - $nodes = Node::where('sort', 11)->where( - function ($query) use ($user){ - $query->where("node_group", "=", $user->node_group) - ->orWhere("node_group", "=", 0); - } - )->where("type", "1")->where("node_class", "<=", $user->class)->orderBy("name")->get(); + if ($user->is_admin){ + + $nodes = Node::where('sort', 11)->where("type", "1")->orderBy("name")->get(); + + }else{ + + $nodes = Node::where('sort', 11)->where( + function ($query) use ($user){ + $query->where("node_group", "=", $user->node_group) + ->orWhere("node_group", "=", 0); + } + )->where("type", "1")->where("node_class", "<=", $user->class)->orderBy("name")->get(); + } $return_array = array(); diff --git a/public/jump.html b/public/jump.html new file mode 100644 index 00000000..76bb640f --- /dev/null +++ b/public/jump.html @@ -0,0 +1,23 @@ + + + + + web页面跳转App + + + + + diff --git a/resources/views/material/user/index.tpl b/resources/views/material/user/index.tpl index 26cf4b13..f5afba64 100644 --- a/resources/views/material/user/index.tpl +++ b/resources/views/material/user/index.tpl @@ -386,7 +386,7 @@
{else} -

+

visibility_off等级至少为{$display_ios_class}可见,如需升级请点击这里升级套餐。

{/if} @@ -545,7 +545,7 @@

filter_2 how_to_vote点我复制链接,然后右击托盘小飞机图标->从剪贴板导入服务器配置链接

filter_3 再次右击托盘小飞机图标->服务器,选择一个服务器即可上网

-
+
{if $display_ios_class>=0}
account_box 公共iOS账户:
{if $user->class>=$display_ios_class} @@ -559,7 +559,7 @@
{else} -

+

visibility_off等级至少为{$display_ios_class}可见,如需升级请点击这里升级套餐。

{/if} @@ -674,10 +674,31 @@
+
flash_auto Kitsunebi订阅(普通订阅):
+
+ +
+
+
flash_auto Kitsunebi订阅(单端口节点订阅):
+
+ +
+
+
flash_auto Quantumult(Vmess订阅):
+
+ +
+
-
flash_auto Quantumult(施工中):
-
-
@@ -960,6 +981,51 @@ $(".copy-text").click(function () { $("#msg").html("已拷贝订阅链接,请您继续接下来的操作。"); }); +function Copyconfig(url,id,jumpurl="") { + $.ajax({ + url: url, + type: 'get', + async: false, + success: function(res) { + if(res) { + $("#result").modal(); + $("#msg").html("获取成功。"); + $(id).data('data', res); + console.log(res); + } else { + $("#result").modal(); + $("#msg").html("获取失败,请稍后再试"); + } + } + }); + const clipboard = new Clipboard('.copy-config', { + text: function() { + return $(id).data('data'); + } + }); + clipboard.on('success', function(e) { + $("#result").modal(); + if (jumpurl != "") { + $("#msg").html("已经复制成功,您将跳转到app设置"); + window.setTimeout(function () { + window.open(jumpurl) + }, 1000); + + } else { + + $("#msg").html("已经复制成功"); + } + } + ); + clipboard.on("error",function(e){ + console.error('Action:', e.action); + console.error('Trigger:', e.trigger); + console.error('Text:', e.text); + } + ); + +} + {if $user->transfer_enable-($user->u+$user->d) == 0} window.onload = function() { $("#result").modal();