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:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
node_modules
|
||||||
|
.cache
|
||||||
|
dist
|
||||||
1
.npmignore
Normal file
1
.npmignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
LICENSE
|
||||||
5
README.md
Normal file
5
README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Hide Root User PeerTube Plugin
|
||||||
|
|
||||||
|
Prevent the "root" user from showing up in your PeerTube server's public-facing stats. This is useful when you do not
|
||||||
|
use your "root" user for anything, and prevents your server stats from appearing incorrect (e.g. showing 2 users for a
|
||||||
|
single-user instance). This does not hide the actual user, it just subtracts one user from the instance stats.
|
||||||
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,
|
||||||
|
};
|
||||||
12
package-lock.json
generated
Normal file
12
package-lock.json
generated
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "peertube-plugin-hide-root-user",
|
||||||
|
"version": "0.5.0",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "peertube-plugin-hide-root-user",
|
||||||
|
"version": "0.5.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
package.json
Normal file
26
package.json
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "peertube-plugin-hide-root-user",
|
||||||
|
"description": "Prevents the \"root\" user from showing up in your PeerTube server's public-facing stats. Useful only when the root account isn't actually being used on your instance.",
|
||||||
|
"version": "0.5.0",
|
||||||
|
"license": "AGPL-3.0-or-later",
|
||||||
|
"author": {
|
||||||
|
"name": "Dave Jansen",
|
||||||
|
"email": "i.am@davejansen.com",
|
||||||
|
"url": "https://www.davejansen.com/"
|
||||||
|
},
|
||||||
|
"bugs": "https://git.davejansen.com/davejansen/peertube-plugin-hide-root-user/issues",
|
||||||
|
"engine": {
|
||||||
|
"peertube": ">=6.0.0"
|
||||||
|
},
|
||||||
|
"homepage": "https://git.davejansen.com/davejansen/peertube-plugin-hide-root-user",
|
||||||
|
"keywords": [
|
||||||
|
"peertube",
|
||||||
|
"plugin"
|
||||||
|
],
|
||||||
|
"library": "./main.js",
|
||||||
|
|
||||||
|
"css": [],
|
||||||
|
"clientScripts": [],
|
||||||
|
"staticDirs": {},
|
||||||
|
"translations": {}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user