1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

Only use account name in routes

This commit is contained in:
Chocobozzz 2018-05-25 09:57:16 +02:00
parent 06be7ed0b2
commit ad9e39fb81
No known key found for this signature in database
GPG key ID: 583A612D890159BE
28 changed files with 333 additions and 110 deletions

View file

@ -5,6 +5,7 @@ import * as validator from 'validator'
import { AccountModel } from '../../models/account/account'
import { isUserDescriptionValid, isUserUsernameValid } from './users'
import { exists } from './misc'
import { CONFIG } from '../../initializers'
function isAccountNameValid (value: string) {
return isUserUsernameValid(value)
@ -40,7 +41,7 @@ function isAccountNameWithHostExist (nameWithDomain: string, res: Response, send
const [ accountName, host ] = nameWithDomain.split('@')
let promise: Bluebird<AccountModel>
if (!host) promise = AccountModel.loadLocalByName(accountName)
if (!host || host === CONFIG.WEBSERVER.HOST) promise = AccountModel.loadLocalByName(accountName)
else promise = AccountModel.loadLocalByNameAndHost(accountName, host)
return isAccountExist(promise, res, sendNotFound)