mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 18:29:27 +02:00
Fix nodeinfo local posts
This commit is contained in:
parent
8f87a6cd9f
commit
d6f7b471de
1 changed files with 13 additions and 28 deletions
|
@ -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: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue