auth.blade.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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">{!! trans('admin.node.auth.title') !!}</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> {{ trans('common.add') }}
  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> {{ trans('model.node.id') }}</th>
  23. <th> {{ trans('model.common.type') }}</th>
  24. <th> {{ trans('model.node.name') }}</th>
  25. <th> {{ trans('model.node.domain') }}</th>
  26. <th> {!! trans('model.node_auth.key') !!}</th>
  27. <th> {{ trans('model.node_auth.secret') }}</th>
  28. <th> {{trans('common.action')}}</th>
  29. </tr>
  30. </thead>
  31. <tbody>
  32. @foreach ($authorizations as $auth)
  33. <tr>
  34. <td> {{$auth->node_id}} </td>
  35. <td> {{$auth->node->type_label}} </td>
  36. <td> {{Str::limit($auth->node->name, 20)}} </td>
  37. <td> {{$auth->node->server ?? $auth->node->ip ?? $auth->node->ipv6}} </td>
  38. <td><span class="badge badge-lg badge-info"> {{$auth->key}} </span></td>
  39. <td><span class="badge badge-lg badge-info"> {{$auth->secret}} </span></td>
  40. <td>
  41. <div class="btn-group">
  42. <button data-target="#install_{{$auth->node->type}}_{{$auth->id}}" data-toggle="modal" class="btn btn-primary">
  43. <i class="icon wb-code" aria-hidden="true"></i> {{ trans('admin.node.auth.deploy.attribute') }}
  44. </button>
  45. @can('admin.node.auth.update')
  46. <button onclick="refreshAuth('{{$auth->id}}')" class="btn btn-danger">
  47. <i class="icon wb-reload" aria-hidden="true"></i> {{ trans('admin.node.auth.reset_auth') }}
  48. </button>
  49. @endcan
  50. @can('admin.node.auth.destroy')
  51. <button onclick="deleteAuth('{{$auth->id}}')" class="btn btn-primary">
  52. <i class="icon wb-trash" aria-hidden="true"></i> {{ trans('common.delete') }}
  53. </button>
  54. @endcan
  55. </div>
  56. </td>
  57. </tr>
  58. @endforeach
  59. </tbody>
  60. </table>
  61. </div>
  62. <div class="panel-footer">
  63. <div class="row">
  64. <div class="col-sm-4">
  65. {!! trans('admin.node.auth.counts', ['num' => $authorizations->total()]) !!}
  66. </div>
  67. <div class="col-sm-8">
  68. <nav class="Page navigation float-right">
  69. {{ $authorizations->links() }}
  70. </nav>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. @foreach($authorizations as $auth)
  77. <div id="install_{{$auth->node->type}}_{{$auth->id}}" class="modal fade" tabindex="-1" data-focus-on="input:first" data-keyboard="false">
  78. <div class="modal-dialog modal-simple modal-center modal-lg">
  79. <div class="modal-content">
  80. <div class="modal-header">
  81. <button type="button" class="close" data-dismiss="modal" aria-label="{{ trans('common.close') }}">
  82. <span aria-hidden="true">×</span>
  83. </button>
  84. <h4 class="modal-title">
  85. {{ trans('admin.node.auth.deploy.title', ['type_label' => $auth->node->type_label]) }}
  86. </h4>
  87. </div>
  88. <div class="modal-body">
  89. @if($auth->node->type === 2)
  90. <div class="alert alert-info text-break">
  91. <div class="text-center red-700 mb-5">VNET-V2Ray</div>
  92. (yum install curl 2> /dev/null || apt install curl 2> /dev/null) \<br>
  93. && curl -L -s https://bit.ly/3oO3HZy \<br>
  94. | WEB_API="{{sysConfig('web_api_url') ?: sysConfig('website_url')}}" \<br>
  95. NODE_ID={{$auth->node->id}} \<br>
  96. NODE_KEY={{$auth->key}} \<br>
  97. bash
  98. <br>
  99. <br>
  100. <div class="text-center red-700 mb-5">{{ trans('admin.node.auth.deploy.command') }}</div>
  101. {{ trans('admin.node.auth.deploy.update') }}: {{ trans('admin.node.auth.deploy.same') }}
  102. <br>
  103. {{ trans('admin.node.auth.deploy.uninstall') }}: curl -L -s https://bit.ly/3oO3HZy |
  104. bash -s -- --remove
  105. <br>
  106. {{ trans('admin.node.auth.deploy.start') }}: systemctl start vnet-v2ray
  107. <br>
  108. {{ trans('admin.node.auth.deploy.stop') }}: systemctl stop vnet-v2ray
  109. <br>
  110. {{ trans('admin.node.auth.deploy.status') }}: systemctl status vnet-v2ray
  111. <br>
  112. {{ trans('admin.node.auth.deploy.recent_logs') }}: journalctl -x -n 300 --no-pager -u
  113. vnet-v2ray
  114. <br>
  115. {{ trans('admin.node.auth.deploy.real_time_logs') }}: 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">{{ trans('admin.node.auth.deploy.command') }}</div>
  128. {{ trans('admin.node.auth.deploy.update') }}: curl -L -s https://bit.ly/2HswWko | bash
  129. <br>
  130. {{ trans('admin.node.auth.deploy.uninstall') }}: curl -L -s https://mrw.so/5IHPR4 | bash
  131. <br>
  132. {{ trans('admin.node.auth.deploy.start') }}: systemctl start v2ray
  133. <br>
  134. {{ trans('admin.node.auth.deploy.stop') }}: systemctl stop v2ray
  135. <br>
  136. {{ trans('admin.node.auth.deploy.status') }}: systemctl status v2ray
  137. <br>
  138. {{ trans('admin.node.auth.deploy.recent_logs') }}: journalctl -x -n 300 --no-pager -u
  139. v2ray
  140. <br>
  141. {{ trans('admin.node.auth.deploy.real_time_logs') }}: journalctl -u v2ray -f
  142. </div>
  143. @elseif($auth->node->type === 3)
  144. @if(!$auth->node->server)
  145. <h3>
  146. {!! trans('admin.node.auth.deploy.trojan_hint', ['url' => route('admin.node.edit', $auth->node)]) !!}
  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 https://mrw.so/6cMfGy \<br>
  153. | WEB_API="{{sysConfig('web_api_url') ?: sysConfig('website_url')}}" \<br>
  154. NODE_ID={{$auth->node->id}} \<br>
  155. NODE_KEY={{$auth->key}} \<br>
  156. NODE_HOST={{$auth->node->server}} \<br>
  157. bash
  158. <br>
  159. <br>
  160. <div class="text-center red-700 mb-5">{{ trans('admin.node.auth.deploy.command') }}</div>
  161. {{ trans('admin.node.auth.deploy.update') }}: curl -L -s https://mrw.so/6cMfGy |
  162. bash
  163. <br>
  164. {{ trans('admin.node.auth.deploy.uninstall') }}: curl -L -s https://mrw.so/5ulpvu |
  165. bash
  166. <br>
  167. {{ trans('admin.node.auth.deploy.start') }}: systemctl start trojanp
  168. <br>
  169. {{ trans('admin.node.auth.deploy.stop') }}: systemctl stop trojanp
  170. <br>
  171. {{ trans('admin.node.auth.deploy.status') }}: systemctl status trojanp
  172. <br>
  173. {{ trans('admin.node.auth.deploy.recent_logs') }}: journalctl -x -n 300 --no-pager
  174. -u trojanp
  175. <br>
  176. {{ trans('admin.node.auth.deploy.real_time_logs') }}: journalctl -u trojanp -f
  177. </div>
  178. @endif
  179. @else
  180. <div class="alert alert-info text-break">
  181. <div class="text-center red-700 mb-5">VNET</div>
  182. (yum install curl 2> /dev/null || apt install curl 2> /dev/null) \<br>
  183. && curl -L -s https://bit.ly/3828OP1 \<br>
  184. | WEB_API="{{sysConfig('web_api_url') ?: sysConfig('website_url')}}" \<br>
  185. NODE_ID={{$auth->node->id}} \<br>
  186. NODE_KEY={{$auth->key}} \<br>
  187. bash
  188. <br>
  189. <br>
  190. <div class="text-center red-700 mb-5">{{ trans('admin.node.auth.deploy.command') }}</div>
  191. {{ trans('admin.node.auth.deploy.update') }}: {{ trans('admin.node.auth.deploy.same') }}
  192. <br>
  193. {{ trans('admin.node.auth.deploy.uninstall') }}: curl -L -s https://bit.ly/3828OP1 |
  194. bash -s -- --remove
  195. <br>
  196. {{ trans('admin.node.auth.deploy.start') }}: systemctl start vnet
  197. <br>
  198. {{ trans('admin.node.auth.deploy.stop') }}: systemctl stop vnet
  199. <br>
  200. {{ trans('admin.node.auth.deploy.restart') }}: systemctl restart vnet
  201. <br>
  202. {{ trans('admin.node.auth.deploy.status') }}: systemctl status vnet
  203. <br>
  204. {{ trans('admin.node.auth.deploy.recent_logs') }}: journalctl -x -n 300 --no-pager -u
  205. vnet
  206. <br>
  207. {{ trans('admin.node.auth.deploy.real_time_logs') }}: journalctl -u vnet -f
  208. </div>
  209. @endif
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. @endforeach
  215. @endsection
  216. @section('javascript')
  217. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js"></script>
  218. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
  219. <script>
  220. // 生成授权KEY
  221. @can('admin.node.auth.store')
  222. function addAuth() {
  223. swal.fire({
  224. title: '{{ trans('admin.hint') }}',
  225. text: '{{ trans('admin.node.auth.generating_all') }}',
  226. icon: 'info',
  227. showCancelButton: true,
  228. cancelButtonText: '{{ trans('common.close') }}',
  229. confirmButtonText: '{{ trans('common.confirm') }}',
  230. }).then((result) => {
  231. if (result.value) {
  232. $.post('{{route('admin.node.auth.store')}}', {_token: '{{csrf_token()}}'}, function(ret) {
  233. if (ret.status === 'success') {
  234. swal.fire({
  235. title: ret.message,
  236. icon: 'success',
  237. timer: 1000,
  238. showConfirmButton: false,
  239. }).then(() => window.location.reload());
  240. } else {
  241. swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
  242. }
  243. });
  244. }
  245. });
  246. }
  247. @endcan
  248. @can('admin.node.auth.destroy')
  249. // 删除授权
  250. function deleteAuth(id) {
  251. swal.fire({
  252. title: '{{ trans('admin.hint') }}',
  253. text: '{{ trans('admin.confirm.delete.0', ['attribute' => trans('model.node_auth.attribute')]) }}' + id +
  254. '{{ trans('admin.confirm.delete.1') }}',
  255. icon: 'info',
  256. showCancelButton: true,
  257. cancelButtonText: '{{trans('common.close')}}',
  258. confirmButtonText: '{{trans('common.confirm')}}',
  259. }).then((result) => {
  260. if (result.value) {
  261. $.ajax({
  262. method: 'DELETE',
  263. url: '{{route('admin.node.auth.destroy', '')}}/' + id,
  264. data: {_token: '{{csrf_token()}}'},
  265. dataType: 'json',
  266. success: function(ret) {
  267. if (ret.status === 'success') {
  268. swal.fire({
  269. title: ret.message,
  270. icon: 'success',
  271. timer: 1000,
  272. showConfirmButton: false,
  273. }).then(() => window.location.reload());
  274. } else {
  275. swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
  276. }
  277. },
  278. });
  279. }
  280. });
  281. }
  282. @endcan
  283. @can('admin.node.auth.update')
  284. // 重置授权认证KEY
  285. function refreshAuth(id) {
  286. swal.fire({
  287. title: '{{ trans('admin.hint') }}',
  288. text: '{{ trans('admin.confirm.continues') }}',
  289. icon: 'info',
  290. showCancelButton: true,
  291. cancelButtonText: '{{trans('common.close')}}',
  292. confirmButtonText: '{{trans('common.confirm')}}',
  293. }).then((result) => {
  294. if (result.value) {
  295. $.ajax({
  296. method: 'PUT',
  297. url: '{{route('admin.node.auth.update', '')}}/' + id,
  298. data: {_token: '{{csrf_token()}}'},
  299. dataType: 'json',
  300. success: function(ret) {
  301. if (ret.status === 'success') {
  302. swal.fire({
  303. title: ret.message,
  304. icon: 'success',
  305. timer: 1000,
  306. showConfirmButton: false,
  307. }).then(() => window.location.reload());
  308. } else {
  309. swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
  310. }
  311. },
  312. });
  313. }
  314. });
  315. }
  316. @endcan
  317. </script>
  318. @endsection