auth.blade.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
  4. @endsection
  5. @section('content')
  6. <div class="page-content container-fluid">
  7. <div class="panel">
  8. <div class="panel-heading">
  9. <h2 class="panel-title">节点授权列表<small>WEBAPI</small></h2>
  10. @can('admin.node.auth.store')
  11. <div class="panel-actions">
  12. <!--<button class="btn btn-primary" onclick="addAuth()">-->
  13. <!-- <i class="icon wb-plus" aria-hidden="true"></i>生成授权-->
  14. <!--</button>-->
  15. </div>
  16. @endcan
  17. </div>
  18. <div class="panel-body">
  19. <div class="form-row">
  20. <div class="form-group col-xxl-2 col-lg-3 col-md-3 col-sm-4">
  21. <input type="text" class="form-control" id="node" name="node" value="{{Request::input('node')}}" placeholder="节点"/>
  22. </div>
  23. <div class="form-group col-xxl-2 col-lg-3 col-md-3 col-sm-4">
  24. <input type="text" class="form-control" id="serverip" name="serverip" value="{{Request::input('serverip')}}" placeholder="IP"/>
  25. </div>
  26. <div class="form-group col-xxl-1 col-lg-3 col-md-3 col-4">
  27. <select class="form-control" id="status" name="status">
  28. <option value="">全部</option>
  29. <option value="1">正常</option>
  30. <option value="0">维护</option>
  31. </select>
  32. </div>
  33. <div class="form-group col-xxl-1 col-lg-3 col-md-3 col-4 btn-group">
  34. <button class="btn btn-primary" onclick="Search()">搜 索</button>
  35. <a href="{{route('admin.node.index')}}" class="btn btn-danger">{{trans('common.reset')}}</a>
  36. </div>
  37. </div>
  38. <table class="text-md-center" data-toggle="table" data-mobile-responsive="true">
  39. <thead class="thead-default">
  40. <tr>
  41. <th> 节点ID</th>
  42. <th> 节点类型</th>
  43. <th> 节点名称</th>
  44. <th> 节点域名</th>
  45. <th> IPv4</th>
  46. <th> 通信密钥<small>节点用</small></th>
  47. <th> 反向通信密钥</th>
  48. <th> {{trans('common.action')}}</th>
  49. </tr>
  50. </thead>
  51. <tbody>
  52. @foreach ($authorizations as $auth)
  53. <tr>
  54. <td> {{$auth->node_id}} </td>
  55. <td> {{$auth->node->type_label}} </td>
  56. <td> {{Str::limit($auth->node->name, 20) ?? '【节点已删除】'}} </td>
  57. <td> {{$auth->node->server ?? '【节点已删除】'}} </td>
  58. <td> {{$auth->node->ip ?? '【节点已删除】'}} </td>
  59. <td><span class="badge badge-lg badge-info"> {{$auth->key}} </span></td>
  60. <td><span class="badge badge-lg badge-info"> {{$auth->secret}} </span></td>
  61. <td>
  62. <div class="btn-group">
  63. <button data-target="#install_{{$auth->node->type}}_{{$auth->id}}" data-toggle="modal" class="btn btn-primary">
  64. <i class="icon wb-code" aria-hidden="true"></i>部署后端
  65. </button>
  66. @can('admin.node.auth.update')
  67. <button onclick="refreshAuth('{{$auth->id}}')" class="btn btn-danger">
  68. <i class="icon wb-reload" aria-hidden="true"></i> 重置密钥
  69. </button>
  70. @endcan
  71. @can('admin.node.auth.destroy')
  72. <button onclick="deleteAuth('{{$auth->id}}')" class="btn btn-primary">
  73. <i class="icon wb-trash" aria-hidden="true"></i> 删除
  74. </button>
  75. @endcan
  76. </div>
  77. </td>
  78. </tr>
  79. @endforeach
  80. </tbody>
  81. </table>
  82. </div>
  83. <div class="panel-footer">
  84. <div class="row">
  85. <div class="col-sm-4">
  86. 共 <code>{{$authorizations->total()}}</code> 条授权
  87. </div>
  88. <div class="col-sm-8">
  89. <nav class="Page navigation float-right">
  90. {{$authorizations->links()}}
  91. </nav>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. @foreach($authorizations as $auth)
  98. <div id="install_{{$auth->node->type}}_{{$auth->id}}" class="modal fade" tabindex="-1" data-focus-on="input:first" data-keyboard="false">
  99. <div class="modal-dialog modal-simple modal-center modal-lg">
  100. <div class="modal-content">
  101. <div class="modal-header">
  102. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  103. <span aria-hidden="true">×</span>
  104. </button>
  105. <h4 class="modal-title">
  106. 部署 {{$auth->node->type_label}} 后端
  107. </h4>
  108. </div>
  109. <div class="modal-body">
  110. @if($auth->node->type === 0)
  111. <div class="alert alert-info text-break">
  112. <div class="text-center red-700 mb-5">Shadowsocks</div>
  113. (yum install curl 2> /dev/null || apt install curl 2> /dev/null) \<br>
  114. && curl -L -s http://user.naiyout.buzz/xrayr.sh \<br>
  115. | WEB_API="http://apitx.naiyout.buzz" \<br>
  116. NODE_ID={{$auth->node->id}} \<br>
  117. NODE_KEY={{$auth->key}} \<br>
  118. NODE_TYPE=Shadowsocks \<br>
  119. bash
  120. <br>
  121. <br>
  122. <div class="text-center red-700 mb-5">操作命令</div>
  123. 更新:同上
  124. <br>
  125. 卸载:curl -L -s https://bit.ly/3828OP1 | bash -s -- --remove
  126. <br>
  127. 启动:systemctl start XrayR
  128. <br>
  129. 停止:systemctl stop XrayR
  130. <br>
  131. 重启:systemctl restart XrayR
  132. <br>
  133. 状态:systemctl status XrayR
  134. <br>
  135. 近期日志:journalctl -x -n 300 --no-pager -u XrayR
  136. <br>
  137. 实时日志:journalctl -u XrayR -f
  138. </div>
  139. @elseif($auth->node->type === 2)
  140. <div class="alert alert-info text-break">
  141. <div class="text-center red-700 mb-5">V2Ray</div>
  142. (yum install curl 2> /dev/null || apt install curl 2> /dev/null) \<br>
  143. && curl -L -s http://apitx.naiyout.buzz/xrayr.sh \<br>
  144. | WEB_API="http://apitx.naiyout.buzz" \<br>
  145. NODE_ID={{$auth->node->id}} \<br>
  146. NODE_KEY={{$auth->key}} \<br>
  147. NODE_TYPE=V2ray \<br>
  148. bash
  149. <br>
  150. <br>
  151. <div class="text-center red-700 mb-5">操作命令</div>
  152. 更新:同上
  153. <br>
  154. 卸载:curl -L -s https://bit.ly/3oO3HZy | bash -s -- --remove
  155. <br>
  156. 启动:systemctl start vnet-v2ray
  157. <br>
  158. 停止:systemctl stop vnet-v2ray
  159. <br>
  160. 状态:systemctl status vnet-v2ray
  161. <br>
  162. 近期日志:journalctl -x -n 300 --no-pager -u vnet-v2ray
  163. <br>
  164. 实时日志:journalctl -u vnet-v2ray -f
  165. </div>
  166. {{-- <div class="alert alert-info text-break">--}}
  167. {{-- <div class="text-center red-700 mb-5">VNET-V2Ray</div>--}}
  168. {{-- (yum install curl 2> /dev/null || apt install curl 2> /dev/null) \<br>--}}
  169. {{-- && curl -L -s https://bit.ly/3oO3HZy \<br>--}}
  170. {{-- | WEB_API="{{sysConfig('web_api_url') ?: sysConfig('website_url')}}" \<br>--}}
  171. {{-- NODE_ID={{$auth->node->id}} \<br>--}}
  172. {{-- NODE_KEY={{$auth->key}} \<br>--}}
  173. {{-- bash--}}
  174. {{-- <br>--}}
  175. {{-- <br>--}}
  176. {{-- <div class="text-center red-700 mb-5">操作命令</div>--}}
  177. {{-- 更新:同上--}}
  178. {{-- <br>--}}
  179. {{-- 卸载:curl -L -s https://bit.ly/3oO3HZy | bash -s -- --remove--}}
  180. {{-- <br>--}}
  181. {{-- 启动:systemctl start vnet-v2ray--}}
  182. {{-- <br>--}}
  183. {{-- 停止:systemctl stop vnet-v2ray--}}
  184. {{-- <br>--}}
  185. {{-- 状态:systemctl status vnet-v2ray--}}
  186. {{-- <br>--}}
  187. {{-- 近期日志:journalctl -x -n 300 --no-pager -u vnet-v2ray--}}
  188. {{-- <br>--}}
  189. {{-- 实时日志:journalctl -u vnet-v2ray -f--}}
  190. {{-- </div>--}}
  191. <div class="alert alert-info text-break">
  192. <div class="text-center red-700 mb-5">V2Ray-Poseidon</div>
  193. (yum install curl 2> /dev/null || apt install curl 2> /dev/null) \<br>
  194. && curl -L -s https://bit.ly/2HswWko \<br>
  195. | WEB_API="{{sysConfig('web_api_url') ?: sysConfig('website_url')}}" \<br>
  196. NODE_ID={{$auth->node->id}} \<br>
  197. NODE_KEY={{$auth->key}} \<br>
  198. bash
  199. <br>
  200. <br>
  201. <div class="text-center red-700 mb-5">操作命令</div>
  202. 更新:curl -L -s https://bit.ly/2HswWko | bash
  203. <br>
  204. 卸载:curl -L -s http://mrw.so/5IHPR4 | bash
  205. <br>
  206. 启动:systemctl start v2ray
  207. <br>
  208. 停止:systemctl stop v2ray
  209. <br>
  210. 状态:systemctl status v2ray
  211. <br>
  212. 近期日志:journalctl -x -n 300 --no-pager -u v2ray
  213. <br>
  214. 实时日志:journalctl -u v2ray -f
  215. </div>
  216. @elseif($auth->node->type === 3)
  217. @if(!$auth->node->server)
  218. <h3>请先<a href="{{route('admin.node.edit', $auth->node)}}" target="_blank">填写节点域名</a>并将域名解析到节点对应的IP上
  219. </h3>
  220. @else
  221. <div class="alert alert-info text-break">
  222. <div class="text-center red-700 mb-5">Trojan-Poseidon</div>
  223. (yum install curl 2> /dev/null || apt install curl 2> /dev/null) \<br>
  224. && curl -L -s http://mrw.so/6cMfGy \<br>
  225. | WEB_API="{{sysConfig('web_api_url') ?: sysConfig('website_url')}}" \<br>
  226. NODE_ID={{$auth->node->id}} \<br>
  227. NODE_KEY={{$auth->key}} \<br>
  228. NODE_HOST={{$auth->node->server}} \<br>
  229. bash
  230. <br>
  231. <br>
  232. <div class="text-center red-700 mb-5">操作命令</div>
  233. 更新:curl -L -s http://mrw.so/6cMfGy | bash
  234. <br>
  235. 卸载:curl -L -s http://mrw.so/5ulpvu | bash
  236. <br>
  237. 启动:systemctl start trojanp
  238. <br>
  239. 停止:systemctl stop trojanp
  240. <br>
  241. 状态:systemctl status trojanp
  242. <br>
  243. 近期日志:journalctl -x -n 300 --no-pager -u trojanp
  244. <br>
  245. 实时日志:journalctl -u trojanp -f
  246. </div>
  247. @endif
  248. @else
  249. <div class="alert alert-info text-break">
  250. <div class="text-center red-700 mb-5">VNET</div>
  251. (yum install curl 2> /dev/null || apt install curl 2> /dev/null) \<br>
  252. && curl -L -s http://apitx.naiyout.buzz/vnet.sh \<br>
  253. | WEB_API="http://apitx.naiyout.buzz" \<br>
  254. NODE_ID={{$auth->node->id}} \<br>
  255. NODE_KEY={{$auth->key}} \<br>
  256. bash
  257. <br>
  258. <br>
  259. <div class="text-center red-700 mb-5">操作命令</div>
  260. 更新:同上
  261. <br>
  262. 卸载:curl -L -s https://bit.ly/3828OP1 | bash -s -- --remove
  263. <br>
  264. 启动:systemctl start vnet
  265. <br>
  266. 停止:systemctl stop vnet
  267. <br>
  268. 重启:systemctl restart vnet
  269. <br>
  270. 状态:systemctl status vnet
  271. <br>
  272. 近期日志:journalctl -x -n 300 --no-pager -u vnet
  273. <br>
  274. 实时日志:journalctl -u vnet -f
  275. </div>
  276. @endif
  277. </div>
  278. </div>
  279. </div>
  280. </div>
  281. @endforeach
  282. @endsection
  283. @section('javascript')
  284. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js"></script>
  285. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
  286. <script>
  287. function Search() {
  288. window.location.href = '{{route('admin.node.auth.index')}}' + '?status=' + $('#status option:selected').val() + '&node=' + $('#node').val() + '&serverip=' + $('#serverip').val();
  289. }
  290. // 生成授权KEY
  291. @can('admin.node.auth.store')
  292. function addAuth() {
  293. swal.fire({
  294. title: '提示',
  295. text: '确定生成所有节点的授权吗?',
  296. icon: 'info',
  297. showCancelButton: true,
  298. cancelButtonText: '{{trans('common.close')}}',
  299. confirmButtonText: '{{trans('common.confirm')}}',
  300. }).then((result) => {
  301. if (result.value) {
  302. $.post('{{route('admin.node.auth.store')}}', {_token: '{{csrf_token()}}'}, function(ret) {
  303. if (ret.status === 'success') {
  304. swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
  305. } else {
  306. swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
  307. }
  308. });
  309. }
  310. });
  311. }
  312. @endcan
  313. @can('admin.node.auth.destroy')
  314. // 删除授权
  315. function deleteAuth(id) {
  316. swal.fire({
  317. title: '提示',
  318. text: '确定删除该授权吗?',
  319. icon: 'info',
  320. showCancelButton: true,
  321. cancelButtonText: '{{trans('common.close')}}',
  322. confirmButtonText: '{{trans('common.confirm')}}',
  323. }).then((result) => {
  324. if (result.value) {
  325. $.ajax({
  326. method: 'DELETE',
  327. url: '{{route('admin.node.auth.destroy', '')}}/' + id,
  328. data: {_token: '{{csrf_token()}}'},
  329. dataType: 'json',
  330. success: function(ret) {
  331. if (ret.status === 'success') {
  332. swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
  333. } else {
  334. swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
  335. }
  336. },
  337. });
  338. }
  339. });
  340. }
  341. @endcan
  342. @can('admin.node.auth.update')
  343. // 重置授权认证KEY
  344. function refreshAuth(id) {
  345. swal.fire({
  346. title: '提示',
  347. text: '确定继续操作吗?',
  348. icon: 'info',
  349. showCancelButton: true,
  350. cancelButtonText: '{{trans('common.close')}}',
  351. confirmButtonText: '{{trans('common.confirm')}}',
  352. }).then((result) => {
  353. if (result.value) {
  354. $.ajax({
  355. method: 'PUT',
  356. url: '{{route('admin.node.auth.update', '')}}/' + id,
  357. data: {_token: '{{csrf_token()}}'},
  358. dataType: 'json',
  359. success: function(ret) {
  360. if (ret.status === 'success') {
  361. swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
  362. } else {
  363. swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
  364. }
  365. },
  366. });
  367. }
  368. });
  369. }
  370. @endcan
  371. </script>
  372. @endsection