diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-26 15:04:37 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-26 15:04:37 +0200 |
commit | 15a7eafb892441957ba7dd6fcbf556086fe5b2b3 (patch) | |
tree | 0786bd1a96c7d168a097ffcf5893737db2ab578e /server/controllers | |
parent | 9162fdd36300d2478f13d6ad346ec2c323f40faa (diff) | |
download | PeerTube-15a7eafb892441957ba7dd6fcbf556086fe5b2b3.tar.gz PeerTube-15a7eafb892441957ba7dd6fcbf556086fe5b2b3.tar.zst PeerTube-15a7eafb892441957ba7dd6fcbf556086fe5b2b3.zip |
Refactor video links builders
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/server/logs.ts | 3 | ||||
-rw-r--r-- | server/controllers/bots.ts | 16 | ||||
-rw-r--r-- | server/controllers/feeds.ts | 2 |
3 files changed, 10 insertions, 11 deletions
diff --git a/server/controllers/api/server/logs.ts b/server/controllers/api/server/logs.ts index f78607d35..39eceb654 100644 --- a/server/controllers/api/server/logs.ts +++ b/server/controllers/api/server/logs.ts | |||
@@ -1,8 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { readdir, readFile } from 'fs-extra' | 2 | import { readdir, readFile } from 'fs-extra' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { logger } from '@server/helpers/logger' | 4 | import { logger, mtimeSortFilesDesc } from '@server/helpers/logger' |
5 | import { mtimeSortFilesDesc } from '../../../../shared/core-utils/logs/logs' | ||
6 | import { LogLevel } from '../../../../shared/models/server/log-level.type' | 5 | import { LogLevel } from '../../../../shared/models/server/log-level.type' |
7 | import { UserRight } from '../../../../shared/models/users' | 6 | import { UserRight } from '../../../../shared/models/users' |
8 | import { CONFIG } from '../../../initializers/config' | 7 | import { CONFIG } from '../../../initializers/config' |
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 @@ | |||
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/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 | ||
@@ -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 | ] |
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts index cdc6bfb8b..9fa70a7c8 100644 --- a/server/controllers/feeds.ts +++ b/server/controllers/feeds.ts | |||
@@ -286,7 +286,7 @@ function addVideosToFeed (feed, videos: VideoModel[]) { | |||
286 | feed.addItem({ | 286 | feed.addItem({ |
287 | title: video.name, | 287 | title: video.name, |
288 | id: video.url, | 288 | id: video.url, |
289 | link: WEBSERVER.URL + '/w/' + video.uuid, | 289 | link: WEBSERVER.URL + video.getWatchStaticPath(), |
290 | description: video.getTruncatedDescription(), | 290 | description: video.getTruncatedDescription(), |
291 | content: video.description, | 291 | content: video.description, |
292 | author: [ | 292 | author: [ |