diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-07-11 16:01:56 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-07-11 16:01:56 +0200 |
commit | 0a6658fdcbd779ada8f3758048c326e997902d5a (patch) | |
tree | 5de40bf901db0299011104b1344783637b964eb0 /server/controllers/client.ts | |
parent | e6d4b0ff2404dcf0b3a755c3fcc415ffeb6e754d (diff) | |
download | PeerTube-0a6658fdcbd779ada8f3758048c326e997902d5a.tar.gz PeerTube-0a6658fdcbd779ada8f3758048c326e997902d5a.tar.zst PeerTube-0a6658fdcbd779ada8f3758048c326e997902d5a.zip |
Use global uuid instead of remoteId for videos
Diffstat (limited to 'server/controllers/client.ts')
-rw-r--r-- | server/controllers/client.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts index d42e8396d..ac722a578 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts | |||
@@ -78,7 +78,7 @@ function addOpenGraphTags (htmlStringPage: string, video: VideoInstance) { | |||
78 | } | 78 | } |
79 | 79 | ||
80 | let tagsString = '' | 80 | let tagsString = '' |
81 | Object.keys(metaTags).forEach(function (tagName) { | 81 | Object.keys(metaTags).forEach(tagName => { |
82 | const tagValue = metaTags[tagName] | 82 | const tagValue = metaTags[tagName] |
83 | 83 | ||
84 | tagsString += '<meta property="' + tagName + '" content="' + tagValue + '" />' | 84 | tagsString += '<meta property="' + tagName + '" content="' + tagValue + '" />' |
@@ -89,13 +89,20 @@ function addOpenGraphTags (htmlStringPage: string, video: VideoInstance) { | |||
89 | 89 | ||
90 | function generateWatchHtmlPage (req: express.Request, res: express.Response, next: express.NextFunction) { | 90 | function generateWatchHtmlPage (req: express.Request, res: express.Response, next: express.NextFunction) { |
91 | const videoId = '' + req.params.id | 91 | const videoId = '' + req.params.id |
92 | let videoPromise: Promise<VideoInstance> | ||
92 | 93 | ||
93 | // Let Angular application handle errors | 94 | // Let Angular application handle errors |
94 | if (!validator.isUUID(videoId, 4)) return res.sendFile(indexPath) | 95 | if (validator.isUUID(videoId, 4)) { |
96 | videoPromise = db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(videoId) | ||
97 | } else if (validator.isInt(videoId)) { | ||
98 | videoPromise = db.Video.loadAndPopulateAuthorAndPodAndTags(+videoId) | ||
99 | } else { | ||
100 | return res.sendFile(indexPath) | ||
101 | } | ||
95 | 102 | ||
96 | Promise.all([ | 103 | Promise.all([ |
97 | readFileBufferPromise(indexPath), | 104 | readFileBufferPromise(indexPath), |
98 | db.Video.loadAndPopulateAuthorAndPodAndTags(videoId) | 105 | videoPromise |
99 | ]) | 106 | ]) |
100 | .then(([ file, video ]) => { | 107 | .then(([ file, video ]) => { |
101 | file = file as Buffer | 108 | file = file as Buffer |