aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/bots.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-11 11:33:44 +0200
committerChocobozzz <me@florianbigard.com>2019-04-11 13:45:39 +0200
commit6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0 (patch)
treeb47de7efb8c6c611c63a15a971c6125a278f547a /server/controllers/bots.ts
parent2c3abc4fa796555eb7d25f416c4f41ab3e3ad8ca (diff)
downloadPeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.tar.gz
PeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.tar.zst
PeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.zip
Move config in its own file
Diffstat (limited to 'server/controllers/bots.ts')
-rw-r--r--server/controllers/bots.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/server/controllers/bots.ts b/server/controllers/bots.ts
index 2db86a2d8..58ead4799 100644
--- a/server/controllers/bots.ts
+++ b/server/controllers/bots.ts
@@ -1,6 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2import { asyncMiddleware } from '../middlewares' 2import { asyncMiddleware } from '../middlewares'
3import { CONFIG, ROUTE_CACHE_LIFETIME } from '../initializers' 3import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers'
4import * as sitemapModule from 'sitemap' 4import * as sitemapModule from 'sitemap'
5import { logger } from '../helpers/logger' 5import { logger } from '../helpers/logger'
6import { VideoModel } from '../models/video/video' 6import { VideoModel } from '../models/video/video'
@@ -35,7 +35,7 @@ async function getSitemap (req: express.Request, res: express.Response) {
35 urls = urls.concat(await getSitemapAccountUrls()) 35 urls = urls.concat(await getSitemapAccountUrls())
36 36
37 const sitemap = sitemapModule.createSitemap({ 37 const sitemap = sitemapModule.createSitemap({
38 hostname: CONFIG.WEBSERVER.URL, 38 hostname: WEBSERVER.URL,
39 urls: urls 39 urls: urls
40 }) 40 })
41 41
@@ -54,7 +54,7 @@ async function getSitemapVideoChannelUrls () {
54 const rows = await VideoChannelModel.listLocalsForSitemap('createdAt') 54 const rows = await VideoChannelModel.listLocalsForSitemap('createdAt')
55 55
56 return rows.map(channel => ({ 56 return rows.map(channel => ({
57 url: CONFIG.WEBSERVER.URL + '/video-channels/' + channel.Actor.preferredUsername 57 url: WEBSERVER.URL + '/video-channels/' + channel.Actor.preferredUsername
58 })) 58 }))
59} 59}
60 60
@@ -62,7 +62,7 @@ async function getSitemapAccountUrls () {
62 const rows = await AccountModel.listLocalsForSitemap('createdAt') 62 const rows = await AccountModel.listLocalsForSitemap('createdAt')
63 63
64 return rows.map(channel => ({ 64 return rows.map(channel => ({
65 url: CONFIG.WEBSERVER.URL + '/accounts/' + channel.Actor.preferredUsername 65 url: WEBSERVER.URL + '/accounts/' + channel.Actor.preferredUsername
66 })) 66 }))
67} 67}
68 68
@@ -78,14 +78,14 @@ async function getSitemapLocalVideoUrls () {
78 }) 78 })
79 79
80 return resultList.data.map(v => ({ 80 return resultList.data.map(v => ({
81 url: CONFIG.WEBSERVER.URL + '/videos/watch/' + v.uuid, 81 url: WEBSERVER.URL + '/videos/watch/' + v.uuid,
82 video: [ 82 video: [
83 { 83 {
84 title: v.name, 84 title: v.name,
85 // Sitemap description should be < 2000 characters 85 // Sitemap description should be < 2000 characters
86 description: truncate(v.description || v.name, { length: 2000, omission: '...' }), 86 description: truncate(v.description || v.name, { length: 2000, omission: '...' }),
87 player_loc: CONFIG.WEBSERVER.URL + '/videos/embed/' + v.uuid, 87 player_loc: WEBSERVER.URL + '/videos/embed/' + v.uuid,
88 thumbnail_loc: CONFIG.WEBSERVER.URL + v.getThumbnailStaticPath() 88 thumbnail_loc: WEBSERVER.URL + v.getThumbnailStaticPath()
89 } 89 }
90 ] 90 ]
91 })) 91 }))
@@ -97,5 +97,5 @@ function getSitemapBasicUrls () {
97 '/videos/local' 97 '/videos/local'
98 ] 98 ]
99 99
100 return paths.map(p => ({ url: CONFIG.WEBSERVER.URL + p })) 100 return paths.map(p => ({ url: WEBSERVER.URL + p }))
101} 101}