info.blade.php 53 KB

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