mirror of
https://github.com/MCSManager/MCSManager.git
synced 2025-01-24 15:14:01 +08:00
新增 用户统计功能
This commit is contained in:
parent
72bf8cd19a
commit
31230ba18f
44
package-lock.json
generated
44
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mcsmanager-panel",
|
||||
"version": "9.4.0",
|
||||
"version": "9.4.5",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -462,6 +462,20 @@
|
||||
"integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==",
|
||||
"dev": true
|
||||
},
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||
},
|
||||
"axios": {
|
||||
"version": "0.27.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
|
||||
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.14.9",
|
||||
"form-data": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"backo2": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz",
|
||||
@ -629,6 +643,14 @@
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"dev": true
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"requires": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"component-emitter": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
|
||||
@ -764,6 +786,11 @@
|
||||
"object-keys": "^1.0.12"
|
||||
}
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
|
||||
},
|
||||
"delegates": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
|
||||
@ -1065,6 +1092,21 @@
|
||||
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.4.tgz",
|
||||
"integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw=="
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.15.0",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.0.tgz",
|
||||
"integrity": "sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ=="
|
||||
},
|
||||
"form-data": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"formidable": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.2.tgz",
|
||||
|
@ -17,6 +17,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@koa/router": "^10.0.0",
|
||||
"axios": "^0.27.2",
|
||||
"crypto": "^1.0.1",
|
||||
"koa": "^2.13.1",
|
||||
"koa-body": "^4.2.0",
|
||||
|
@ -28,6 +28,7 @@ import Router from "@koa/router";
|
||||
import "./service/system_user";
|
||||
import "./service/system_visual_data";
|
||||
import "./service/system_remote_service";
|
||||
import "./service/user_statistics";
|
||||
|
||||
// Load routes
|
||||
import overviewRouter from "./routers/private/overview_router";
|
||||
|
48
src/app/service/user_statistics.ts
Normal file
48
src/app/service/user_statistics.ts
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright (C) 2022 Suwings <Suwings@outlook.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
According to the AGPL, it is forbidden to delete all copyright notices,
|
||||
and if you modify the source code, you must open source the
|
||||
modified source code.
|
||||
|
||||
版权所有 (C) 2022 Suwings <Suwings@outlook.com>
|
||||
|
||||
该程序是免费软件,您可以重新分发和/或修改据 GNU Affero 通用公共许可证的条款,
|
||||
由自由软件基金会,许可证的第 3 版,或(由您选择)任何更高版本。
|
||||
|
||||
根据 AGPL 与用户协议,您必须保留所有版权声明,如果修改源代码则必须开源修改后的源代码。
|
||||
可以前往 https://mcsmanager.com/ 阅读用户协议,申请闭源开发授权等。
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
|
||||
const st = new Date().toLocaleDateString();
|
||||
|
||||
// 此功能模块用于 MCSManager 用户数据统计,目的是了解现有日活数量与安装数量。
|
||||
// 用户统计将不会发送任何隐私数据,用户数据,系统信息等。
|
||||
// 详情参考:https://mcsmanager.com/agreement.html
|
||||
async function statistics() {
|
||||
return await axios.get("http://statistics.mcsmanager.com/", {
|
||||
params: {
|
||||
st
|
||||
},
|
||||
timeout: 1000 * 10
|
||||
});
|
||||
}
|
||||
|
||||
// 请求 24 小时内只有一次算有效统计,重复请求忽略不计
|
||||
// 这里设置为 24 小时请求一次
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
return await statistics();
|
||||
} catch (error) {
|
||||
// ignore
|
||||
}
|
||||
}, 1000 * 60 * 60 * 24);
|
||||
|
||||
statistics();
|
Loading…
Reference in New Issue
Block a user