aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-01 14:16:19 +0200
committerChocobozzz <me@florianbigard.com>2020-04-01 14:46:53 +0200
commitd96994289b24c4bbd056660c5fe11fff0f77635e (patch)
treef3c21a32735b665184ee8e62e79a869f99c01a09 /server/controllers
parent4adebd513ec207d54e76a09cd4a8554d1900d34a (diff)
downloadPeerTube-d96994289b24c4bbd056660c5fe11fff0f77635e.tar.gz
PeerTube-d96994289b24c4bbd056660c5fe11fff0f77635e.tar.zst
PeerTube-d96994289b24c4bbd056660c5fe11fff0f77635e.zip
Update server dependencies
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/bots.ts14
1 files changed, 8 insertions, 6 deletions
diff --git a/server/controllers/bots.ts b/server/controllers/bots.ts
index 63280dabb..541b40e8e 100644
--- a/server/controllers/bots.ts
+++ b/server/controllers/bots.ts
@@ -1,7 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { asyncMiddleware } from '../middlewares' 2import { asyncMiddleware } from '../middlewares'
3import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' 3import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants'
4import * as sitemapModule from 'sitemap' 4import { SitemapStream, streamToPromise } from 'sitemap'
5import { VideoModel } from '../models/video/video' 5import { VideoModel } from '../models/video/video'
6import { VideoChannelModel } from '../models/video/video-channel' 6import { VideoChannelModel } from '../models/video/video-channel'
7import { AccountModel } from '../models/account/account' 7import { AccountModel } from '../models/account/account'
@@ -33,12 +33,14 @@ async function getSitemap (req: express.Request, res: express.Response) {
33 urls = urls.concat(await getSitemapVideoChannelUrls()) 33 urls = urls.concat(await getSitemapVideoChannelUrls())
34 urls = urls.concat(await getSitemapAccountUrls()) 34 urls = urls.concat(await getSitemapAccountUrls())
35 35
36 const sitemap = sitemapModule.createSitemap({ 36 const sitemapStream = new SitemapStream({ hostname: WEBSERVER.URL })
37 hostname: WEBSERVER.URL, 37
38 urls: urls 38 for (const url of urls) {
39 }) 39 sitemapStream.write({ url })
40 }
41 sitemapStream.end()
40 42
41 const xml = sitemap.toXML() 43 const xml = await streamToPromise(sitemapStream)
42 44
43 res.header('Content-Type', 'application/xml') 45 res.header('Content-Type', 'application/xml')
44 res.send(xml) 46 res.send(xml)