You've already forked peertube-plugin-hide-root-user
Initial commit.
- Only modifies the total*User values of /api/v1/server/stats.
This commit is contained in:
56
main.js
Normal file
56
main.js
Normal file
@@ -0,0 +1,56 @@
|
||||
async function register ({
|
||||
registerHook,
|
||||
registerSetting,
|
||||
settingsManager,
|
||||
storageManager,
|
||||
videoCategoryManager,
|
||||
videoLicenceManager,
|
||||
videoLanguageManager,
|
||||
}) {
|
||||
registerHook({
|
||||
target: 'filter:api.server.stats.get.result',
|
||||
handler: (data) => {
|
||||
if (!data) return {};
|
||||
|
||||
let {
|
||||
totalUsers,
|
||||
totalDailyActiveUsers,
|
||||
totalWeeklyActiveUsers,
|
||||
totalMonthlyActiveUsers,
|
||||
} = data;
|
||||
|
||||
if (totalUsers > 1) {
|
||||
totalUsers = totalUsers - 1;
|
||||
}
|
||||
|
||||
if (totalDailyActiveUsers > totalUsers) {
|
||||
totalDailyActiveUsers = totalUsers;
|
||||
}
|
||||
|
||||
if (totalWeeklyActiveUsers > totalUsers) {
|
||||
totalWeeklyActiveUsers = totalUsers;
|
||||
}
|
||||
|
||||
if (totalMonthlyActiveUsers > totalUsers) {
|
||||
totalMonthlyActiveUsers = totalUsers;
|
||||
}
|
||||
|
||||
return {
|
||||
...data,
|
||||
totalUsers,
|
||||
totalDailyActiveUsers,
|
||||
totalWeeklyActiveUsers,
|
||||
totalMonthlyActiveUsers,
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister,
|
||||
};
|
||||
Reference in New Issue
Block a user