add-baidu-stat

This commit is contained in:
unknown
2025-04-05 17:46:25 +08:00
parent 16213d73b6
commit e5d80e01b6
4 changed files with 20 additions and 5 deletions

View File

@@ -100,10 +100,11 @@ https://gitee.com/bnu_mixly/mixio-linux-x86-dist/blob/darwin/mixio
15. OFFLINE_MODE - bool是否禁用天气/地图数据默认为true
16. BAIDU_MAP_AK - string百度地图客户端应用AKOFFLINE_MODE=false时必须配置默认为""
17. BAIDU_MAP_SERVER_AK - string百度地图服务端应用AKOFFLINE_MODE=false时必须配置默认为""
18. ADMIN_USERNAME - string管理后台用户名默认为"admin"
19. ADMIN_PASSWORD - string管理后台密码,默认为"public"
20. STORAGE_ENGINE - string数据库引擎默认为"sqlite"
21. MYSQL_HOST - stringMySQL地址STORAGE_ENGINE="mysql"时必须配置),默认为"localhost"
18. BAIDU_STAT_LINK - string, 百度统计链接,通常以"https://hm.baidu.com/hm.js?"开头
19. ADMIN_USERNAME - string管理后台用户名,默认为"admin"
20. ADMIN_PASSWORD - string管理后台密码默认为"public"
21. STORAGE_ENGINE - string数据库引擎默认为"sqlite"
22. MYSQL_HOST - stringMySQL地址STORAGE_ENGINE="mysql"时必须配置),默认为"localhost"
23. MYSQL_PORT - intMySQL地址STORAGE_ENGINE="mysql"时必须配置默认为3306
24. MYSQL_USER - stringMySQL用户名STORAGE_ENGINE="mysql"时必须配置),默认为""
25. MYSQL_PASS - stringMySQL密码STORAGE_ENGINE="mysql"时必须配置),默认为""

View File

@@ -16,6 +16,7 @@
<script src="js/lang.js?v=5"></script>
<script src="js/tools.js?v=10"></script>
<script src="js/login.js?v=22"></script>
<script src="<%=configs["BAIDU_STAT_LINK"]%>"></script>
</head>
<body id="body" class="bg-gradient-light" style="height:100vh">

View File

@@ -258,6 +258,14 @@
<input type="text" id="BAIDU_MAP_SERVER_AK">
</td>
</tr>
<tr>
<td>
<span>百度统计链接AK</span>
</td>
<td>
<input type="text" id="BAIDU_STAT_LINK">
</td>
</tr>
</table>
<button class="btn btn-lg btn-success" style="margin-top:20px;" onclick="saveAndRestart()" id="saveAndRestart"><i class="fa fa-check"></i> 保存设置并重新启动</button>
</div>
@@ -354,6 +362,7 @@
var OFFLINE_MODE = <%=configs["OFFLINE_MODE"]%>
var BAIDU_MAP_AK = "<%=configs["BAIDU_MAP_AK"]%>"
var BAIDU_MAP_SERVER_AK = "<%=configs["BAIDU_MAP_SERVER_AK"]%>"
var BAIDU_STAT_LINK = "<%=configs["BAIDU_STAT_LINK"]%>"
var ADMIN_USERNAME = "<%=configs["ADMIN_USERNAME"]%>"
var ADMIN_PASSWORD = "<%=configs["ADMIN_PASSWORD"]%>"
$("#OFFLINE_MODE").bind('change',function(){
@@ -386,6 +395,7 @@
$("#MAX_MESSAGE_PER_SECOND").val(MAX_MESSAGE_PER_SECOND)
$("#ADMIN_USERNAME").val(ADMIN_USERNAME)
$("#ADMIN_PASSWORD").val(ADMIN_PASSWORD)
$("#BAIDU_STAT_LINK").val(BAIDU_STAT_LINK)
if($("#OFFLINE_MODE").prop("checked"))
{
$("#BAIDU_MAP_AK").attr("disabled","true")
@@ -420,6 +430,7 @@
configs["BAIDU_MAP_SERVER_AK"] = $("#BAIDU_MAP_SERVER_AK").val()
configs["ADMIN_USERNAME"] = $("#ADMIN_USERNAME").val()
configs["ADMIN_PASSWORD"] = $("#ADMIN_PASSWORD").val()
configs["BAIDU_STAT_LINK"] = $("#BAIDU_STAT_LINK").val()
$.get('/saveAndRestart',{'configs':JSON.stringify(configs,null,2)},function(res){
if(res=="1")
{

View File

@@ -123,6 +123,7 @@ function init(cb){
"OFFLINE_MODE": true,
"BAIDU_MAP_AK": "",
"BAIDU_MAP_SERVER_AK": "",
"BAIDU_STAT_LINK": "",
"ADMIN_USERNAME":"admin",
"ADMIN_PASSWORD":"public",
"STORAGE_ENGINE":"sqlite",
@@ -965,7 +966,8 @@ var mixioServer = function() {
app.get('/index', function(req, res) {
ejs.renderFile(__dirname + '/ejs/index.ejs', {
'main':fs.existsSync("config/certs/chain.crt"),
'mixly':fs.existsSync("../mixly")
'mixly':fs.existsSync("../mixly"),
'configs': configs
}, function(err, data) {
res.send(data)
})