diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/remote/videos.ts | 9 | ||||
-rw-r--r-- | server/controllers/client.ts | 7 |
2 files changed, 7 insertions, 9 deletions
diff --git a/server/controllers/api/remote/videos.ts b/server/controllers/api/remote/videos.ts index ebe4eca36..eb033637e 100644 --- a/server/controllers/api/remote/videos.ts +++ b/server/controllers/api/remote/videos.ts | |||
@@ -64,8 +64,7 @@ function remoteVideos (req: express.Request, res: express.Response, next: expres | |||
64 | const fromPod = res.locals.secure.pod | 64 | const fromPod = res.locals.secure.pod |
65 | 65 | ||
66 | // We need to process in the same order to keep consistency | 66 | // We need to process in the same order to keep consistency |
67 | // TODO: optimization | 67 | Promise.each(requests, (request: any) => { |
68 | Promise.mapSeries(requests, (request: any) => { | ||
69 | const data = request.data | 68 | const data = request.data |
70 | 69 | ||
71 | // Get the function we need to call in order to process the request | 70 | // Get the function we need to call in order to process the request |
@@ -79,7 +78,7 @@ function remoteVideos (req: express.Request, res: express.Response, next: expres | |||
79 | }) | 78 | }) |
80 | .catch(err => logger.error('Error managing remote videos.', { error: err })) | 79 | .catch(err => logger.error('Error managing remote videos.', { error: err })) |
81 | 80 | ||
82 | // We don't need to keep the other pod waiting | 81 | // Don't block the other pod |
83 | return res.type('json').status(204).end() | 82 | return res.type('json').status(204).end() |
84 | } | 83 | } |
85 | 84 | ||
@@ -87,7 +86,7 @@ function remoteVideosQadu (req: express.Request, res: express.Response, next: ex | |||
87 | const requests = req.body.data | 86 | const requests = req.body.data |
88 | const fromPod = res.locals.secure.pod | 87 | const fromPod = res.locals.secure.pod |
89 | 88 | ||
90 | Promise.mapSeries(requests, (request: any) => { | 89 | Promise.each(requests, (request: any) => { |
91 | const videoData = request.data | 90 | const videoData = request.data |
92 | 91 | ||
93 | return quickAndDirtyUpdateVideoRetryWrapper(videoData, fromPod) | 92 | return quickAndDirtyUpdateVideoRetryWrapper(videoData, fromPod) |
@@ -101,7 +100,7 @@ function remoteVideosEvents (req: express.Request, res: express.Response, next: | |||
101 | const requests = req.body.data | 100 | const requests = req.body.data |
102 | const fromPod = res.locals.secure.pod | 101 | const fromPod = res.locals.secure.pod |
103 | 102 | ||
104 | Promise.mapSeries(requests, (request: any) => { | 103 | Promise.each(requests, (request: any) => { |
105 | const eventData = request.data | 104 | const eventData = request.data |
106 | 105 | ||
107 | return processVideosEventsRetryWrapper(eventData, fromPod) | 106 | return processVideosEventsRetryWrapper(eventData, fromPod) |
diff --git a/server/controllers/client.ts b/server/controllers/client.ts index e4d69eae7..d42e8396d 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts | |||
@@ -8,15 +8,14 @@ import { | |||
8 | CONFIG, | 8 | CONFIG, |
9 | REMOTE_SCHEME, | 9 | REMOTE_SCHEME, |
10 | STATIC_PATHS, | 10 | STATIC_PATHS, |
11 | STATIC_MAX_AGE | 11 | STATIC_MAX_AGE, |
12 | OPENGRAPH_COMMENT | ||
12 | } from '../initializers' | 13 | } from '../initializers' |
13 | import { root, readFileBufferPromise } from '../helpers' | 14 | import { root, readFileBufferPromise } from '../helpers' |
14 | import { VideoInstance } from '../models' | 15 | import { VideoInstance } from '../models' |
15 | 16 | ||
16 | const clientsRouter = express.Router() | 17 | const clientsRouter = express.Router() |
17 | 18 | ||
18 | // TODO: move to constants | ||
19 | const opengraphComment = '<!-- opengraph tags -->' | ||
20 | const distPath = join(root(), 'client', 'dist') | 19 | const distPath = join(root(), 'client', 'dist') |
21 | const embedPath = join(distPath, 'standalone', 'videos', 'embed.html') | 20 | const embedPath = join(distPath, 'standalone', 'videos', 'embed.html') |
22 | const indexPath = join(distPath, 'index.html') | 21 | const indexPath = join(distPath, 'index.html') |
@@ -85,7 +84,7 @@ function addOpenGraphTags (htmlStringPage: string, video: VideoInstance) { | |||
85 | tagsString += '<meta property="' + tagName + '" content="' + tagValue + '" />' | 84 | tagsString += '<meta property="' + tagName + '" content="' + tagValue + '" />' |
86 | }) | 85 | }) |
87 | 86 | ||
88 | return htmlStringPage.replace(opengraphComment, tagsString) | 87 | return htmlStringPage.replace(OPENGRAPH_COMMENT, tagsString) |
89 | } | 88 | } |
90 | 89 | ||
91 | function generateWatchHtmlPage (req: express.Request, res: express.Response, next: express.NextFunction) { | 90 | function generateWatchHtmlPage (req: express.Request, res: express.Response, next: express.NextFunction) { |