aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorKimsible <kimsible@users.noreply.github.com>2021-04-24 01:44:39 +0200
committerKimsible <kimsible@users.noreply.github.com>2021-05-05 11:47:03 +0200
commit9a911038d9ac38bf590e9199b3b7477ebf91de19 (patch)
tree9e7b1e4a05b4b43b41293fc987a9221038041eb9 /server/lib
parentc9783c7b72b4b2af7730522693ba5d36b59783f0 (diff)
downloadPeerTube-9a911038d9ac38bf590e9199b3b7477ebf91de19.tar.gz
PeerTube-9a911038d9ac38bf590e9199b3b7477ebf91de19.tar.zst
PeerTube-9a911038d9ac38bf590e9199b3b7477ebf91de19.zip
Add shorter URLs for accounts and channels server-side
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/client-html.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts
index 203bd3893..cac9edb30 100644
--- a/server/lib/client-html.ts
+++ b/server/lib/client-html.ts
@@ -196,11 +196,24 @@ class ClientHtml {
196 } 196 }
197 197
198 static async getAccountHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) { 198 static async getAccountHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) {
199 return this.getAccountOrChannelHTMLPage(() => AccountModel.loadByNameWithHost(nameWithHost), req, res) 199 const accountModelPromise = AccountModel.loadByNameWithHost(nameWithHost)
200 return this.getAccountOrChannelHTMLPage(() => accountModelPromise, req, res)
200 } 201 }
201 202
202 static async getVideoChannelHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) { 203 static async getVideoChannelHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) {
203 return this.getAccountOrChannelHTMLPage(() => VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost), req, res) 204 const videoChannelModelPromise = VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost)
205 return this.getAccountOrChannelHTMLPage(() => videoChannelModelPromise, req, res)
206 }
207
208 static async getActorHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) {
209 const accountModel = await AccountModel.loadByNameWithHost(nameWithHost)
210
211 if (accountModel) {
212 return this.getAccountOrChannelHTMLPage(() => new Promise(resolve => resolve(accountModel)), req, res)
213 } else {
214 const videoChannelModelPromise = VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost)
215 return this.getAccountOrChannelHTMLPage(() => videoChannelModelPromise, req, res)
216 }
204 } 217 }
205 218
206 static async getEmbedHTML () { 219 static async getEmbedHTML () {