convert.blade.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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">格式转换
  7. <small>Shadowsocks 转 ShadowsocksR</small>
  8. </h2>
  9. </div>
  10. <div class="panel-body">
  11. <div class="row">
  12. <div class="col-md-4 form-group">
  13. <label for="method">加密方式</label>
  14. <select class="form-control" name="method" id="method">
  15. @foreach ($method_list as $method)
  16. <option value="{{$method->name}}" @if($method->is_default) selected @endif>{{$method->name}}</option>
  17. @endforeach
  18. </select>
  19. </div>
  20. <div class="col-md-4 form-group">
  21. <label for="transfer_enable">可用流量</label>
  22. <div class="input-group">
  23. <input type="number" class="form-control" name="transfer_enable" value="1000" id="transfer_enable" placeholder="" required>
  24. <span class="input-group-text">GB</span>
  25. </div>
  26. </div>
  27. <div class="col-md-4 form-group">
  28. <label for="protocol">协议</label>
  29. <select class="form-control" name="protocol" id="protocol">
  30. @foreach ($protocol_list as $protocol)
  31. <option value="{{$protocol->name}}" @if($protocol->is_default) selected @endif>{{$protocol->name}}</option>
  32. @endforeach
  33. </select>
  34. </div>
  35. <div class="col-md-4 form-group">
  36. <label for="protocol_param">协议参数</label>
  37. <input type="text" class="form-control" name="protocol_param" id="protocol_param" placeholder="">
  38. </div>
  39. <div class="col-md-4 form-group">
  40. <label for="obfs">混淆</label>
  41. <select class="form-control" name="obfs" id="obfs">
  42. @foreach ($obfs_list as $obfs)
  43. <option value="{{$obfs->name}}" @if($obfs->is_default) selected @endif>{{$obfs->name}}</option>
  44. @endforeach
  45. </select>
  46. </div>
  47. <div class="col-md-4 form-group">
  48. <label for="obfs_param">混淆参数</label>
  49. <input type="text" class="form-control" name="obfs_param" id="obfs_param" placeholder="">
  50. </div>
  51. <div class="col-md-6">
  52. <textarea class="form-control" rows="22" name="content" id="content" placeholder="请填入要转换的配置信息" autofocus></textarea>
  53. </div>
  54. <div class="col-md-6">
  55. <textarea class="form-control" rows="22" name="result" id="result" onclick="this.focus();this.select()" readonly="readonly"></textarea>
  56. </div>
  57. <div class="col-md-6">
  58. <button class="btn btn-block btn-primary" onclick="Convert()">转 换</button>
  59. </div>
  60. <div class="col-md-6">
  61. <a href="/admin/download?type=1" class="btn btn-block btn-danger">下 载</a>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. @endsection
  68. @section('script')
  69. <script type="text/javascript">
  70. // 转换
  71. function Convert() {
  72. const content = $('#content').val();
  73. if (content.trim() === '') {
  74. swal.fire({title: '请填入要转换的配置信息', type: 'warning', timer: 1000, showConfirmButton: false});
  75. return;
  76. }
  77. swal.fire({
  78. title: '确定继续转换吗?',
  79. type: 'question',
  80. allowEnterKey: false,
  81. showCancelButton: true,
  82. cancelButtonText: '{{trans('home.ticket_close')}}',
  83. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  84. }).then((result) => {
  85. if (result.value) {
  86. $.ajax({
  87. type: "POST",
  88. url: "/admin/convert",
  89. async: false,
  90. data: {
  91. _token: '{{csrf_token()}}',
  92. method: $('#method').val(),
  93. transfer_enable: $('#transfer_enable').val(),
  94. protocol: $('#protocol').val(),
  95. protocol_param: $('#protocol_param').val(),
  96. obfs: $('#obfs').val(),
  97. obfs_param: $('#obfs_param').val(),
  98. content: content
  99. },
  100. dataType: 'json',
  101. success: function (ret) {
  102. if (ret.status === 'success') {
  103. $("#result").val(ret.data);
  104. } else {
  105. $("#result").val(ret.message);
  106. }
  107. }
  108. })
  109. }
  110. });
  111. return false;
  112. }
  113. </script>
  114. @endsection