mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00
Add shorter URLs for accounts and channels server-side
This commit is contained in:
parent
c9783c7b72
commit
9a911038d9
3 changed files with 142 additions and 40 deletions
|
@ -196,11 +196,24 @@ class ClientHtml {
|
|||
}
|
||||
|
||||
static async getAccountHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) {
|
||||
return this.getAccountOrChannelHTMLPage(() => AccountModel.loadByNameWithHost(nameWithHost), req, res)
|
||||
const accountModelPromise = AccountModel.loadByNameWithHost(nameWithHost)
|
||||
return this.getAccountOrChannelHTMLPage(() => accountModelPromise, req, res)
|
||||
}
|
||||
|
||||
static async getVideoChannelHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) {
|
||||
return this.getAccountOrChannelHTMLPage(() => VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost), req, res)
|
||||
const videoChannelModelPromise = VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost)
|
||||
return this.getAccountOrChannelHTMLPage(() => videoChannelModelPromise, req, res)
|
||||
}
|
||||
|
||||
static async getActorHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) {
|
||||
const accountModel = await AccountModel.loadByNameWithHost(nameWithHost)
|
||||
|
||||
if (accountModel) {
|
||||
return this.getAccountOrChannelHTMLPage(() => new Promise(resolve => resolve(accountModel)), req, res)
|
||||
} else {
|
||||
const videoChannelModelPromise = VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost)
|
||||
return this.getAccountOrChannelHTMLPage(() => videoChannelModelPromise, req, res)
|
||||
}
|
||||
}
|
||||
|
||||
static async getEmbedHTML () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue