]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/bots.ts
Move config in its own file
[github/Chocobozzz/PeerTube.git] / server / controllers / bots.ts
index 2db86a2d8e63b4e30cb140f1d570c9c74fec9ffb..58ead4799d4e5f4dd5f477c4070c82638dceaf0e 100644 (file)
@@ -1,6 +1,6 @@
 import * as express from 'express'
 import { asyncMiddleware } from '../middlewares'
-import { CONFIG, ROUTE_CACHE_LIFETIME } from '../initializers'
+import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers'
 import * as sitemapModule from 'sitemap'
 import { logger } from '../helpers/logger'
 import { VideoModel } from '../models/video/video'
@@ -35,7 +35,7 @@ async function getSitemap (req: express.Request, res: express.Response) {
   urls = urls.concat(await getSitemapAccountUrls())
 
   const sitemap = sitemapModule.createSitemap({
-    hostname: CONFIG.WEBSERVER.URL,
+    hostname: WEBSERVER.URL,
     urls: urls
   })
 
@@ -54,7 +54,7 @@ async function getSitemapVideoChannelUrls () {
   const rows = await VideoChannelModel.listLocalsForSitemap('createdAt')
 
   return rows.map(channel => ({
-    url: CONFIG.WEBSERVER.URL + '/video-channels/' + channel.Actor.preferredUsername
+    url: WEBSERVER.URL + '/video-channels/' + channel.Actor.preferredUsername
   }))
 }
 
@@ -62,7 +62,7 @@ async function getSitemapAccountUrls () {
   const rows = await AccountModel.listLocalsForSitemap('createdAt')
 
   return rows.map(channel => ({
-    url: CONFIG.WEBSERVER.URL + '/accounts/' + channel.Actor.preferredUsername
+    url: WEBSERVER.URL + '/accounts/' + channel.Actor.preferredUsername
   }))
 }
 
@@ -78,14 +78,14 @@ async function getSitemapLocalVideoUrls () {
   })
 
   return resultList.data.map(v => ({
-    url: CONFIG.WEBSERVER.URL + '/videos/watch/' + v.uuid,
+    url: WEBSERVER.URL + '/videos/watch/' + v.uuid,
     video: [
       {
         title: v.name,
         // Sitemap description should be < 2000 characters
         description: truncate(v.description || v.name, { length: 2000, omission: '...' }),
-        player_loc: CONFIG.WEBSERVER.URL + '/videos/embed/' + v.uuid,
-        thumbnail_loc: CONFIG.WEBSERVER.URL + v.getThumbnailStaticPath()
+        player_loc: WEBSERVER.URL + '/videos/embed/' + v.uuid,
+        thumbnail_loc: WEBSERVER.URL + v.getThumbnailStaticPath()
       }
     ]
   }))
@@ -97,5 +97,5 @@ function getSitemapBasicUrls () {
     '/videos/local'
   ]
 
-  return paths.map(p => ({ url: CONFIG.WEBSERVER.URL + p }))
+  return paths.map(p => ({ url: WEBSERVER.URL + p }))
 }