auth.blade.php 15 KB

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