info.blade.php 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link href="/assets/global/vendor/bootstrap-select/bootstrap-select.min.css" rel="stylesheet">
  4. <link href="/assets/global/vendor/switchery/switchery.min.css" rel="stylesheet">
  5. <style>
  6. .hidden {
  7. display: none
  8. }
  9. </style>
  10. @endsection
  11. @section('content')
  12. <div class="page-content container-fluid">
  13. <div class="panel">
  14. <div class="panel-heading">
  15. <h2 class="panel-title">
  16. {{ isset($node) ? trans('admin.action.edit_item', ['attribute' => trans('model.node.attribute')]) : trans('admin.action.add_item', ['attribute' => trans('model.node.attribute')]) }}
  17. </h2>
  18. </div>
  19. <div class="alert alert-info" role="alert">
  20. <button class="close" data-dismiss="alert" aria-label="{{ trans('common.close') }}">
  21. <span aria-hidden="true">&times;</span>
  22. <span class="sr-only">{{trans('common.close')}}</span>
  23. </button>
  24. {!! trans('admin.node.info.hint') !!}
  25. </div>
  26. <div class="panel-body">
  27. <form class="form-horizontal" onsubmit="return Submit()">
  28. <div class="row">
  29. <div class="col-lg-6">
  30. <div class="example-wrap">
  31. <h4 class="example-title">{{ trans('admin.node.info.basic') }}</h4>
  32. <div class="example">
  33. <div class="form-group row">
  34. <label for="is_ddns" class="col-md-3 col-form-label">{{ trans('model.node.ddns') }}</label>
  35. <div class="col-md-9">
  36. <input type="checkbox" id="is_ddns" name="is_ddns" data-plugin="switchery" onchange="switchSetting('is_ddns')">
  37. </div>
  38. <div class="text-help offset-md-3">
  39. {!! trans('admin.node.info.ddns_hint') !!}
  40. </div>
  41. </div>
  42. <div class="form-group row">
  43. <label for="name" class="col-md-3 col-form-label"> {{ trans('model.node.name') }} </label>
  44. <input type="text" class="form-control col-md-4" name="name" id="name" required>
  45. </div>
  46. <div class="form-group row">
  47. <label for="server" class="col-md-3 col-form-label"> {{ trans('model.node.domain') }} </label>
  48. <input type="text" class="form-control col-md-4" name="server" id="server" placeholder="{{ trans('admin.node.info.domain_placeholder') }}">
  49. <span class="text-help offset-md-3">{{ trans('admin.node.info.domain_hint') }}</span>
  50. </div>
  51. <div class="form-group row">
  52. <label for="ip" class="col-md-3 col-form-label"> {{ trans('model.node.ipv4') }} </label>
  53. <input type="text" class="form-control col-md-4" name="ip" id="ip" placeholder="{{ trans('admin.node.info.ipv4_placeholder') }}" required>
  54. <span class="text-help offset-md-3">{{ trans('admin.node.info.ipv4_hint') }}</span>
  55. </div>
  56. <div class="form-group row">
  57. <label for="ipv6" class="col-md-3 col-form-label"> {{ trans('model.node.ipv6') }} </label>
  58. <input type="text" class="form-control col-md-4" name="ipv6" id="ipv6" placeholder="{{ trans('admin.node.info.ipv6_placeholder') }}">
  59. <span class="text-help offset-md-3">{{ trans('admin.node.info.ipv6_hint') }}</span>
  60. </div>
  61. <div class="form-group row">
  62. <label for="push_port" class="col-md-3 col-form-label"> {{ trans('model.node.push_port') }} </label>
  63. <input type="number" class="form-control col-md-4" name="push_port" value="1080" id="push_port">
  64. <span class="text-help offset-md-3">{{ trans('admin.node.info.push_port_hint') }}</span>
  65. </div>
  66. <div class="form-group row">
  67. <label for="traffic_rate" class="col-md-3 col-form-label"> {{ trans('model.node.data_rate') }} </label>
  68. <input type="number" class="form-control col-md-4" name="traffic_rate" value="1.0" id="traffic_rate" step="0.01" required>
  69. <div class="text-help offset-md-3">{{ trans('admin.node.info.data_rate_hint') }}</div>
  70. </div>
  71. <div class="form-group row">
  72. <label for="level" class="col-md-3 col-form-label">{{ trans('model.common.level') }}</label>
  73. <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control show-tick" id="level" name="level">
  74. @foreach($levels as $level)
  75. <option value="{{$level->level}}">{{$level->name}}</option>
  76. @endforeach
  77. </select>
  78. <div class="text-help offset-md-3"> {{ trans('admin.node.info.level_hint') }}</div>
  79. </div>
  80. <div class="form-group row">
  81. <label for="ruleGroup" class="col-md-3 col-form-label">{{ trans('model.node.rule_group') }}</label>
  82. <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control show-tick"
  83. id="ruleGroup" name="ruleGroup">
  84. <option value="">{{ trans('common.none') }}</option>
  85. @foreach($ruleGroups as $ruleGroup)
  86. <option value="{{$ruleGroup->id}}">{{$ruleGroup->name}}</option>
  87. @endforeach
  88. </select>
  89. </div>
  90. <div class="form-group row">
  91. <label for="speed_limit" class="col-md-3 col-form-label">{{ trans('model.node.traffic_limit') }}</label>
  92. <div class="col-md-4 input-group p-0">
  93. <input type="number" class="form-control" id="speed_limit" name="speed_limit" value="1000" required>
  94. <span class="input-group-text">Mbps</span>
  95. </div>
  96. </div>
  97. <div class="form-group row">
  98. <label for="client_limit" class="col-md-3 col-form-label">{{ trans('model.node.client_limit') }}</label>
  99. <input type="number" class="form-control col-md-4" id="client_limit" name="client_limit" value="1000" required>
  100. </div>
  101. <div class="form-group row">
  102. <label for="labels" class="col-md-3 col-form-label">{{ trans('model.node.label') }}</label>
  103. <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control show-tick" id="labels" name="labels"
  104. multiple>
  105. @foreach($labels as $label)
  106. <option value="{{$label->id}}">{{$label->name}}</option>
  107. @endforeach
  108. </select>
  109. </div>
  110. <div class="form-group row">
  111. <label for="country_code" class="col-md-3 col-form-label"> {{ trans('model.node.country') }} </label>
  112. <select data-plugin="selectpicker" data-style="btn-outline btn-primary"
  113. class="col-md-5 form-control" name="country_code" id="country_code">
  114. @foreach($countries as $country)
  115. <option value="{{$country->code}}">{{$country->code}} - {{$country->name}}</option>
  116. @endforeach
  117. </select>
  118. </div>
  119. <div class="form-group row">
  120. <label for="description" class="col-md-3 col-form-label"> {{ trans('model.common.description') }} </label>
  121. <input type="text" class="form-control col-md-6" name="description" id="description">
  122. </div>
  123. <div class="form-group row">
  124. <label for="sort" class="col-md-3 col-form-label">{{ trans('model.common.sort') }}</label>
  125. <input type="text" class="form-control col-md-4" name="sort" id="sort" value="1" required/>
  126. <div class="text-help offset-md-3"> {{ trans('admin.sort_asc') }}</div>
  127. </div>
  128. <div class="form-group row">
  129. <label for="is_udp" class="col-md-3 col-form-label">{{ trans('model.node.udp') }}</label>
  130. <div class="col-md-9">
  131. <input type="checkbox" id="is_udp" name="is_udp" data-plugin="switchery">
  132. </div>
  133. </div>
  134. <div class="form-group row">
  135. <label for="status" class="col-md-3 col-form-label">{{ trans('common.status.attribute') }}</label>
  136. <div class="col-md-9">
  137. <input type="checkbox" id="status" name="status" data-plugin="switchery">
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. <div class="col-lg-6">
  144. <div class="example-wrap">
  145. <h4 class="example-title">{{ trans('admin.node.info.extend') }}</h4>
  146. <div class="example">
  147. <div class="form-group row">
  148. <label for="is_display" class="col-md-3 col-form-label">{{ trans('model.node.display') }}</label>
  149. <ul class="col-md-9 list-unstyled list-inline">
  150. <li class="list-inline-item">
  151. <div class="radio-custom radio-primary">
  152. <input type="radio" id="invisible" name="is_display" value="0" checked/>
  153. <label for="invisible">{{ trans('admin.node.info.display.invisible') }}</label>
  154. </div>
  155. </li>
  156. <li class="list-inline-item">
  157. <div class="radio-custom radio-primary">
  158. <input type="radio" id="page_only" name="is_display" value="1"/>
  159. <label for="page_only">{{ trans('admin.node.info.display.node') }}</label>
  160. </div>
  161. </li>
  162. <li class="list-inline-item">
  163. <div class="radio-custom radio-primary">
  164. <input type="radio" id="sub_only" name="is_display" value="2"/>
  165. <label for="sub_only">{{ trans('admin.node.info.display.sub') }}</label>
  166. </div>
  167. </li>
  168. <li class="list-inline-item">
  169. <div class="radio-custom radio-primary">
  170. <input type="radio" id="visible" name="is_display" value="3" checked/>
  171. <label for="visible">{{ trans('admin.node.info.display.all') }}</label>
  172. </div>
  173. </li>
  174. </ul>
  175. <div class="text-help offset-md-3"> {{ trans('admin.node.info.display.hint') }}</div>
  176. </div>
  177. <div class="form-group row">
  178. <label for="detection_type" class="col-md-3 col-form-label">{{ trans('model.node.detection') }}</label>
  179. <ul class="col-md-9 list-unstyled list-inline">
  180. <li class="list-inline-item">
  181. <div class="radio-custom radio-primary">
  182. <input type="radio" id="detect_disable" name="detection_type" value="0" checked/>
  183. <label for="detect_disable">{{ trans('common.close') }}</label>
  184. </div>
  185. </li>
  186. <li class="list-inline-item">
  187. <div class="radio-custom radio-primary">
  188. <input type="radio" id="detect_tcp" name="detection_type" value="1"/>
  189. <label for="detect_tcp">{{ trans('admin.node.info.detection.tcp') }}</label>
  190. </div>
  191. </li>
  192. <li class="list-inline-item">
  193. <div class="radio-custom radio-primary">
  194. <input type="radio" id="detect_icmp" name="detection_type" value="2"/>
  195. <label for="detect_icmp">{{ trans('admin.node.info.detection.icmp') }}</label>
  196. </div>
  197. </li>
  198. <li class="list-inline-item">
  199. <div class="radio-custom radio-primary">
  200. <input type="radio" id="detect_all" name="detection_type" value="3"/>
  201. <label for="detect_all">{{ trans('admin.node.info.detection.all') }}</label>
  202. </div>
  203. </li>
  204. </ul>
  205. <div class="text-help offset-md-3"> {{ trans('admin.node.info.detection.hint') }}</div>
  206. </div>
  207. <!-- 中转 设置部分 -->
  208. <div class="form-group row">
  209. <label for="relay_node_id" class="col-md-3 col-form-label">{{ trans('model.node.transfer') }}</label>
  210. <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control show-tick"
  211. id="relay_node_id" name="relay_node_id">
  212. <option value="">{{ trans('common.none') }}</option>
  213. @foreach($nodes as $name => $id)
  214. <option value="{{$id}}">{{$id}} - {{$name}}</option>
  215. @endforeach
  216. </select>
  217. </div>
  218. <hr/>
  219. <!-- 代理 设置部分 -->
  220. <div class="proxy-config">
  221. <div class="form-group row">
  222. <label for="type" class="col-md-3 col-form-label">{{ trans('model.common.type') }}</label>
  223. <ul class="col-md-9 list-unstyled list-inline">
  224. <li class="list-inline-item">
  225. <div class="radio-custom radio-primary">
  226. <input type="radio" id="shadowsocks" name="type" value="0">
  227. <label for="shadowsocks">Shadowsocks</label>
  228. </div>
  229. </li>
  230. <li class="list-inline-item">
  231. <div class="radio-custom radio-primary">
  232. <input type="radio" id="shadowsocksR" name="type" value="1">
  233. <label for="shadowsocksR">ShadowsocksR</label>
  234. </div>
  235. </li>
  236. <li class="list-inline-item">
  237. <div class="radio-custom radio-primary">
  238. <input type="radio" id="v2ray" name="type" value="2">
  239. <label for="v2ray">V2Ray</label>
  240. </div>
  241. </li>
  242. <li class="list-inline-item">
  243. <div class="radio-custom radio-primary">
  244. <input type="radio" id="trojan" name="type" value="3">
  245. <label for="trojan">Trojan</label>
  246. </div>
  247. </li>
  248. <li class="list-inline-item">
  249. <div class="radio-custom radio-primary">
  250. <input type="radio" id="vnet" name="type" value="4">
  251. <label for="vnet">VNET</label>
  252. </div>
  253. </li>
  254. </ul>
  255. </div>
  256. <hr/>
  257. <!-- SS/SSR 设置部分 -->
  258. <div class="ss-setting">
  259. <div class="form-group row">
  260. <label for="method" class="col-md-3 col-form-label">{{ trans('model.node.method') }}</label>
  261. <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control" name="method" id="method">
  262. @foreach (Helpers::methodList() as $method)
  263. <option value="{{$method->name}}" @if(!isset($node) && $method->is_default) selected @endif>{{$method->name}}</option>
  264. @endforeach
  265. </select>
  266. </div>
  267. <div class="ssr-setting">
  268. <div class="form-group row">
  269. <label for="protocol" class="col-md-3 col-form-label">{{ trans('model.node.protocol') }}</label>
  270. <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control" name="protocol"
  271. id="protocol">
  272. @foreach (Helpers::protocolList() as $protocol)
  273. <option value="{{$protocol->name}}"
  274. @if(!isset($node) && $protocol->is_default) selected @endif>{{$protocol->name}}</option>
  275. @endforeach
  276. </select>
  277. </div>
  278. <div class="form-group row">
  279. <label for="protocol_param" class="col-md-3 col-form-label"> {{ trans('model.node.protocol_param') }} </label>
  280. <input type="text" class="form-control col-md-4" name="protocol_param" id="protocol_param">
  281. </div>
  282. <div class="form-group row">
  283. <label for="obfs" class="col-md-3 col-form-label">{{ trans('model.node.obfs') }}</label>
  284. <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control" name="obfs" id="obfs">
  285. @foreach (Helpers::obfsList() as $obfs)
  286. <option value="{{$obfs->name}}" @if(!isset($node) && $obfs->is_default) selected @endif>{{$obfs->name}}</option>
  287. @endforeach
  288. </select>
  289. </div>
  290. <div class="form-group row obfs_param">
  291. <label for="obfs_param" class="col-md-3 col-form-label"> {{ trans('model.node.obfs_param') }} </label>
  292. <textarea class="form-control col-md-8" rows="5" name="obfs_param" id="obfs_param"
  293. placeholder="{!! trans('admin.node.info.obfs_param_hint') !!}"></textarea>
  294. </div>
  295. <div class="form-group row">
  296. <label class="col-md-3 col-form-label">{{ trans('admin.node.proxy_info') }}</label>
  297. <div class="text-help col-md-9">
  298. {!! trans('admin.node.proxy_info_hint') !!}
  299. </div>
  300. </div>
  301. </div>
  302. <hr/>
  303. <div class="form-group row">
  304. <label for="single" class="col-md-3 col-form-label">{{ trans('model.node.single') }}</label>
  305. <div class="col-md-9">
  306. <input type="checkbox" id="single" name="single" data-plugin="switchery" onchange="switchSetting('single')">
  307. </div>
  308. <div class="text-help offset-md-3">
  309. {!! trans('admin.node.info.additional_ports_hint') !!}
  310. </div>
  311. </div>
  312. <div class="single-setting">
  313. <div class="form-group row">
  314. <label for="single_port" class="col-md-3 col-form-label">{{ trans('model.node.service_port') }}</label>
  315. <input type="number" class="form-control col-md-4" name="port" id="single_port" value="443" hidden/>
  316. <span class="text-help offset-md-3"> {!! trans('admin.node.info.single_hint') !!}</span>
  317. </div>
  318. <div class="form-group row ssr-setting">
  319. <label for="passwd" class="col-md-3 col-form-label">{{ trans('model.node.single_passwd') }}</label>
  320. <input type="text" class="form-control col-md-4" name="passwd" id="passwd"
  321. placeholder="{{ trans('validation.attributes.password') }}">
  322. </div>
  323. </div>
  324. </div>
  325. <!-- V2ray 设置部分 -->
  326. <div class="v2ray-setting">
  327. <div class="form-group row">
  328. <label for="v2_alter_id" class="col-md-3 col-form-label">{{ trans('model.node.v2_alter_id') }}</label>
  329. <input type="text" class="form-control col-md-4" name="v2_alter_id" value="16" id="v2_alter_id"/>
  330. </div>
  331. <div class="form-group row">
  332. <label for="v2_port" class="col-md-3 col-form-label">{{ trans('model.node.service_port') }}</label>
  333. <input type="number" class="form-control col-md-4" name="port" id="v2_port" value="10053" hidden/>
  334. </div>
  335. <div class="form-group row">
  336. <label for="v2_method" class="col-md-3 col-form-label">{{ trans('model.node.method') }}</label>
  337. <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control" id="v2_method">
  338. <option value="none">none</option>
  339. <option value="auto">auto</option>
  340. <option value="aes-128-cfb">aes-128-cfb</option>
  341. <option value="aes-128-gcm">aes-128-gcm</option>
  342. <option value="chacha20-poly1305">chacha20-poly1305</option>
  343. </select>
  344. <div class="text-help offset-md-3"> {{ trans('admin.node.info.v2_method_hint') }}</div>
  345. </div>
  346. <div class="form-group row">
  347. <label for="v2_net" class="col-md-3 col-form-label">{{ trans('model.node.v2_net') }}</label>
  348. <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control" id="v2_net">
  349. <option value="tcp">TCP</option>
  350. <option value="http">HTTP/2</option>
  351. <option value="ws">WebSocket</option>
  352. <option value="kcp">mKCP</option>
  353. <option value="domainsocket">DomainSocket</option>
  354. <option value="quic">QUIC</option>
  355. </select>
  356. <div class="text-help offset-md-3"> {{ trans('admin.node.info.v2_net_hint') }}</div>
  357. </div>
  358. <div class="form-group row v2_type">
  359. <label for="v2_type" class="col-md-3 col-form-label">{{ trans('model.node.v2_cover') }}</label>
  360. <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control" id="v2_type">
  361. <option value="none">{{ trans('admin.node.info.v2_cover.none') }}</option>
  362. <option value="http">{{ trans('admin.node.info.v2_cover.http') }}</option>
  363. <optgroup id="type_option" label="">
  364. <option value="srtp">{{ trans('admin.node.info.v2_cover.srtp') }}</option>
  365. <option value="utp">{{ trans('admin.node.info.v2_cover.utp') }}</option>
  366. <option value="wechat-video">{{ trans('admin.node.info.v2_cover.wechat') }}</option>
  367. <option value="dtls">{{ trans('admin.node.info.v2_cover.dtls') }}</option>
  368. <option value="wireguard">{{ trans('admin.node.info.v2_cover.wireguard') }}</option>
  369. </optgroup>
  370. </select>
  371. </div>
  372. <div class="form-group row v2_host">
  373. <label for="v2_host" class="col-md-3 col-form-label">{{ trans('model.node.v2_host') }}</label>
  374. <div class="col-md-4 pl-0">
  375. <input type="text" class="form-control" name="v2_other" id="v2_host">
  376. </div>
  377. <div class="text-help offset-md-3">
  378. {{ trans('admin.node.info.v2_host_hint') }}
  379. </div>
  380. </div>
  381. <div class="form-group row">
  382. <label for="v2_path" class="col-md-3 col-form-label">{{ trans('model.node.v2_path') }}</label>
  383. <input type="text" class="form-control col-md-4" name="v2_path" id="v2_path">
  384. </div>
  385. <div class="form-group row">
  386. <label for="v2_sni" class="col-md-3 col-form-label">{{ trans('model.node.v2_sni') }}</label>
  387. <input type="text" class="form-control col-md-4" name="v2_sni" id="v2_sni">
  388. </div>
  389. <div class="form-group row">
  390. <label for="v2_tls" class="col-md-3 col-form-label">{{ trans('model.node.v2_tls') }}</label>
  391. <div class="col-md-9">
  392. <input type="checkbox" id="v2_tls" name="v2_tls" data-plugin="switchery" onchange="switchSetting('v2_tls')">
  393. </div>
  394. </div>
  395. <div class="form-group row">
  396. <label for="tls_provider" class="col-md-3 col-form-label">{{ trans('model.node.v2_tls_provider') }}</label>
  397. <input type="text" class="form-control col-md-9" name="tls_provider" id="tls_provider"/>
  398. <div class="text-help offset-md-3"> {{ trans('admin.node.info.v2_tls_provider_hint') }}
  399. <a href="https://proxypanel.gitbook.io/wiki/webapi/webapi-basic-setting#vnet-v2-ray-hou-duan" target="_blank">VNET-V2Ray</a>、
  400. <a href="https://proxypanel.gitbook.io/wiki/webapi/webapi-basic-setting#v-2-ray-poseidon-hou-duan"
  401. target="_blank">V2Ray-Poseidon</a>
  402. </div>
  403. </div>
  404. </div>
  405. <!-- Trojan 设置部分 -->
  406. <div class="trojan-setting">
  407. <div class="form-group row">
  408. <label for="trojan_port" class="col-md-3 col-form-label">{{ trans('model.node.service_port') }}</label>
  409. <input type="number" class="form-control col-md-4" name="port" id="trojan_port" value="443" hidden/>
  410. </div>
  411. </div>
  412. </div>
  413. <div class="relay-config">
  414. <div class="form-group row">
  415. <label for="relay_port" class="col-md-3 col-form-label">{{ trans('model.node.relay_port') }}</label>
  416. <input type="number" class="form-control col-md-4" name="port" id="relay_port" value="443" hidden/>
  417. </div>
  418. </div>
  419. </div>
  420. </div>
  421. <div class="col-md-12 form-actions">
  422. <div class="float-right">
  423. <a href="{{route('admin.node.index')}}" class="btn btn-danger">{{ trans('common.back') }}</a>
  424. <button type="submit" class="btn btn-success">{{ trans('common.submit') }}</button>
  425. </div>
  426. </div>
  427. </div>
  428. </div>
  429. </form>
  430. </div>
  431. </div>
  432. </div>
  433. @endsection
  434. @section('javascript')
  435. <script src="/assets/global/vendor/bootstrap-select/bootstrap-select.min.js"></script>
  436. <script src="/assets/global/js/Plugin/bootstrap-select.js"></script>
  437. <script src="/assets/global/vendor/switchery/switchery.min.js"></script>
  438. <script src="/assets/global/js/Plugin/switchery.js"></script>
  439. <script>
  440. const string = "{{strtolower(Str::random())}}";
  441. $(document).ready(function() {
  442. $('.relay-config').hide();
  443. let v2_path = $('#v2_path');
  444. @isset($node)
  445. @if($node->is_ddns)
  446. $('#is_ddns').click();
  447. @endif
  448. @if($node->is_udp)
  449. $('#is_udp').click();
  450. @endif
  451. @if($node->status)
  452. $('#status').click();
  453. @endif
  454. $("input[name='is_display'][value='{{$node->is_display}}']").click();
  455. $("input[name='detection_type'][value='{{$node->detection_type}}']").click();
  456. $("input[name='type'][value='{{$node->type}}']").click();
  457. $('#name').val('{{$node->name}}');
  458. $('#server').val('{{$node->server}}');
  459. $('#ip').val('{{$node->ip}}');
  460. $('#ipv6').val('{{$node->ipv6}}');
  461. $('#push_port').val('{{$node->push_port}}');
  462. $('#traffic_rate').val('{{$node->traffic_rate}}');
  463. $('#level').selectpicker('val', '{{$node->level}}');
  464. $('#ruleGroup').selectpicker('val', '{{$node->rule_group_id}}');
  465. $('#speed_limit').val('{{$node->speed_limit}}');
  466. $('#client_limit').val('{{$node->client_limit}}');
  467. $('#labels').selectpicker('val', {{$node->labels->pluck('id')}});
  468. $('#country_code').selectpicker('val', '{{$node->country_code}}');
  469. $('#relay_node_id').selectpicker('val', '{{$node->relay_node_id}}');
  470. $('#description').val('{{$node->description}}');
  471. $('#sort').val('{{$node->sort}}');
  472. @if(isset($node->relay_node_id))
  473. $('#relay_port').val('{{$node->port}}');
  474. @else
  475. @switch($node->type)
  476. @case(1)
  477. @case(4)
  478. $('#protocol').selectpicker('val', '{{$node->profile['protocol'] ?? null}}');
  479. $('#protocol_param').val('{{$node->profile['protocol_param'] ?? null}}');
  480. $('#obfs').selectpicker('val', '{{$node->profile['obfs'] ?? null}}');
  481. $('#obfs_param').val('{{$node->profile['obfs_param'] ?? null}}');
  482. @if(!empty($node->profile['passwd']) && $node->port)
  483. $('#single').click();
  484. $('#passwd').val('{{$node->profile['passwd']}}');
  485. @endif
  486. @case(0)
  487. $('#method').selectpicker('val', '{{$node->profile['method'] ?? null}}');
  488. @break
  489. @case(2)
  490. //V2Ray
  491. $('#v2_alter_id').val('{{$node->profile['v2_alter_id'] ?? null}}');
  492. $('#v2_method').selectpicker('val', '{{$node->profile['method'] ?? null}}');
  493. $('#v2_net').selectpicker('val', '{{$node->profile['v2_net'] ?? null}}');
  494. $('#v2_type').selectpicker('val', '{{$node->profile['v2_type'] ?? null}}');
  495. $('#v2_host').val('{{$node->profile['v2_host'] ?? null}}');
  496. $('#v2_port').val('{{$node->port}}');
  497. $('#v2_sni').val('{{$node->profile['v2_sni'] ?? null}}');
  498. v2_path.val('{{$node->profile['v2_path'] ?? null}}');
  499. @if($node->profile['v2_tls'] ?? false)
  500. $('#v2_tls').click();
  501. @endif
  502. $('#tls_provider').val('{!! $node->tls_provider !!}');
  503. @break
  504. @case(3)
  505. $('#trojan_port').val('{{$node->port}}');
  506. @break
  507. @default
  508. @endswitch
  509. $('input[name = port]').val('{{$node->port}}');
  510. @endif
  511. @else
  512. switchSetting('single');
  513. switchSetting('is_ddns');
  514. $('input[name=\'type\'][value=\'0\']').click();
  515. $('#status').click();
  516. $('#is_udp').click();
  517. v2_path.val('/' + string);
  518. @endisset
  519. if ($('#obfs').val() === 'plain') {
  520. $('.obfs_param').hide();
  521. }
  522. });
  523. function Submit() { // ajax同步提交
  524. $.ajax({
  525. method: @isset($node) 'PUT' @else 'POST' @endisset,
  526. url: '{{isset($node)? route('admin.node.update', $node) : route('admin.node.store')}}',
  527. dataType: 'json',
  528. data: {
  529. _token: '{{csrf_token()}}',
  530. is_ddns: document.getElementById('is_ddns').checked ? 1 : 0,
  531. name: $('#name').val(),
  532. server: $('#server').val(),
  533. ip: $('#ip').val(),
  534. ipv6: $('#ipv6').val(),
  535. push_port: $('#push_port').val(),
  536. traffic_rate: $('#traffic_rate').val(),
  537. level: $('#level').val(),
  538. rule_group_id: $('#ruleGroup').val(),
  539. speed_limit: $('#speed_limit').val(),
  540. client_limit: $('#client_limit').val(),
  541. labels: $('#labels').val(),
  542. country_code: $('#country_code option:selected').val(),
  543. description: $('#description').val(),
  544. sort: $('#sort').val(),
  545. is_udp: document.getElementById('is_udp').checked ? 1 : 0,
  546. status: document.getElementById('status').checked ? 1 : 0,
  547. type: $('input[name=\'type\']:checked').val(),
  548. method: $('#method').val(),
  549. protocol: $('#protocol').val(),
  550. protocol_param: $('#protocol_param').val(),
  551. obfs: $('#obfs').val(),
  552. obfs_param: $('#obfs_param').val(),
  553. is_display: $('input[name=\'is_display\']:checked').val(),
  554. detection_type: $('input[name=\'detection_type\']:checked').val(),
  555. single: document.getElementById('single').checked ? 1 : 0,
  556. port: $('input[name="port"]:not([hidden])').val(),
  557. passwd: $('#passwd').val(),
  558. v2_alter_id: $('#v2_alter_id').val(),
  559. v2_method: $('#v2_method').val(),
  560. v2_net: $('#v2_net').val(),
  561. v2_type: $('#v2_type').val(),
  562. v2_host: $('#v2_host').val(),
  563. v2_path: $('#v2_path').val(),
  564. v2_sni: $('#v2_sni').val(),
  565. v2_tls: document.getElementById('v2_tls').checked ? 1 : 0,
  566. tls_provider: $('#tls_provider').val(),
  567. relay_node_id: $('#relay_node_id option:selected').val(),
  568. },
  569. success: function(ret) {
  570. if (ret.status === 'success') {
  571. swal.fire({
  572. title: ret.message,
  573. icon: 'success',
  574. timer: 1000,
  575. showConfirmButton: false,
  576. }).then(() => window.location.href = '{{route('admin.node.index').(Request::getQueryString()?('?'.Request::getQueryString()):'') }}');
  577. } else {
  578. swal.fire({title: '[错误 | Error]', text: ret.message, icon: 'error'});
  579. }
  580. },
  581. error: function(data) {
  582. let str = '';
  583. const errors = data.responseJSON;
  584. if ($.isEmptyObject(errors) === false) {
  585. $.each(errors.errors, function(index, value) {
  586. str += '<li>' + value + '</li>';
  587. });
  588. swal.fire({title: '{{ trans('admin.hint') }}', html: str, icon: 'error', confirmButtonText: '{{ trans('common.confirm') }}'});
  589. }
  590. },
  591. });
  592. return false;
  593. }
  594. function switchSetting(id) {
  595. let check = document.getElementById(id).checked ? 1 : 0;
  596. switch (id) {
  597. case 'single': // 设置单端口多用户
  598. if (check) {
  599. $('.single-setting').show();
  600. $('#single_port').removeAttr('hidden').attr('required', true);
  601. } else {
  602. $('#single_port').removeAttr('required').attr('hidden', true);
  603. $('#passwd').val('');
  604. $('.single-setting').hide();
  605. }
  606. break;
  607. case 'is_ddns': // 设置是否使用DDNS
  608. if (check) {
  609. $('#ip').val('').attr('readonly', true);
  610. $('#ipv6').val('').attr('readonly', true);
  611. $('#server').attr('required', true);
  612. } else {
  613. $('#ip').removeAttr('readonly');
  614. $('#ipv6').removeAttr('readonly');
  615. $('#server').removeAttr('required');
  616. }
  617. break;
  618. default:
  619. break;
  620. }
  621. }
  622. // 设置服务类型
  623. $('input:radio[name=\'type\']').on('change', function() {
  624. const type = parseInt($(this).val());
  625. const $ss_setting = $('.ss-setting');
  626. const $ssr_setting = $('.ssr-setting');
  627. const $v2ray_setting = $('.v2ray-setting');
  628. const $trojan_setting = $('.trojan-setting');
  629. $ssr_setting.hide();
  630. $ss_setting.hide();
  631. $v2ray_setting.hide();
  632. $trojan_setting.hide();
  633. $('#v2_port').removeAttr('required').attr('hidden', true);
  634. $('#trojan_port').removeAttr('required');
  635. switch (type) {
  636. case 0:
  637. $ss_setting.show();
  638. break;
  639. case 2:
  640. $v2ray_setting.show();
  641. $('#v2_port').removeAttr('hidden').attr('required', true);
  642. $('#v2_net').selectpicker('val', 'tcp');
  643. break;
  644. case 3:
  645. $trojan_setting.show();
  646. $('#trojan_port').removeAttr('hidden').attr('required', true);
  647. break;
  648. case 1:
  649. case 4:
  650. $ss_setting.show();
  651. $ssr_setting.show();
  652. break;
  653. default:
  654. }
  655. });
  656. $('#obfs').on('changed.bs.select', function() {
  657. const obfs_param = $('.obfs_param');
  658. if ($('#obfs').val() === 'plain') {
  659. $('#obfs_param').val('');
  660. obfs_param.hide();
  661. } else {
  662. obfs_param.show();
  663. }
  664. });
  665. $('#relay_node_id').on('changed.bs.select', function() {
  666. const relay = $('.relay-config');
  667. const config = $('.proxy-config');
  668. if ($('#relay_node_id').val() === '') {
  669. relay.hide();
  670. $('#relay_port').removeAttr('required').attr('hidden', true);
  671. config.show();
  672. } else {
  673. relay.show();
  674. config.hide();
  675. $('#relay_port').removeAttr('hidden').attr('required', true);
  676. }
  677. });
  678. // 设置V2Ray详细设置
  679. $('#v2_net').on('changed.bs.select', function() {
  680. const type = $('.v2_type');
  681. const type_option = $('#type_option');
  682. const host = $('.v2_host');
  683. const path = $('#v2_path');
  684. const v2_other = $('[name="v2_other"]');
  685. type.show();
  686. host.show();
  687. v2_other.show();
  688. path.val('/' + string);
  689. switch ($(this).val()) {
  690. case 'kcp':
  691. type_option.attr('disabled', false);
  692. break;
  693. case 'ws':
  694. type.hide();
  695. break;
  696. case 'http':
  697. type.hide();
  698. break;
  699. case 'domainsocket':
  700. type.hide();
  701. host.hide();
  702. break;
  703. case 'quic':
  704. type_option.attr('disabled', false);
  705. path.val(string);
  706. break;
  707. case 'tcp':
  708. default:
  709. type_option.attr('disabled', true);
  710. break;
  711. }
  712. $('#v2_type').selectpicker('refresh');
  713. });
  714. // 服务条款
  715. function showTnc() {
  716. const content =
  717. '<ol>' +
  718. '<li>请勿直接复制黏贴以下配置,SSR(R)会报错的</li>' +
  719. '<li>确保服务器时间为CST</li>' +
  720. '</ol>' +
  721. '&emsp;&emsp;"additional_ports" : {<br />' +
  722. '&emsp;&emsp;&emsp;"443": {<br />' +
  723. '&emsp;&emsp;&emsp;&emsp;"passwd": "ProxyPanel",<br />' +
  724. '&emsp;&emsp;&emsp;&emsp;"method": "none",<br />' +
  725. '&emsp;&emsp;&emsp;&emsp;"protocol": "auth_chain_a",<br />' +
  726. '&emsp;&emsp;&emsp;&emsp;"protocol_param": "#",<br />' +
  727. '&emsp;&emsp;&emsp;&emsp;"obfs": "plain",<br />' +
  728. '&emsp;&emsp;&emsp;&emsp;"obfs_param": "fe2.update.microsoft.com"<br />' +
  729. '&emsp;&emsp;&emsp;}<br />' +
  730. '&emsp;&emsp;},';
  731. swal.fire({
  732. title: '[节点 user-config.json 配置示例]',
  733. html: '<div class="p-10 bg-grey-900 text-white font-weight-300 text-left" style="line-height: 22px;">' + content + '</div>',
  734. icon: 'info',
  735. });
  736. }
  737. // 模式提示
  738. function showPortsOnlyConfig() {
  739. const content = '严格模式:"additional_ports_only": "true"'
  740. + '<br><br>'
  741. + '兼容模式:"additional_ports_only": "false"';
  742. swal.fire({
  743. title: '[节点 user-config.json 配置示例]',
  744. html: '<div class="p-10 bg-grey-900 text-white font-weight-300 text-left" style="line-height: 22px;">' + content + '</div>',
  745. icon: 'info',
  746. });
  747. }
  748. </script>
  749. @endsection