X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fbots.ts;h=ed10401768560c3cb56117006edd03c64d5a36c8;hb=5d9e4eaabe87ff1b115114b01075b9fabd2b0c5e;hp=58ead4799d4e5f4dd5f477c4070c82638dceaf0e;hpb=6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/bots.ts b/server/controllers/bots.ts index 58ead4799..ed1040176 100644 --- a/server/controllers/bots.ts +++ b/server/controllers/bots.ts @@ -1,8 +1,7 @@ import * as express from 'express' import { asyncMiddleware } from '../middlewares' -import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers' +import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' import * as sitemapModule from 'sitemap' -import { logger } from '../helpers/logger' import { VideoModel } from '../models/video/video' import { VideoChannelModel } from '../models/video/video-channel' import { AccountModel } from '../models/account/account' @@ -39,15 +38,10 @@ async function getSitemap (req: express.Request, res: express.Response) { urls: urls }) - sitemap.toXML((err, xml) => { - if (err) { - logger.error('Cannot generate sitemap.', { err }) - return res.sendStatus(500) - } + const xml = sitemap.toXML() - res.header('Content-Type', 'application/xml') - res.send(xml) - }) + res.header('Content-Type', 'application/xml') + res.send(xml) } async function getSitemapVideoChannelUrls () { @@ -85,7 +79,7 @@ async function getSitemapLocalVideoUrls () { // Sitemap description should be < 2000 characters description: truncate(v.description || v.name, { length: 2000, omission: '...' }), player_loc: WEBSERVER.URL + '/videos/embed/' + v.uuid, - thumbnail_loc: WEBSERVER.URL + v.getThumbnailStaticPath() + thumbnail_loc: WEBSERVER.URL + v.getMiniatureStaticPath() } ] }))