auth.blade.php 15 KB

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