]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/static.ts
Remove comment federation by video owner
[github/Chocobozzz/PeerTube.git] / server / controllers / static.ts
index fb2e7742a06dfefa9a8bf0e8fe9f544e9cb9808c..110d25031ea08c5dad7881327c9b88351a23ef44 100644 (file)
@@ -2,6 +2,7 @@ import * as cors from 'cors'
 import * as express from 'express'
 import {
   HLS_STREAMING_PLAYLIST_DIRECTORY,
+  PEERTUBE_VERSION,
   ROUTE_CACHE_LIFETIME,
   STATIC_DOWNLOAD_PATHS,
   STATIC_MAX_AGE,
@@ -19,7 +20,6 @@ import { join } from 'path'
 import { root } from '../helpers/core-utils'
 import { CONFIG } from '../initializers/config'
 
-const packageJSON = require('../../../package.json')
 const staticRouter = express.Router()
 
 staticRouter.use(cors())
@@ -69,13 +69,13 @@ staticRouter.use(
 const thumbnailsPhysicalPath = CONFIG.STORAGE.THUMBNAILS_DIR
 staticRouter.use(
   STATIC_PATHS.THUMBNAILS,
-  express.static(thumbnailsPhysicalPath, { maxAge: STATIC_MAX_AGE, fallthrough: false }) // 404 if the file does not exist
+  express.static(thumbnailsPhysicalPath, { maxAge: STATIC_MAX_AGE.SERVER, fallthrough: false }) // 404 if the file does not exist
 )
 
 const avatarsPhysicalPath = CONFIG.STORAGE.AVATARS_DIR
 staticRouter.use(
   STATIC_PATHS.AVATARS,
-  express.static(avatarsPhysicalPath, { maxAge: STATIC_MAX_AGE, fallthrough: false }) // 404 if the file does not exist
+  express.static(avatarsPhysicalPath, { maxAge: STATIC_MAX_AGE.SERVER, fallthrough: false }) // 404 if the file does not exist
 )
 
 // We don't have video previews, fetch them from the origin instance
@@ -194,7 +194,7 @@ async function getVideoCaption (req: express.Request, res: express.Response) {
   return res.sendFile(result.path, { maxAge: STATIC_MAX_AGE })
 }
 
-async function generateNodeinfo (req: express.Request, res: express.Response, next: express.NextFunction) {
+async function generateNodeinfo (req: express.Request, res: express.Response) {
   const { totalVideos } = await VideoModel.getStats()
   const { totalLocalVideoComments } = await VideoCommentModel.getStats()
   const { totalUsers } = await UserModel.getStats()
@@ -205,7 +205,7 @@ async function generateNodeinfo (req: express.Request, res: express.Response, ne
       version: '2.0',
       software: {
         name: 'peertube',
-        version: packageJSON.version
+        version: PEERTUBE_VERSION
       },
       protocols: [
         'activitypub'