1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Fix nodeinfo local posts

This commit is contained in:
Chocobozzz 2025-04-15 09:36:56 +02:00
parent 8f87a6cd9f
commit d6f7b471de
No known key found for this signature in database
GPG key ID: 583A612D890159BE

View file

@ -16,36 +16,21 @@ const miscRouter = express.Router()
miscRouter.use(cors())
miscRouter.use('/nodeinfo/:version.json',
apiRateLimiter,
cacheRoute(ROUTE_CACHE_LIFETIME.NODEINFO),
asyncMiddleware(generateNodeinfo)
)
miscRouter.use('/nodeinfo/:version.json', apiRateLimiter, cacheRoute(ROUTE_CACHE_LIFETIME.NODEINFO), asyncMiddleware(generateNodeinfo))
// robots.txt service
miscRouter.get('/robots.txt',
apiRateLimiter,
cacheRoute(ROUTE_CACHE_LIFETIME.ROBOTS),
(_, res: express.Response) => {
miscRouter.get('/robots.txt', apiRateLimiter, cacheRoute(ROUTE_CACHE_LIFETIME.ROBOTS), (_, res: express.Response) => {
res.type('text/plain')
return res.send(CONFIG.INSTANCE.ROBOTS)
}
)
})
miscRouter.all('/teapot',
apiRateLimiter,
getCup,
asyncMiddleware(serveIndexHTML)
)
miscRouter.all('/teapot', apiRateLimiter, getCup, asyncMiddleware(serveIndexHTML))
// security.txt service
miscRouter.get('/security.txt',
apiRateLimiter,
(_, res: express.Response) => {
miscRouter.get('/security.txt', apiRateLimiter, (_, res: express.Response) => {
return res.redirect(HttpStatusCode.MOVED_PERMANENTLY_301, '/.well-known/security.txt')
}
)
})
// ---------------------------------------------------------------------------
@ -56,7 +41,7 @@ export {
// ---------------------------------------------------------------------------
async function generateNodeinfo (req: express.Request, res: express.Response) {
const { totalVideos } = await VideoModel.getStats()
const { totalLocalVideos } = await VideoModel.getStats()
const { totalLocalVideoComments } = await VideoCommentModel.getStats()
const { totalUsers, totalMonthlyActiveUsers, totalHalfYearActiveUsers } = await UserModel.getStats()
@ -90,7 +75,7 @@ async function generateNodeinfo (req: express.Request, res: express.Response) {
activeMonth: totalMonthlyActiveUsers,
activeHalfyear: totalHalfYearActiveUsers
},
localPosts: totalVideos,
localPosts: totalLocalVideos,
localComments: totalLocalVideoComments
},
metadata: {