X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fbots.ts;h=63db345bfe0ce0c866fa0d07a7bf366e6a6aa7c4;hb=d8a4c83b9f61791c2a2f4d8dd47fccde0e79d096;hp=9e92063d4ecf1be651ece80990ef35a845b38c62;hpb=1c5e49e75284100b7b1fc8b4e73c8ba53fe22e89;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/bots.ts b/server/controllers/bots.ts index 9e92063d4..63db345bf 100644 --- a/server/controllers/bots.ts +++ b/server/controllers/bots.ts @@ -1,20 +1,20 @@ -import * as express from 'express' -import { asyncMiddleware } from '../middlewares' -import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' +import express from 'express' +import { truncate } from 'lodash' import { SitemapStream, streamToPromise } from 'sitemap' +import { buildNSFWFilter } from '../helpers/express-utils' +import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' +import { asyncMiddleware } from '../middlewares' +import { cacheRoute } from '../middlewares/cache/cache' +import { AccountModel } from '../models/account/account' import { VideoModel } from '../models/video/video' import { VideoChannelModel } from '../models/video/video-channel' -import { AccountModel } from '../models/account/account' -import { cacheRoute } from '../middlewares/cache' -import { buildNSFWFilter } from '../helpers/express-utils' -import { truncate } from 'lodash' const botsRouter = express.Router() // Special route that add OpenGraph and oEmbed tags // Do not use a template engine for a so little thing botsRouter.use('/sitemap.xml', - asyncMiddleware(cacheRoute()(ROUTE_CACHE_LIFETIME.SITEMAP)), + cacheRoute(ROUTE_CACHE_LIFETIME.SITEMAP), asyncMiddleware(getSitemap) ) @@ -75,13 +75,13 @@ async function getSitemapLocalVideoUrls () { }) return data.map(v => ({ - url: WEBSERVER.URL + '/w/' + v.uuid, + url: WEBSERVER.URL + v.getWatchStaticPath(), video: [ { title: v.name, // Sitemap description should be < 2000 characters description: truncate(v.description || v.name, { length: 2000, omission: '...' }), - player_loc: WEBSERVER.URL + '/videos/embed/' + v.uuid, + player_loc: WEBSERVER.URL + v.getEmbedStaticPath(), thumbnail_loc: WEBSERVER.URL + v.getMiniatureStaticPath() } ]