auth.blade.php 15 KB

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