diff options
Diffstat (limited to 'server/controllers/bots.ts')
-rw-r--r-- | server/controllers/bots.ts | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/server/controllers/bots.ts b/server/controllers/bots.ts index 9e92063d4..de0411608 100644 --- a/server/controllers/bots.ts +++ b/server/controllers/bots.ts | |||
@@ -1,20 +1,20 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { asyncMiddleware } from '../middlewares' | 2 | import { truncate } from 'lodash' |
3 | import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' | ||
4 | import { SitemapStream, streamToPromise } from 'sitemap' | 3 | import { SitemapStream, streamToPromise } from 'sitemap' |
4 | import { buildNSFWFilter } from '../helpers/express-utils' | ||
5 | import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' | ||
6 | import { asyncMiddleware } from '../middlewares' | ||
7 | import { cacheRoute } from '../middlewares/cache/cache' | ||
8 | import { AccountModel } from '../models/account/account' | ||
5 | import { VideoModel } from '../models/video/video' | 9 | import { VideoModel } from '../models/video/video' |
6 | import { VideoChannelModel } from '../models/video/video-channel' | 10 | import { VideoChannelModel } from '../models/video/video-channel' |
7 | import { AccountModel } from '../models/account/account' | ||
8 | import { cacheRoute } from '../middlewares/cache' | ||
9 | import { buildNSFWFilter } from '../helpers/express-utils' | ||
10 | import { truncate } from 'lodash' | ||
11 | 11 | ||
12 | const botsRouter = express.Router() | 12 | const botsRouter = express.Router() |
13 | 13 | ||
14 | // Special route that add OpenGraph and oEmbed tags | 14 | // Special route that add OpenGraph and oEmbed tags |
15 | // Do not use a template engine for a so little thing | 15 | // Do not use a template engine for a so little thing |
16 | botsRouter.use('/sitemap.xml', | 16 | botsRouter.use('/sitemap.xml', |
17 | asyncMiddleware(cacheRoute()(ROUTE_CACHE_LIFETIME.SITEMAP)), | 17 | cacheRoute(ROUTE_CACHE_LIFETIME.SITEMAP), |
18 | asyncMiddleware(getSitemap) | 18 | asyncMiddleware(getSitemap) |
19 | ) | 19 | ) |
20 | 20 | ||
@@ -75,13 +75,13 @@ async function getSitemapLocalVideoUrls () { | |||
75 | }) | 75 | }) |
76 | 76 | ||
77 | return data.map(v => ({ | 77 | return data.map(v => ({ |
78 | url: WEBSERVER.URL + '/w/' + v.uuid, | 78 | url: WEBSERVER.URL + v.getWatchStaticPath(), |
79 | video: [ | 79 | video: [ |
80 | { | 80 | { |
81 | title: v.name, | 81 | title: v.name, |
82 | // Sitemap description should be < 2000 characters | 82 | // Sitemap description should be < 2000 characters |
83 | description: truncate(v.description || v.name, { length: 2000, omission: '...' }), | 83 | description: truncate(v.description || v.name, { length: 2000, omission: '...' }), |
84 | player_loc: WEBSERVER.URL + '/videos/embed/' + v.uuid, | 84 | player_loc: WEBSERVER.URL + v.getEmbedStaticPath(), |
85 | thumbnail_loc: WEBSERVER.URL + v.getMiniatureStaticPath() | 85 | thumbnail_loc: WEBSERVER.URL + v.getMiniatureStaticPath() |
86 | } | 86 | } |
87 | ] | 87 | ] |