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.

334 lines
15 KiB

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. {/if}
  192. <script src="//cdn.staticfile.org/layer/3.5.1/layer.js"></script>
  193. <script>
  194. $(document).ready(function(){
  195. var items = $("select[default]");
  196. for (i = 0; i < items.length; i++) {
  197. $(items[i]).val($(items[i]).attr("default")||0);
  198. }
  199. $("#testbturl").click(function(){
  200. var bt_url = $("input[name=bt_url]").val();
  201. var bt_key = $("input[name=bt_key]").val();
  202. if(bt_url == ''){
  203. layer.alert('宝塔面板URL不能为空');return;
  204. }
  205. if(bt_url.indexOf('http://')==-1 && bt_url.indexOf('https://')==-1){
  206. layer.alert('宝塔面板URL不正确');return;
  207. }
  208. if(bt_key == ''){
  209. layer.alert('宝塔面板接口密钥不能为空');return;
  210. }
  211. var ii = layer.load(2, {shade:[0.1,'#fff']});
  212. $.ajax({
  213. type : 'POST',
  214. url : '/admin/testbturl',
  215. data : {bt_url:bt_url, bt_key:bt_key},
  216. dataType : 'json',
  217. success : function(data) {
  218. layer.close(ii);
  219. if(data.code == 0){
  220. layer.msg(data.msg, {icon: 1, time:1000})
  221. }else{
  222. layer.alert(data.msg, {icon: 2})
  223. }
  224. },
  225. error:function(data){
  226. layer.close(ii);
  227. layer.msg('服务器错误');
  228. }
  229. });
  230. })
  231. $("#testbturl2").click(function(){
  232. var wbt_url = $("input[name=wbt_url]").val();
  233. var wbt_key = $("input[name=wbt_key]").val();
  234. if(wbt_url == ''){
  235. layer.alert('宝塔面板URL不能为空');return;
  236. }
  237. if(wbt_url.indexOf('http://')==-1 && wbt_url.indexOf('https://')==-1){
  238. layer.alert('宝塔面板URL不正确');return;
  239. }
  240. if(wbt_key == ''){
  241. layer.alert('宝塔面板接口密钥不能为空');return;
  242. }
  243. var ii = layer.load(2, {shade:[0.1,'#fff']});
  244. $.ajax({
  245. type : 'POST',
  246. url : '/admin/testbturl',
  247. data : {bt_url:wbt_url, bt_key:wbt_key},
  248. dataType : 'json',
  249. success : function(data) {
  250. layer.close(ii);
  251. if(data.code == 0){
  252. layer.msg(data.msg, {icon: 1, time:1000})
  253. }else{
  254. layer.alert(data.msg, {icon: 2})
  255. }
  256. },
  257. error:function(data){
  258. layer.close(ii);
  259. layer.msg('服务器错误');
  260. }
  261. });
  262. })
  263. })
  264. function saveSetting(obj){
  265. var ii = layer.load(2, {shade:[0.1,'#fff']});
  266. $.ajax({
  267. type : 'POST',
  268. url : '/admin/set',
  269. data : $(obj).serialize(),
  270. dataType : 'json',
  271. success : function(data) {
  272. layer.close(ii);
  273. if(data.code == 0){
  274. layer.alert('设置保存成功!', {
  275. icon: 1,
  276. closeBtn: false
  277. }, function(){
  278. window.location.reload()
  279. });
  280. }else{
  281. layer.alert(data.msg, {icon: 2})
  282. }
  283. },
  284. error:function(data){
  285. layer.close(ii);
  286. layer.msg('服务器错误');
  287. }
  288. });
  289. return false;
  290. }
  291. function saveAccount(obj){
  292. var ii = layer.load(2, {shade:[0.1,'#fff']});
  293. $.ajax({
  294. type : 'POST',
  295. url : '/admin/setaccount',
  296. data : $(obj).serialize(),
  297. dataType : 'json',
  298. success : function(data) {
  299. layer.close(ii);
  300. if(data.code == 0){
  301. layer.alert('管理账号保存成功!请重新登录。', {
  302. icon: 1,
  303. closeBtn: false
  304. }, function(){
  305. window.location.reload()
  306. });
  307. }else{
  308. layer.alert(data.msg, {icon: 2})
  309. }
  310. },
  311. error:function(data){
  312. layer.close(ii);
  313. layer.msg('服务器错误');
  314. }
  315. });
  316. return false;
  317. }
  318. function cleancache(){
  319. var ii = layer.load(2, {shade:[0.1,'#fff']});
  320. $.ajax({
  321. type : 'GET',
  322. url : '/admin/cleancache',
  323. dataType : 'json',
  324. success : function(data) {
  325. layer.close(ii);
  326. layer.msg('清理缓存成功', {icon: 1});
  327. },
  328. error:function(data){
  329. layer.close(ii);
  330. layer.msg('服务器错误');
  331. }
  332. });
  333. }
  334. </script>
  335. {/block}