Support activeMonth and activeHalfyear in nodeinfo
This commit is contained in:
parent
a046453549
commit
47d8e266f1
|
@ -206,7 +206,7 @@ export {
|
||||||
async function generateNodeinfo (req: express.Request, res: express.Response) {
|
async function generateNodeinfo (req: express.Request, res: express.Response) {
|
||||||
const { totalVideos } = await VideoModel.getStats()
|
const { totalVideos } = await VideoModel.getStats()
|
||||||
const { totalLocalVideoComments } = await VideoCommentModel.getStats()
|
const { totalLocalVideoComments } = await VideoCommentModel.getStats()
|
||||||
const { totalUsers } = await UserModel.getStats()
|
const { totalUsers, totalMonthlyActiveUsers, totalHalfYearActiveUsers } = await UserModel.getStats()
|
||||||
let json = {}
|
let json = {}
|
||||||
|
|
||||||
if (req.params.version && (req.params.version === '2.0')) {
|
if (req.params.version && (req.params.version === '2.0')) {
|
||||||
|
@ -229,7 +229,9 @@ async function generateNodeinfo (req: express.Request, res: express.Response) {
|
||||||
openRegistrations: CONFIG.SIGNUP.ENABLED,
|
openRegistrations: CONFIG.SIGNUP.ENABLED,
|
||||||
usage: {
|
usage: {
|
||||||
users: {
|
users: {
|
||||||
total: totalUsers
|
total: totalUsers,
|
||||||
|
activeMonth: totalMonthlyActiveUsers,
|
||||||
|
activeHalfyear: totalHalfYearActiveUsers
|
||||||
},
|
},
|
||||||
localPosts: totalVideos,
|
localPosts: totalVideos,
|
||||||
localComments: totalLocalVideoComments
|
localComments: totalLocalVideoComments
|
||||||
|
|
|
@ -794,12 +794,14 @@ export class UserModel extends Model {
|
||||||
const totalDailyActiveUsers = await getActiveUsers(1)
|
const totalDailyActiveUsers = await getActiveUsers(1)
|
||||||
const totalWeeklyActiveUsers = await getActiveUsers(7)
|
const totalWeeklyActiveUsers = await getActiveUsers(7)
|
||||||
const totalMonthlyActiveUsers = await getActiveUsers(30)
|
const totalMonthlyActiveUsers = await getActiveUsers(30)
|
||||||
|
const totalHalfYearActiveUsers = await getActiveUsers(180)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
totalUsers,
|
totalUsers,
|
||||||
totalDailyActiveUsers,
|
totalDailyActiveUsers,
|
||||||
totalWeeklyActiveUsers,
|
totalWeeklyActiveUsers,
|
||||||
totalMonthlyActiveUsers
|
totalMonthlyActiveUsers,
|
||||||
|
totalHalfYearActiveUsers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,8 @@ describe('Test misc endpoints', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(res.body.software.name).to.equal('peertube')
|
expect(res.body.software.name).to.equal('peertube')
|
||||||
|
expect(res.body.usage.users.activeMonth).to.equal(1)
|
||||||
|
expect(res.body.usage.users.activeHalfyear).to.equal(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue