auth.blade.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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.ipv4') }}</th>
  27. <th> {!! trans('model.node_auth.key') !!}</th>
  28. <th> {{ trans('model.node_auth.secret') }}</th>
  29. <th> {{trans('common.action')}}</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> {{ trans('admin.node.auth.deploy.attribute') }}
  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> {{ trans('admin.node.auth.reset_auth') }}
  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> {{ trans('common.delete') }}
  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. {!! trans('admin.node.auth.counts', ['num' => $authorizations->total()]) !!}
  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="{{ trans('common.close') }}">
  84. <span aria-hidden="true">×</span>
  85. </button>
  86. <h4 class="modal-title">
  87. {{ trans('admin.node.auth.deploy.title', ['type_label' => $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">{{ trans('admin.node.auth.deploy.command') }}</div>
  103. {{ trans('admin.node.auth.deploy.update') }}: {{ trans('admin.node.auth.deploy.same') }}
  104. <br>
  105. {{ trans('admin.node.auth.deploy.uninstall') }}: curl -L -s https://bit.ly/3oO3HZy |
  106. bash -s -- --remove
  107. <br>
  108. {{ trans('admin.node.auth.deploy.start') }}: systemctl start vnet-v2ray
  109. <br>
  110. {{ trans('admin.node.auth.deploy.stop') }}: systemctl stop vnet-v2ray
  111. <br>
  112. {{ trans('admin.node.auth.deploy.status') }}: systemctl status vnet-v2ray
  113. <br>
  114. {{ trans('admin.node.auth.deploy.recent_logs') }}: journalctl -x -n 300 --no-pager -u
  115. vnet-v2ray
  116. <br>
  117. {{ trans('admin.node.auth.deploy.real_time_logs') }}: 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={{$auth->node->id}} \<br>
  125. NODE_KEY={{$auth->key}} \<br>
  126. bash
  127. <br>
  128. <br>
  129. <div class="text-center red-700 mb-5">{{ trans('admin.node.auth.deploy.command') }}</div>
  130. {{ trans('admin.node.auth.deploy.update') }}: curl -L -s https://bit.ly/2HswWko | bash
  131. <br>
  132. {{ trans('admin.node.auth.deploy.uninstall') }}: curl -L -s https://mrw.so/5IHPR4 | bash
  133. <br>
  134. {{ trans('admin.node.auth.deploy.start') }}: systemctl start v2ray
  135. <br>
  136. {{ trans('admin.node.auth.deploy.stop') }}: systemctl stop v2ray
  137. <br>
  138. {{ trans('admin.node.auth.deploy.status') }}: systemctl status v2ray
  139. <br>
  140. {{ trans('admin.node.auth.deploy.recent_logs') }}: journalctl -x -n 300 --no-pager -u
  141. v2ray
  142. <br>
  143. {{ trans('admin.node.auth.deploy.real_time_logs') }}: journalctl -u v2ray -f
  144. </div>
  145. @elseif($auth->node->type === 3)
  146. @if(!$auth->node->server)
  147. <h3>
  148. {!! trans('admin.node.auth.deploy.trojan_hint', ['url' => route('admin.node.edit', $auth->node)]) !!}
  149. </h3>
  150. @else
  151. <div class="alert alert-info text-break">
  152. <div class="text-center red-700 mb-5">Trojan-Poseidon</div>
  153. (yum install curl 2> /dev/null || apt install curl 2> /dev/null) \<br>
  154. && curl -L -s https://mrw.so/6cMfGy \<br>
  155. | WEB_API="{{sysConfig('web_api_url') ?: sysConfig('website_url')}}" \<br>
  156. NODE_ID={{$auth->node->id}} \<br>
  157. NODE_KEY={{$auth->key}} \<br>
  158. NODE_HOST={{$auth->node->server}} \<br>
  159. bash
  160. <br>
  161. <br>
  162. <div class="text-center red-700 mb-5">{{ trans('admin.node.auth.deploy.command') }}</div>
  163. {{ trans('admin.node.auth.deploy.update') }}: curl -L -s https://mrw.so/6cMfGy |
  164. bash
  165. <br>
  166. {{ trans('admin.node.auth.deploy.uninstall') }}: curl -L -s https://mrw.so/5ulpvu |
  167. bash
  168. <br>
  169. {{ trans('admin.node.auth.deploy.start') }}: systemctl start trojanp
  170. <br>
  171. {{ trans('admin.node.auth.deploy.stop') }}: systemctl stop trojanp
  172. <br>
  173. {{ trans('admin.node.auth.deploy.status') }}: systemctl status trojanp
  174. <br>
  175. {{ trans('admin.node.auth.deploy.recent_logs') }}: journalctl -x -n 300 --no-pager
  176. -u trojanp
  177. <br>
  178. {{ trans('admin.node.auth.deploy.real_time_logs') }}: journalctl -u trojanp -f
  179. </div>
  180. @endif
  181. @else
  182. <div class="alert alert-info text-break">
  183. <div class="text-center red-700 mb-5">VNET</div>
  184. (yum install curl 2> /dev/null || apt install curl 2> /dev/null) \<br>
  185. && curl -L -s https://bit.ly/3828OP1 \<br>
  186. | WEB_API="{{sysConfig('web_api_url') ?: sysConfig('website_url')}}" \<br>
  187. NODE_ID={{$auth->node->id}} \<br>
  188. NODE_KEY={{$auth->key}} \<br>
  189. bash
  190. <br>
  191. <br>
  192. <div class="text-center red-700 mb-5">{{ trans('admin.node.auth.deploy.command') }}</div>
  193. {{ trans('admin.node.auth.deploy.update') }}: {{ trans('admin.node.auth.deploy.same') }}
  194. <br>
  195. {{ trans('admin.node.auth.deploy.uninstall') }}: curl -L -s https://bit.ly/3828OP1 |
  196. bash -s -- --remove
  197. <br>
  198. {{ trans('admin.node.auth.deploy.start') }}: systemctl start vnet
  199. <br>
  200. {{ trans('admin.node.auth.deploy.stop') }}: systemctl stop vnet
  201. <br>
  202. {{ trans('admin.node.auth.deploy.restart') }}: systemctl restart vnet
  203. <br>
  204. {{ trans('admin.node.auth.deploy.status') }}: systemctl status vnet
  205. <br>
  206. {{ trans('admin.node.auth.deploy.recent_logs') }}: journalctl -x -n 300 --no-pager -u
  207. vnet
  208. <br>
  209. {{ trans('admin.node.auth.deploy.real_time_logs') }}: journalctl -u vnet -f
  210. </div>
  211. @endif
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. @endforeach
  217. @endsection
  218. @section('javascript')
  219. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js"></script>
  220. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
  221. <script>
  222. // 生成授权KEY
  223. @can('admin.node.auth.store')
  224. function addAuth() {
  225. swal.fire({
  226. title: '{{ trans('admin.hint') }}',
  227. text: '{{ trans('admin.node.auth.generating_all') }}',
  228. icon: 'info',
  229. showCancelButton: true,
  230. cancelButtonText: '{{ trans('common.close') }}',
  231. confirmButtonText: '{{ trans('common.confirm') }}',
  232. }).then((result) => {
  233. if (result.value) {
  234. $.post('{{route('admin.node.auth.store')}}', {_token: '{{csrf_token()}}'}, function(ret) {
  235. if (ret.status === 'success') {
  236. swal.fire({
  237. title: ret.message,
  238. icon: 'success',
  239. timer: 1000,
  240. showConfirmButton: false,
  241. }).then(() => window.location.reload());
  242. } else {
  243. swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
  244. }
  245. });
  246. }
  247. });
  248. }
  249. @endcan
  250. @can('admin.node.auth.destroy')
  251. // 删除授权
  252. function deleteAuth(id) {
  253. swal.fire({
  254. title: '{{ trans('admin.hint') }}',
  255. text: '{{ trans('admin.confirm.delete.0', ['attribute' => trans('model.node_auth.attribute')]) }}' + id +
  256. '{{ trans('admin.confirm.delete.1') }}',
  257. icon: 'info',
  258. showCancelButton: true,
  259. cancelButtonText: '{{trans('common.close')}}',
  260. confirmButtonText: '{{trans('common.confirm')}}',
  261. }).then((result) => {
  262. if (result.value) {
  263. $.ajax({
  264. method: 'DELETE',
  265. url: '{{route('admin.node.auth.destroy', '')}}/' + id,
  266. data: {_token: '{{csrf_token()}}'},
  267. dataType: 'json',
  268. success: function(ret) {
  269. if (ret.status === 'success') {
  270. swal.fire({
  271. title: ret.message,
  272. icon: 'success',
  273. timer: 1000,
  274. showConfirmButton: false,
  275. }).then(() => window.location.reload());
  276. } else {
  277. swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
  278. }
  279. },
  280. });
  281. }
  282. });
  283. }
  284. @endcan
  285. @can('admin.node.auth.update')
  286. // 重置授权认证KEY
  287. function refreshAuth(id) {
  288. swal.fire({
  289. title: '{{ trans('admin.hint') }}',
  290. text: '{{ trans('admin.confirm.continues') }}',
  291. icon: 'info',
  292. showCancelButton: true,
  293. cancelButtonText: '{{trans('common.close')}}',
  294. confirmButtonText: '{{trans('common.confirm')}}',
  295. }).then((result) => {
  296. if (result.value) {
  297. $.ajax({
  298. method: 'PUT',
  299. url: '{{route('admin.node.auth.update', '')}}/' + id,
  300. data: {_token: '{{csrf_token()}}'},
  301. dataType: 'json',
  302. success: function(ret) {
  303. if (ret.status === 'success') {
  304. swal.fire({
  305. title: ret.message,
  306. icon: 'success',
  307. timer: 1000,
  308. showConfirmButton: false,
  309. }).then(() => window.location.reload());
  310. } else {
  311. swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
  312. }
  313. },
  314. });
  315. }
  316. });
  317. }
  318. @endcan
  319. </script>
  320. @endsection