aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/bots.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-26 15:04:37 +0200
committerChocobozzz <me@florianbigard.com>2021-07-26 15:04:37 +0200
commit15a7eafb892441957ba7dd6fcbf556086fe5b2b3 (patch)
tree0786bd1a96c7d168a097ffcf5893737db2ab578e /server/controllers/bots.ts
parent9162fdd36300d2478f13d6ad346ec2c323f40faa (diff)
downloadPeerTube-15a7eafb892441957ba7dd6fcbf556086fe5b2b3.tar.gz
PeerTube-15a7eafb892441957ba7dd6fcbf556086fe5b2b3.tar.zst
PeerTube-15a7eafb892441957ba7dd6fcbf556086fe5b2b3.zip
Refactor video links builders
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 93aa0cf30..de0411608 100644
--- a/server/controllers/bots.ts
+++ b/server/controllers/bots.ts
@@ -1,13 +1,13 @@
1import * as express from 'express' 1import * as express from 'express'
2import { asyncMiddleware } from '../middlewares' 2import { truncate } from 'lodash'
3import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants'
4import { SitemapStream, streamToPromise } from 'sitemap' 3import { SitemapStream, streamToPromise } from 'sitemap'
4import { buildNSFWFilter } from '../helpers/express-utils'
5import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants'
6import { asyncMiddleware } from '../middlewares'
7import { cacheRoute } from '../middlewares/cache/cache'
8import { AccountModel } from '../models/account/account'
5import { VideoModel } from '../models/video/video' 9import { VideoModel } from '../models/video/video'
6import { VideoChannelModel } from '../models/video/video-channel' 10import { VideoChannelModel } from '../models/video/video-channel'
7import { AccountModel } from '../models/account/account'
8import { cacheRoute } from '../middlewares/cache/cache'
9import { buildNSFWFilter } from '../helpers/express-utils'
10import { truncate } from 'lodash'
11 11
12const botsRouter = express.Router() 12const botsRouter = express.Router()
13 13
@@ -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 ]