You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

450 lines
20 KiB

1 year ago
1 year ago
  1. {extend name="admin/layout" /}
  2. {block name="title"}系统设置{/block}
  3. {block name="main"}
  4. <div class="container" style="padding-top:70px;">
  5. {if $mod=='sys'}
  6. <div class="col-sm-12 col-md-6 center-block">
  7. <div class="panel panel-success">
  8. <div class="panel-heading"><h3 class="panel-title">系统基本设置</h3></div>
  9. <div class="panel-body">
  10. <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
  11. <div class="form-group">
  12. <label>是否开启白名单模式:</label><br/>
  13. <select class="form-control" name="whitelist" default="{:config_get('whitelist')}"><option value="0">关闭</option><option value="1">开启</option></select>
  14. <font color="green">开启白名单模式后,只有在<a href="/admin/list/type/white" target="_blank">白名单列表</a>中的服务器IP才能使用此云端</font>
  15. </div>
  16. <div class="form-group">
  17. <label>安装脚本展示页面开关:</label>
  18. <select class="form-control" name="download_page" default="{:config_get('download_page')}"><option value="0">关闭</option><option value="1">开启</option></select>
  19. <font color="green">页面地址:<a href="/download" target="_blank">/download</a>,开启后可以公开访问,否则只能管理员访问</font>
  20. </div>
  21. <div class="form-group text-center">
  22. <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
  23. </div>
  24. </form>
  25. </div>
  26. </div>
  27. <div class="panel panel-info">
  28. <div class="panel-heading"><h3 class="panel-title">Linux面板版本设置</h3></div>
  29. <div class="panel-body">
  30. <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
  31. <div class="form-group">
  32. <label>宝塔Linux面板最新版本号:</label>
  33. <input type="text" name="new_version" value="{:config_get('new_version')}" class="form-control"/>
  34. <font color="green">用于一键更新脚本获取最新版本号,以及检测更新接口。并确保已在/public/install/update/放置对应版本更新包</font>
  35. </div>
  36. <div class="form-group">
  37. <label>宝塔Linux面板更新日志:</label>
  38. <textarea class="form-control" name="update_msg" rows="5" placeholder="支持HTML代码">{:config_get('update_msg')}</textarea>
  39. <font color="green">用于检测更新接口返回</font>
  40. </div>
  41. <div class="form-group">
  42. <label>宝塔Linux面板更新日期:</label>
  43. <input type="date" name="update_date" value="{:config_get('update_date')}" class="form-control"/>
  44. <font color="green">用于检测更新接口返回</font>
  45. </div>
  46. <div class="form-group text-center">
  47. <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
  48. </div>
  49. </form>
  50. </div>
  51. </div>
  52. </div>
  53. <div class="col-sm-12 col-md-6 center-block">
  54. <div class="panel panel-info">
  55. <div class="panel-heading"><h3 class="panel-title">Windows面板版本设置</h3></div>
  56. <div class="panel-body">
  57. <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
  58. <div class="form-group">
  59. <label>宝塔Windows面板最新版本号:</label>
  60. <input type="text" name="new_version_win" value="{:config_get('new_version_win')}" class="form-control"/>
  61. <font color="green">用于一键更新脚本获取最新版本号,以及检测更新接口。并确保已在/public/win/panel/放置对应版本更新包</font>
  62. </div>
  63. <div class="form-group">
  64. <label>宝塔Windows面板更新日志:</label>
  65. <textarea class="form-control" name="update_msg_win" rows="5" placeholder="支持HTML代码">{:config_get('update_msg_win')}</textarea>
  66. <font color="green">用于检测更新接口返回</font>
  67. </div>
  68. <div class="form-group">
  69. <label>宝塔Windows面板更新日期:</label>
  70. <input type="date" name="update_date_win" value="{:config_get('update_date_win')}" class="form-control"/>
  71. <font color="green">用于检测更新接口返回</font>
  72. </div>
  73. <div class="form-group text-center">
  74. <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
  75. </div>
  76. </form>
  77. </div>
  78. </div>
  79. <div class="panel panel-info">
  80. <div class="panel-heading"><h3 class="panel-title">云监控版本设置</h3></div>
  81. <div class="panel-body">
  82. <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
  83. <div class="form-group">
  84. <label>宝塔云监控最新版本号:</label>
  85. <input type="text" name="new_version_btm" value="{:config_get('new_version_btm')}" class="form-control"/>
  86. <font color="green">用于一键更新脚本获取最新版本号,以及检测更新接口。并确保已在/public/install/src/放置对应版本更新包</font>
  87. </div>
  88. <div class="form-group">
  89. <label>宝塔云监控更新日志:</label>
  90. <textarea class="form-control" name="update_msg_btm" rows="3" placeholder="支持HTML代码">{:config_get('update_msg_btm')}</textarea>
  91. </div>
  92. <div class="form-group">
  93. <label>宝塔云监控更新日期:</label>
  94. <input type="date" name="update_date_btm" value="{:config_get('update_date_btm')}" class="form-control"/>
  95. </div>
  96. <div class="form-group text-center">
  97. <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
  98. </div>
  99. </form>
  100. </div>
  101. </div>
  102. </div>
  103. {elseif $mod=='api'}
  104. <div class="col-sm-12 col-md-6 center-block">
  105. <div class="panel panel-info">
  106. <div class="panel-heading"><h3 class="panel-title">宝塔Linux面板接口设置</h3></div>
  107. <div class="panel-body">
  108. <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
  109. <div class="form-group">
  110. <label>对接方式:</label><br/>
  111. <select class="form-control" name="bt_type" default="{:config_get('bt_type')}"><option value="0">对接宝塔面板接口</option><option value="1">对接其他第三方云端</option></select>
  112. </div><hr/>
  113. <div id="bt_type_0" style="{if config_get('bt_type')==1}display:none;{/if}">
  114. <p>以下宝塔面板请使用官方最新脚本安装并绑定账号,用于获取插件列表及插件包</p>
  115. <p><a href="/static/file/kaixin.zip">下载专用插件(Linux)</a>,在面板【软件商店】->【第三方应用】,点击【导入插件】,导入该专用插件。</p>
  116. <div class="form-group">
  117. <label>宝塔面板URL:</label><br/>
  118. <input type="text" name="bt_url" value="{:config_get('bt_url')}" class="form-control"/>
  119. <font color="green">填写规则如:<u>http://192.168.1.1:8888</u> ,不要带其他后缀</font>
  120. </div>
  121. <div class="form-group">
  122. <label>宝塔面板接口密钥:</label>
  123. <input type="text" name="bt_key" value="{:config_get('bt_key')}" class="form-control"/>
  124. </div>
  125. </div>
  126. <div id="bt_type_1" style="{if !config_get('bt_type')}display:none;{/if}">
  127. <div class="form-group">
  128. <label>第三方云端首页URL:</label><br/>
  129. <input type="text" name="bt_surl" value="{:config_get('bt_surl')}" class="form-control"/>
  130. <font color="green">填写规则如:<u>http://www.example.com/</u> ,必须以/结尾</font>
  131. </div>
  132. </div>
  133. <div class="form-group text-center">
  134. <button type="button" class="btn btn-info btn-block" id="testbturl">测试连接</button>
  135. <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
  136. </div>
  137. </form>
  138. </div>
  139. </div>
  140. </div>
  141. <div class="col-sm-12 col-md-6 center-block">
  142. <div class="panel panel-info">
  143. <div class="panel-heading"><h3 class="panel-title">宝塔Windows面板接口设置</h3></div>
  144. <div class="panel-body">
  145. <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
  146. <div class="form-group">
  147. <label>对接方式:</label><br/>
  148. <select class="form-control" name="wbt_type" default="{:config_get('wbt_type')}"><option value="0">对接宝塔面板接口</option><option value="1">对接其他第三方云端</option></select>
  149. </div><hr/>
  150. <div id="wbt_type_0" style="{if config_get('wbt_type')==1}display:none;{/if}">
  151. <p>以下宝塔面板请使用官方最新脚本安装并绑定账号,用于获取插件列表及插件包</p>
  152. <p><a href="/static/file/win/kaixin.zip">下载专用插件(Win)</a>,在面板【软件商店】->【第三方应用】,点击【导入插件】,导入该专用插件。</p>
  153. <div class="form-group">
  154. <label>宝塔面板URL:</label><br/>
  155. <input type="text" name="wbt_url" value="{:config_get('wbt_url')}" class="form-control"/>
  156. <font color="green">填写规则如:<u>http://192.168.1.1:8888</u> ,不要带其他后缀</font>
  157. </div>
  158. <div class="form-group">
  159. <label>宝塔面板接口密钥:</label>
  160. <input type="text" name="wbt_key" value="{:config_get('wbt_key')}" class="form-control"/>
  161. </div>
  162. </div>
  163. <div id="wbt_type_1" style="{if !config_get('wbt_type')}display:none;{/if}">
  164. <div class="form-group">
  165. <label>第三方云端首页URL:</label><br/>
  166. <input type="text" name="wbt_surl" value="{:config_get('wbt_surl')}" class="form-control"/>
  167. <font color="green">填写规则如:<u>http://www.example.com/</u> ,必须以/结尾</font>
  168. </div>
  169. </div>
  170. <div class="form-group text-center">
  171. <button type="button" class="btn btn-info btn-block" id="testbturl2">测试连接</button>
  172. <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
  173. </div>
  174. </form>
  175. </div>
  176. </div>
  177. </div>
  178. <script>
  179. $("select[name='bt_type']").change(function(){
  180. if($(this).val() == 1){
  181. $("#bt_type_0").hide();
  182. $("#bt_type_1").show();
  183. }else{
  184. $("#bt_type_0").show();
  185. $("#bt_type_1").hide();
  186. }
  187. });
  188. $("select[name='wbt_type']").change(function(){
  189. if($(this).val() == 1){
  190. $("#wbt_type_0").hide();
  191. $("#wbt_type_1").show();
  192. }else{
  193. $("#wbt_type_0").show();
  194. $("#wbt_type_1").hide();
  195. }
  196. });
  197. </script>
  198. {elseif $mod=='task'}
  199. <div class="col-sm-12 col-md-6 center-block">
  200. <div class="panel panel-success">
  201. <div class="panel-heading"><h3 class="panel-title">自动更新插件说明</h3></div>
  202. <div class="panel-body">
  203. <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
  204. <div class="alert alert-info">使用以下命令可以从宝塔官方获取最新的插件列表并批量下载插件包(增量更新)。<br/>你也可以将此命令添加到crontab以使此云端的插件保持最新,建议1天执行1次。</div>
  205. <div class="alert alert-danger">使用命令执行之后,可能会导致 /data 目录下文件权限不对,后台插件列表下载插件覆盖会报错,需要手动循环设置 /data 目录权限。</div>
  206. <div class="alert alert-warning">上次运行时间:{$runtime|raw}</div>
  207. <div class="list-group-item">php {:app()->getRootPath()}think updateall</div><br/>
  208. </form>
  209. </div>
  210. </div>
  211. </div>
  212. <div class="col-sm-12 col-md-6 center-block">
  213. <div class="panel panel-info">
  214. <div class="panel-heading"><h3 class="panel-title">自动更新插件设置</h3></div>
  215. <div class="panel-body">
  216. <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
  217. <div class="form-group">
  218. <label>Linux面板批量下载插件范围:</label><br/>
  219. <select class="form-control" name="updateall_type" default="{:config_get('updateall_type')}"><option value="0">仅免费插件</option><option value="1">免费插件+专业版插件</option><option value="2">免费插件+专业版插件+企业版插件</option></select><font color="green">(批量下载不包含所有第三方插件,第三方插件需要去手动下载。)</font>
  220. </div>
  221. <div class="form-group">
  222. <label>Windows面板批量下载插件范围:</label><br/>
  223. <select class="form-control" name="updateall_type_win" default="{:config_get('updateall_type_win')}"><option value="0">仅免费插件</option><option value="1">免费插件+专业版插件</option><option value="2">免费插件+专业版插件+企业版插件</option></select><font color="green">(批量下载不包含所有第三方插件,第三方插件需要去手动下载。)</font>
  224. </div>
  225. <div class="form-group text-center">
  226. <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
  227. </div>
  228. </form>
  229. </div>
  230. </div>
  231. </div>
  232. {elseif $mod=='account'}
  233. <div class="col-xs-12 col-sm-8 col-lg-6 center-block" style="float: none;">
  234. <div class="panel panel-primary">
  235. <div class="panel-heading"><h3 class="panel-title">管理账号设置</h3></div>
  236. <div class="panel-body">
  237. <form onsubmit="return saveAccount(this)" method="post" class="form" role="form">
  238. <div class="form-group">
  239. <label>用户名:</label><br/>
  240. <input type="text" name="username" value="{:config_get('admin_username')}" class="form-control" required/>
  241. </div>
  242. <div class="form-group">
  243. <label>旧密码:</label>
  244. <input type="password" name="oldpwd" value="" class="form-control" placeholder="请输入当前的管理员密码"/>
  245. </div>
  246. <div class="form-group">
  247. <label>新密码:</label>
  248. <input type="password" name="newpwd" value="" class="form-control" placeholder="不修改请留空"/>
  249. </div>
  250. <div class="form-group">
  251. <label>重输密码:</label>
  252. <input type="password" name="newpwd2" value="" class="form-control" placeholder="不修改请留空"/>
  253. </div>
  254. <div class="form-group text-center">
  255. <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
  256. </div>
  257. <a href="javascript:cleancache()" class="btn btn-default btn-sm btn-block">清理缓存</a>
  258. </form>
  259. </div>
  260. </div>
  261. {elseif $mod=='tools'}
  262. <div class="col-sm-12 col-md-10 col-lg-8 center-block" style="float: none;">
  263. <div class="panel panel-primary">
  264. <div class="panel-heading"><h3 class="panel-title">批量替换工具</h3></div>
  265. <div class="panel-body">
  266. <form onsubmit="return saveAccount(this)" method="post" class="form" role="form">
  267. <div class="alert alert-info" style="word-break:break-all;">使用以下命令可以将bt安装包、更新包和脚本文件里面的<code>http://www.example.com</code>批量替换成当前网址<code>{:request()->root(true)}</code>,每次更新版本后只需要执行一次即可。</div>
  268. <div class="list-group-item" style="word-break:break-all;">cd {:app()->getRootPath()}app/script && chmod +x convert.sh && ./convert.sh {:app()->getRootPath()} {:request()->root(true)}</div><br/>
  269. </form>
  270. </div>
  271. </div>
  272. <div class="panel panel-primary">
  273. <div class="panel-heading"><h3 class="panel-title">清理旧版本插件工具</h3></div>
  274. <div class="panel-body">
  275. <form onsubmit="return saveAccount(this)" method="post" class="form" role="form">
  276. <div class="alert alert-info" style="word-break:break-all;">使用以下命令可清理旧版本的插件文件,以释放空间占用。</div>
  277. <div class="list-group-item" style="word-break:break-all;">php {:app()->getRootPath()}think clean</div><br/>
  278. </form>
  279. </div>
  280. </div>
  281. {/if}
  282. <script src="//cdn.staticfile.org/layer/3.5.1/layer.js"></script>
  283. <script>
  284. $(document).ready(function(){
  285. var items = $("select[default]");
  286. for (i = 0; i < items.length; i++) {
  287. $(items[i]).val($(items[i]).attr("default")||0);
  288. }
  289. $("#testbturl").click(function(){
  290. var bt_type = $("select[name=bt_type]").val();
  291. if(bt_type == '1'){
  292. var bt_surl = $("input[name=bt_surl]").val();
  293. if(bt_surl == ''){
  294. layer.alert('第三方云端URL不能为空');return;
  295. }
  296. if(bt_surl.indexOf('http://')==-1 && bt_surl.indexOf('https://')==-1){
  297. layer.alert('第三方云端URL不正确');return;
  298. }
  299. var postdata = {bt_type:bt_type, bt_surl:bt_surl};
  300. }else{
  301. var bt_url = $("input[name=bt_url]").val();
  302. var bt_key = $("input[name=bt_key]").val();
  303. if(bt_url == ''){
  304. layer.alert('宝塔面板URL不能为空');return;
  305. }
  306. if(bt_url.indexOf('http://')==-1 && bt_url.indexOf('https://')==-1){
  307. layer.alert('宝塔面板URL不正确');return;
  308. }
  309. if(bt_key == ''){
  310. layer.alert('宝塔面板接口密钥不能为空');return;
  311. }
  312. var postdata = {bt_type:bt_type, bt_url:bt_url, bt_key:bt_key};
  313. }
  314. var ii = layer.load(2, {shade:[0.1,'#fff']});
  315. $.ajax({
  316. type : 'POST',
  317. url : '/admin/testbturl',
  318. data : postdata,
  319. dataType : 'json',
  320. success : function(data) {
  321. layer.close(ii);
  322. if(data.code == 0){
  323. layer.msg(data.msg, {icon: 1, time:1000})
  324. }else{
  325. layer.alert(data.msg, {icon: 2})
  326. }
  327. },
  328. error:function(data){
  329. layer.close(ii);
  330. layer.msg('服务器错误');
  331. }
  332. });
  333. })
  334. $("#testbturl2").click(function(){
  335. var wbt_type = $("select[name=wbt_type]").val();
  336. if(wbt_type == '1'){
  337. var wbt_surl = $("input[name=wbt_surl]").val();
  338. if(wbt_surl == ''){
  339. layer.alert('第三方云端URL不能为空');return;
  340. }
  341. if(wbt_surl.indexOf('http://')==-1 && wbt_surl.indexOf('https://')==-1){
  342. layer.alert('第三方云端URL不正确');return;
  343. }
  344. var postdata = {bt_type:wbt_type, bt_surl:wbt_surl};
  345. }else{
  346. var wbt_url = $("input[name=wbt_url]").val();
  347. var wbt_key = $("input[name=wbt_key]").val();
  348. if(wbt_url == ''){
  349. layer.alert('宝塔面板URL不能为空');return;
  350. }
  351. if(wbt_url.indexOf('http://')==-1 && wbt_url.indexOf('https://')==-1){
  352. layer.alert('宝塔面板URL不正确');return;
  353. }
  354. if(wbt_key == ''){
  355. layer.alert('宝塔面板接口密钥不能为空');return;
  356. }
  357. var postdata = {bt_type:wbt_type, bt_url:wbt_url, bt_key:wbt_key};
  358. }
  359. var ii = layer.load(2, {shade:[0.1,'#fff']});
  360. $.ajax({
  361. type : 'POST',
  362. url : '/admin/testbturl',
  363. data : postdata,
  364. dataType : 'json',
  365. success : function(data) {
  366. layer.close(ii);
  367. if(data.code == 0){
  368. layer.msg(data.msg, {icon: 1, time:1000})
  369. }else{
  370. layer.alert(data.msg, {icon: 2})
  371. }
  372. },
  373. error:function(data){
  374. layer.close(ii);
  375. layer.msg('服务器错误');
  376. }
  377. });
  378. })
  379. })
  380. function saveSetting(obj){
  381. var ii = layer.load(2, {shade:[0.1,'#fff']});
  382. $.ajax({
  383. type : 'POST',
  384. url : '/admin/set',
  385. data : $(obj).serialize(),
  386. dataType : 'json',
  387. success : function(data) {
  388. layer.close(ii);
  389. if(data.code == 0){
  390. layer.alert('设置保存成功!', {
  391. icon: 1,
  392. closeBtn: false
  393. }, function(){
  394. window.location.reload()
  395. });
  396. }else{
  397. layer.alert(data.msg, {icon: 2})
  398. }
  399. },
  400. error:function(data){
  401. layer.close(ii);
  402. layer.msg('服务器错误');
  403. }
  404. });
  405. return false;
  406. }
  407. function saveAccount(obj){
  408. var ii = layer.load(2, {shade:[0.1,'#fff']});
  409. $.ajax({
  410. type : 'POST',
  411. url : '/admin/setaccount',
  412. data : $(obj).serialize(),
  413. dataType : 'json',
  414. success : function(data) {
  415. layer.close(ii);
  416. if(data.code == 0){
  417. layer.alert('管理账号保存成功!请重新登录。', {
  418. icon: 1,
  419. closeBtn: false
  420. }, function(){
  421. window.location.reload()
  422. });
  423. }else{
  424. layer.alert(data.msg, {icon: 2})
  425. }
  426. },
  427. error:function(data){
  428. layer.close(ii);
  429. layer.msg('服务器错误');
  430. }
  431. });
  432. return false;
  433. }
  434. function cleancache(){
  435. var ii = layer.load(2, {shade:[0.1,'#fff']});
  436. $.ajax({
  437. type : 'GET',
  438. url : '/admin/cleancache',
  439. dataType : 'json',
  440. success : function(data) {
  441. layer.close(ii);
  442. layer.msg('清理缓存成功', {icon: 1});
  443. },
  444. error:function(data){
  445. layer.close(ii);
  446. layer.msg('服务器错误');
  447. }
  448. });
  449. }
  450. </script>
  451. {/block}