diff options
author | Kimsible <kimsible@users.noreply.github.com> | 2021-04-24 01:44:39 +0200 |
---|---|---|
committer | Kimsible <kimsible@users.noreply.github.com> | 2021-05-05 11:47:03 +0200 |
commit | 9a911038d9ac38bf590e9199b3b7477ebf91de19 (patch) | |
tree | 9e7b1e4a05b4b43b41293fc987a9221038041eb9 /server/controllers | |
parent | c9783c7b72b4b2af7730522693ba5d36b59783f0 (diff) | |
download | PeerTube-9a911038d9ac38bf590e9199b3b7477ebf91de19.tar.gz PeerTube-9a911038d9ac38bf590e9199b3b7477ebf91de19.tar.zst PeerTube-9a911038d9ac38bf590e9199b3b7477ebf91de19.zip |
Add shorter URLs for accounts and channels server-side
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/client.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts index 022a17ff4..35e5af9d1 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts | |||
@@ -21,8 +21,9 @@ const testEmbedPath = join(distPath, 'standalone', 'videos', 'test-embed.html') | |||
21 | // Do not use a template engine for a so little thing | 21 | // Do not use a template engine for a so little thing |
22 | clientsRouter.use('/videos/watch/playlist/:id', asyncMiddleware(generateWatchPlaylistHtmlPage)) | 22 | clientsRouter.use('/videos/watch/playlist/:id', asyncMiddleware(generateWatchPlaylistHtmlPage)) |
23 | clientsRouter.use('/videos/watch/:id', asyncMiddleware(generateWatchHtmlPage)) | 23 | clientsRouter.use('/videos/watch/:id', asyncMiddleware(generateWatchHtmlPage)) |
24 | clientsRouter.use('/accounts/:nameWithHost', asyncMiddleware(generateAccountHtmlPage)) | 24 | clientsRouter.use([ '/accounts/:nameWithHost', '/a/:nameWithHost' ], asyncMiddleware(generateAccountHtmlPage)) |
25 | clientsRouter.use('/video-channels/:nameWithHost', asyncMiddleware(generateVideoChannelHtmlPage)) | 25 | clientsRouter.use([ '/video-channels/:nameWithHost', '/c/:nameWithHost' ], asyncMiddleware(generateVideoChannelHtmlPage)) |
26 | clientsRouter.use('/@:nameWithHost', asyncMiddleware(generateActorHtmlPage)) | ||
26 | 27 | ||
27 | const embedMiddlewares = [ | 28 | const embedMiddlewares = [ |
28 | CONFIG.CSP.ENABLED | 29 | CONFIG.CSP.ENABLED |
@@ -155,6 +156,12 @@ async function generateVideoChannelHtmlPage (req: express.Request, res: express. | |||
155 | return sendHTML(html, res) | 156 | return sendHTML(html, res) |
156 | } | 157 | } |
157 | 158 | ||
159 | async function generateActorHtmlPage (req: express.Request, res: express.Response) { | ||
160 | const html = await ClientHtml.getActorHTMLPage(req.params.nameWithHost, req, res) | ||
161 | |||
162 | return sendHTML(html, res) | ||
163 | } | ||
164 | |||
158 | async function generateManifest (req: express.Request, res: express.Response) { | 165 | async function generateManifest (req: express.Request, res: express.Response) { |
159 | const manifestPhysicalPath = join(root(), 'client', 'dist', 'manifest.webmanifest') | 166 | const manifestPhysicalPath = join(root(), 'client', 'dist', 'manifest.webmanifest') |
160 | const manifestJson = await readFile(manifestPhysicalPath, 'utf8') | 167 | const manifestJson = await readFile(manifestPhysicalPath, 'utf8') |