decompile.blade.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. @extends('admin.layouts')
  2. @section('content')
  3. <div class="page-content container-fluid">
  4. <div class="panel">
  5. <div class="panel-heading">
  6. <h2 class="panel-title">反解析</h2>
  7. </div>
  8. <div class="panel-body">
  9. <div class="row">
  10. <div class="col-md-6">
  11. <textarea class="form-control" rows="25" name="content" id="content" placeholder="请填入要反解析的ShadowsocksR链接,一行一条" autofocus></textarea>
  12. </div>
  13. <div class="col-md-6">
  14. <textarea class="form-control" rows="25" name="result" id="result" readonly="readonly"></textarea>
  15. </div>
  16. <div class="col-md-6">
  17. <button class="btn btn-block btn-primary" onclick="doDecompile()">反解析</button>
  18. </div>
  19. <div class="col-md-6">
  20. <button class="btn btn-block btn-danger" onclick="doDownload()">下 载</button>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. @endsection
  27. @section('script')
  28. <script type="text/javascript">
  29. // 转换
  30. function doDecompile() {
  31. const _token = '{{csrf_token()}}';
  32. const content = $('#content').val();
  33. if (content.trim() === '') {
  34. swal.fire({title: '请填入要反解析的链接信息', type: 'warning', timer: 1000, showConfirmButton: false});
  35. return;
  36. }
  37. swal.fire({
  38. title: '确定继续反解析吗?',
  39. type: 'question',
  40. allowEnterKey: false,
  41. showCancelButton: true,
  42. cancelButtonText: '{{trans('home.ticket_close')}}',
  43. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  44. }).then((result) => {
  45. if (result.value) {
  46. $.ajax({
  47. type: "POST",
  48. url: "/admin/decompile",
  49. async: false,
  50. data: {_token: _token, content: content},
  51. dataType: 'json',
  52. success: function (ret) {
  53. if (ret.status === 'success') {
  54. $("#result").val(ret.data);
  55. } else {
  56. $("#result").val(ret.message);
  57. }
  58. }
  59. })
  60. }
  61. });
  62. return false;
  63. }
  64. // 下载
  65. function doDownload() {
  66. window.location.href = '/admin/download?type=2';
  67. }
  68. </script>
  69. @endsection