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.

343 lines
15 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-primary">
  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">
  22. <label>宝塔Linux面板最新版本号:</label>
  23. <input type="text" name="new_version" value="{:config_get('new_version')}" class="form-control"/>
  24. <font color="green">用于一键更新脚本获取最新版本号,以及检测更新接口。并确保已在/public/install/update/放置对应版本更新包</font>
  25. </div>
  26. <div class="form-group">
  27. <label>宝塔Linux面板更新日志:</label>
  28. <textarea class="form-control" name="update_msg" rows="5" placeholder="支持HTML代码">{:config_get('update_msg')}</textarea>
  29. <font color="green">用于检测更新接口返回</font>
  30. </div>
  31. <div class="form-group">
  32. <label>宝塔Linux面板更新日期:</label>
  33. <input type="date" name="update_date" value="{:config_get('update_date')}" class="form-control"/>
  34. <font color="green">用于检测更新接口返回</font>
  35. </div>
  36. <div class="form-group">
  37. <label>宝塔Windows面板最新版本号:</label>
  38. <input type="text" name="new_version_win" value="{:config_get('new_version_win')}" class="form-control"/>
  39. <font color="green">用于一键更新脚本获取最新版本号,以及检测更新接口。并确保已在/public/win/panel/放置对应版本更新包</font>
  40. </div>
  41. <div class="form-group">
  42. <label>宝塔Windows面板更新日志:</label>
  43. <textarea class="form-control" name="update_msg_win" rows="5" placeholder="支持HTML代码">{:config_get('update_msg_win')}</textarea>
  44. <font color="green">用于检测更新接口返回</font>
  45. </div>
  46. <div class="form-group">
  47. <label>宝塔Windows面板更新日期:</label>
  48. <input type="date" name="update_date_win" value="{:config_get('update_date_win')}" class="form-control"/>
  49. <font color="green">用于检测更新接口返回</font>
  50. </div>
  51. <div class="form-group">
  52. <label>宝塔云监控最新版本号:</label>
  53. <input type="text" name="new_version_btm" value="{:config_get('new_version_btm')}" class="form-control"/>
  54. <font color="green">用于一键更新脚本获取最新版本号,以及检测更新接口。并确保已在/public/install/src/放置对应版本更新包</font>
  55. </div>
  56. <div class="form-group">
  57. <label>宝塔云监控更新日志:</label>
  58. <textarea class="form-control" name="update_msg_btm" rows="3" placeholder="支持HTML代码">{:config_get('update_msg_btm')}</textarea>
  59. </div>
  60. <div class="form-group">
  61. <label>宝塔云监控更新日期:</label>
  62. <input type="date" name="update_date_btm" value="{:config_get('update_date_btm')}" class="form-control"/>
  63. </div>
  64. <div class="form-group text-center">
  65. <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
  66. </div>
  67. </form>
  68. </div>
  69. </div>
  70. </div>
  71. <div class="col-sm-12 col-md-6 center-block">
  72. <div class="panel panel-primary">
  73. <div class="panel-heading"><h3 class="panel-title">宝塔Linux面板接口设置</h3></div>
  74. <div class="panel-body">
  75. <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
  76. <p>以下宝塔面板请使用官方最新脚本安装并绑定账号,用于获取最新插件列表及插件包</p>
  77. <p><a href="/static/file/kaixin.zip">下载专用插件(Linux)</a>,在面板【软件商店】->【第三方应用】,点击【导入插件】,导入该专用插件。</p>
  78. <div class="form-group">
  79. <label>宝塔面板URL:</label><br/>
  80. <input type="text" name="bt_url" value="{:config_get('bt_url')}" class="form-control"/>
  81. <font color="green">填写规则如:<u>http://192.168.1.1:8888</u> ,不要带其他后缀</font>
  82. </div>
  83. <div class="form-group">
  84. <label>宝塔面板接口密钥:</label>
  85. <input type="text" name="bt_key" value="{:config_get('bt_key')}" class="form-control"/>
  86. </div>
  87. <div class="form-group text-center">
  88. <button type="button" class="btn btn-info btn-block" id="testbturl">测试连接</button>
  89. <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
  90. </div>
  91. </form>
  92. </div>
  93. </div>
  94. <div class="panel panel-primary">
  95. <div class="panel-heading"><h3 class="panel-title">宝塔Windows面板接口设置</h3></div>
  96. <div class="panel-body">
  97. <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
  98. <p>以下宝塔面板请使用官方最新脚本安装并绑定账号,用于获取最新插件列表及插件包</p>
  99. <p><a href="/static/file/win/kaixin.zip">下载专用插件(Win)</a>,在面板【软件商店】->【第三方应用】,点击【导入插件】,导入该专用插件。</p>
  100. <div class="form-group">
  101. <label>宝塔面板URL:</label><br/>
  102. <input type="text" name="wbt_url" value="{:config_get('wbt_url')}" class="form-control"/>
  103. <font color="green">填写规则如:<u>http://192.168.1.1:8888</u> ,不要带其他后缀</font>
  104. </div>
  105. <div class="form-group">
  106. <label>宝塔面板接口密钥:</label>
  107. <input type="text" name="wbt_key" value="{:config_get('wbt_key')}" class="form-control"/>
  108. </div>
  109. <div class="form-group text-center">
  110. <button type="button" class="btn btn-info btn-block" id="testbturl2">测试连接</button>
  111. <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
  112. </div>
  113. </form>
  114. </div>
  115. </div>
  116. </div>
  117. {elseif $mod=='task'}
  118. <div class="col-sm-12 col-md-6 center-block">
  119. <div class="panel panel-success">
  120. <div class="panel-heading"><h3 class="panel-title">定时任务说明</h3></div>
  121. <div class="panel-body">
  122. <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
  123. <div class="alert alert-info">使用以下命令可以从宝塔官方获取最新的插件列表并批量下载插件包(增量更新)。<br/>你也可以将此命令添加到crontab以使此云端的插件保持最新,建议1天执行1次。</div>
  124. <div class="alert alert-danger">使用命令执行之后,可能会导致 /data 目录下文件权限不对,后台插件列表下载插件覆盖会报错,需要手动循环设置 /data 目录权限。</div>
  125. <div class="alert alert-warning">上次运行时间:{$runtime|raw}</div>
  126. <div class="list-group-item">php {:app()->getRootPath()}think updateall</div><br/>
  127. </form>
  128. </div>
  129. </div>
  130. </div>
  131. <div class="col-sm-12 col-md-6 center-block">
  132. <div class="panel panel-info">
  133. <div class="panel-heading"><h3 class="panel-title">定时任务设置</h3></div>
  134. <div class="panel-body">
  135. <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
  136. <div class="form-group">
  137. <label>Linux面板批量下载插件范围:</label><br/>
  138. <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>
  139. </div>
  140. <div class="form-group">
  141. <label>Windows面板批量下载插件范围:</label><br/>
  142. <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>
  143. </div>
  144. <div class="form-group text-center">
  145. <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
  146. </div>
  147. </form>
  148. </div>
  149. </div>
  150. </div>
  151. {elseif $mod=='account'}
  152. <div class="col-xs-12 col-sm-8 col-lg-6 center-block" style="float: none;">
  153. <div class="panel panel-primary">
  154. <div class="panel-heading"><h3 class="panel-title">管理账号设置</h3></div>
  155. <div class="panel-body">
  156. <form onsubmit="return saveAccount(this)" method="post" class="form" role="form">
  157. <div class="form-group">
  158. <label>用户名:</label><br/>
  159. <input type="text" name="username" value="{:config_get('admin_username')}" class="form-control" required/>
  160. </div>
  161. <div class="form-group">
  162. <label>旧密码:</label>
  163. <input type="password" name="oldpwd" value="" class="form-control" placeholder="请输入当前的管理员密码"/>
  164. </div>
  165. <div class="form-group">
  166. <label>新密码:</label>
  167. <input type="password" name="newpwd" value="" class="form-control" placeholder="不修改请留空"/>
  168. </div>
  169. <div class="form-group">
  170. <label>重输密码:</label>
  171. <input type="password" name="newpwd2" value="" class="form-control" placeholder="不修改请留空"/>
  172. </div>
  173. <div class="form-group text-center">
  174. <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
  175. </div>
  176. <a href="javascript:cleancache()" class="btn btn-default btn-sm btn-block">清理缓存</a>
  177. </form>
  178. </div>
  179. </div>
  180. {elseif $mod=='tools'}
  181. <div class="col-sm-12 col-md-10 col-lg-8 center-block" style="float: none;">
  182. <div class="panel panel-primary">
  183. <div class="panel-heading"><h3 class="panel-title">批量替换工具</h3></div>
  184. <div class="panel-body">
  185. <form onsubmit="return saveAccount(this)" method="post" class="form" role="form">
  186. <div class="alert alert-info" style="word-break:break-all;">使用以下命令可以将bt安装包、更新包和脚本文件里面的<code>http://www.example.com</code>批量替换成当前网址<code>{:request()->root(true)}</code>,每次更新版本后只需要执行一次即可。</div>
  187. <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/>
  188. </form>
  189. </div>
  190. </div>
  191. <div class="panel panel-primary">
  192. <div class="panel-heading"><h3 class="panel-title">清理旧版本插件工具</h3></div>
  193. <div class="panel-body">
  194. <form onsubmit="return saveAccount(this)" method="post" class="form" role="form">
  195. <div class="alert alert-info" style="word-break:break-all;">使用以下命令可清理旧版本的插件文件,以释放空间占用。</div>
  196. <div class="list-group-item" style="word-break:break-all;">php {:app()->getRootPath()}think clean</div><br/>
  197. </form>
  198. </div>
  199. </div>
  200. {/if}
  201. <script src="//cdn.staticfile.org/layer/3.5.1/layer.js"></script>
  202. <script>
  203. $(document).ready(function(){
  204. var items = $("select[default]");
  205. for (i = 0; i < items.length; i++) {
  206. $(items[i]).val($(items[i]).attr("default")||0);
  207. }
  208. $("#testbturl").click(function(){
  209. var bt_url = $("input[name=bt_url]").val();
  210. var bt_key = $("input[name=bt_key]").val();
  211. if(bt_url == ''){
  212. layer.alert('宝塔面板URL不能为空');return;
  213. }
  214. if(bt_url.indexOf('http://')==-1 && bt_url.indexOf('https://')==-1){
  215. layer.alert('宝塔面板URL不正确');return;
  216. }
  217. if(bt_key == ''){
  218. layer.alert('宝塔面板接口密钥不能为空');return;
  219. }
  220. var ii = layer.load(2, {shade:[0.1,'#fff']});
  221. $.ajax({
  222. type : 'POST',
  223. url : '/admin/testbturl',
  224. data : {bt_url:bt_url, bt_key:bt_key},
  225. dataType : 'json',
  226. success : function(data) {
  227. layer.close(ii);
  228. if(data.code == 0){
  229. layer.msg(data.msg, {icon: 1, time:1000})
  230. }else{
  231. layer.alert(data.msg, {icon: 2})
  232. }
  233. },
  234. error:function(data){
  235. layer.close(ii);
  236. layer.msg('服务器错误');
  237. }
  238. });
  239. })
  240. $("#testbturl2").click(function(){
  241. var wbt_url = $("input[name=wbt_url]").val();
  242. var wbt_key = $("input[name=wbt_key]").val();
  243. if(wbt_url == ''){
  244. layer.alert('宝塔面板URL不能为空');return;
  245. }
  246. if(wbt_url.indexOf('http://')==-1 && wbt_url.indexOf('https://')==-1){
  247. layer.alert('宝塔面板URL不正确');return;
  248. }
  249. if(wbt_key == ''){
  250. layer.alert('宝塔面板接口密钥不能为空');return;
  251. }
  252. var ii = layer.load(2, {shade:[0.1,'#fff']});
  253. $.ajax({
  254. type : 'POST',
  255. url : '/admin/testbturl',
  256. data : {bt_url:wbt_url, bt_key:wbt_key},
  257. dataType : 'json',
  258. success : function(data) {
  259. layer.close(ii);
  260. if(data.code == 0){
  261. layer.msg(data.msg, {icon: 1, time:1000})
  262. }else{
  263. layer.alert(data.msg, {icon: 2})
  264. }
  265. },
  266. error:function(data){
  267. layer.close(ii);
  268. layer.msg('服务器错误');
  269. }
  270. });
  271. })
  272. })
  273. function saveSetting(obj){
  274. var ii = layer.load(2, {shade:[0.1,'#fff']});
  275. $.ajax({
  276. type : 'POST',
  277. url : '/admin/set',
  278. data : $(obj).serialize(),
  279. dataType : 'json',
  280. success : function(data) {
  281. layer.close(ii);
  282. if(data.code == 0){
  283. layer.alert('设置保存成功!', {
  284. icon: 1,
  285. closeBtn: false
  286. }, function(){
  287. window.location.reload()
  288. });
  289. }else{
  290. layer.alert(data.msg, {icon: 2})
  291. }
  292. },
  293. error:function(data){
  294. layer.close(ii);
  295. layer.msg('服务器错误');
  296. }
  297. });
  298. return false;
  299. }
  300. function saveAccount(obj){
  301. var ii = layer.load(2, {shade:[0.1,'#fff']});
  302. $.ajax({
  303. type : 'POST',
  304. url : '/admin/setaccount',
  305. data : $(obj).serialize(),
  306. dataType : 'json',
  307. success : function(data) {
  308. layer.close(ii);
  309. if(data.code == 0){
  310. layer.alert('管理账号保存成功!请重新登录。', {
  311. icon: 1,
  312. closeBtn: false
  313. }, function(){
  314. window.location.reload()
  315. });
  316. }else{
  317. layer.alert(data.msg, {icon: 2})
  318. }
  319. },
  320. error:function(data){
  321. layer.close(ii);
  322. layer.msg('服务器错误');
  323. }
  324. });
  325. return false;
  326. }
  327. function cleancache(){
  328. var ii = layer.load(2, {shade:[0.1,'#fff']});
  329. $.ajax({
  330. type : 'GET',
  331. url : '/admin/cleancache',
  332. dataType : 'json',
  333. success : function(data) {
  334. layer.close(ii);
  335. layer.msg('清理缓存成功', {icon: 1});
  336. },
  337. error:function(data){
  338. layer.close(ii);
  339. layer.msg('服务器错误');
  340. }
  341. });
  342. }
  343. </script>
  344. {/block}