aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/+accounts/account-video-channels/account-video-channels.component.ts2
-rw-r--r--client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts2
-rw-r--r--client/src/app/+video-channels/video-channels.component.html2
-rw-r--r--client/src/app/menu/menu.component.html2
-rw-r--r--client/src/app/shared/account/account.model.ts2
-rw-r--r--client/src/app/shared/users/user.model.ts21
-rw-r--r--client/src/app/shared/video-channel/video-channel.service.ts5
-rw-r--r--client/src/app/shared/video/video-details.model.ts4
-rw-r--r--client/src/app/shared/video/video-miniature.component.html4
-rw-r--r--client/src/app/shared/video/video.service.ts2
-rw-r--r--client/src/app/videos/+video-edit/video-update.component.ts2
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.html2
-rw-r--r--server/controllers/api/accounts.ts12
-rw-r--r--server/controllers/services.ts2
-rw-r--r--server/helpers/custom-validators/accounts.ts3
-rw-r--r--server/middlewares/validators/account.ts32
-rw-r--r--server/middlewares/validators/video-channels.ts6
-rw-r--r--server/tests/api/check-params/accounts.ts4
-rw-r--r--server/tests/api/check-params/video-channels.ts10
-rw-r--r--server/tests/api/check-params/videos.ts6
-rw-r--r--server/tests/api/users/users-multiple-servers.ts15
-rw-r--r--server/tests/api/videos/video-channels.ts5
-rw-r--r--server/tests/api/videos/video-nsfw.ts6
-rw-r--r--server/tests/utils/users/accounts.ts4
-rw-r--r--server/tests/utils/videos/video-channels.ts4
-rw-r--r--server/tests/utils/videos/videos.ts4
-rw-r--r--support/doc/api/html/index.html262
-rw-r--r--support/doc/api/openapi.yaml18
28 files changed, 333 insertions, 110 deletions
diff --git a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
index 0852c4bb7..a6e6dd656 100644
--- a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
+++ b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
@@ -26,7 +26,7 @@ export class AccountVideoChannelsComponent implements OnInit {
26 this.accountService.accountLoaded 26 this.accountService.accountLoaded
27 .pipe( 27 .pipe(
28 tap(account => this.account = account), 28 tap(account => this.account = account),
29 flatMap(account => this.videoChannelService.listAccountVideoChannels(account.id)), 29 flatMap(account => this.videoChannelService.listAccountVideoChannels(account)),
30 map(res => res.data) 30 map(res => res.data)
31 ) 31 )
32 .subscribe(videoChannels => this.videoChannels = videoChannels) 32 .subscribe(videoChannels => this.videoChannels = videoChannels)
diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts
index 7abf48826..20c8798d1 100644
--- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts
+++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts
@@ -52,7 +52,7 @@ export class MyAccountVideoChannelsComponent implements OnInit {
52 52
53 private loadVideoChannels () { 53 private loadVideoChannels () {
54 this.authService.userInformationLoaded 54 this.authService.userInformationLoaded
55 .pipe(flatMap(() => this.videoChannelService.listAccountVideoChannels(this.user.account.id))) 55 .pipe(flatMap(() => this.videoChannelService.listAccountVideoChannels(this.user.account)))
56 .subscribe(res => this.videoChannels = res.data) 56 .subscribe(res => this.videoChannels = res.data)
57 } 57 }
58} 58}
diff --git a/client/src/app/+video-channels/video-channels.component.html b/client/src/app/+video-channels/video-channels.component.html
index da0d76acf..6b25d16ab 100644
--- a/client/src/app/+video-channels/video-channels.component.html
+++ b/client/src/app/+video-channels/video-channels.component.html
@@ -10,7 +10,7 @@
10 </div> 10 </div>
11 <div class="actor-followers">{{ videoChannel.followersCount }} subscribers</div> 11 <div class="actor-followers">{{ videoChannel.followersCount }} subscribers</div>
12 12
13 <a [routerLink]="[ '/accounts', videoChannel.ownerAccount.id ]" title="Go the owner account page" class="actor-owner"> 13 <a [routerLink]="[ '/accounts', videoChannel.ownerBy ]" title="Go the owner account page" class="actor-owner">
14 <span>Created by {{ videoChannel.ownerBy }}</span> 14 <span>Created by {{ videoChannel.ownerBy }}</span>
15 <img [src]="videoChannel.ownerAvatarUrl" alt="Owner account avatar" /> 15 <img [src]="videoChannel.ownerAvatarUrl" alt="Owner account avatar" />
16 </a> 16 </a>
diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html
index 6a2a495a2..1a95477b7 100644
--- a/client/src/app/menu/menu.component.html
+++ b/client/src/app/menu/menu.component.html
@@ -14,7 +14,7 @@
14 14
15 <ul *dropdownMenu class="dropdown-menu"> 15 <ul *dropdownMenu class="dropdown-menu">
16 <li> 16 <li>
17 <a i18n [routerLink]="[ '/accounts', user.account?.id ]" class="dropdown-item" title="My public profile"> 17 <a i18n [routerLink]="[ '/accounts', user.account?.nameWithHost ]" class="dropdown-item" title="My public profile">
18 My public profile 18 My public profile
19 </a> 19 </a>
20 20
diff --git a/client/src/app/shared/account/account.model.ts b/client/src/app/shared/account/account.model.ts
index 6a3c6451c..5058e372f 100644
--- a/client/src/app/shared/account/account.model.ts
+++ b/client/src/app/shared/account/account.model.ts
@@ -4,11 +4,13 @@ import { Actor } from '../actor/actor.model'
4export class Account extends Actor implements ServerAccount { 4export class Account extends Actor implements ServerAccount {
5 displayName: string 5 displayName: string
6 description: string 6 description: string
7 nameWithHost: string
7 8
8 constructor (hash: ServerAccount) { 9 constructor (hash: ServerAccount) {
9 super(hash) 10 super(hash)
10 11
11 this.displayName = hash.displayName 12 this.displayName = hash.displayName
12 this.description = hash.description 13 this.description = hash.description
14 this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host)
13 } 15 }
14} 16}
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index d4551de89..b4be2270f 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -1,6 +1,14 @@
1import { Account, hasUserRight, User as UserServerModel, UserRight, UserRole, VideoChannel } from '../../../../../shared' 1import {
2 Account as AccountServerModel,
3 hasUserRight,
4 User as UserServerModel,
5 UserRight,
6 UserRole,
7 VideoChannel
8} from '../../../../../shared'
2import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' 9import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type'
3import { Actor } from '@app/shared/actor/actor.model' 10import { Actor } from '@app/shared/actor/actor.model'
11import { Account } from '@app/shared/account/account.model'
4 12
5export type UserConstructorHash = { 13export type UserConstructorHash = {
6 id: number, 14 id: number,
@@ -11,7 +19,7 @@ export type UserConstructorHash = {
11 nsfwPolicy?: NSFWPolicyType, 19 nsfwPolicy?: NSFWPolicyType,
12 autoPlayVideo?: boolean, 20 autoPlayVideo?: boolean,
13 createdAt?: Date, 21 createdAt?: Date,
14 account?: Account, 22 account?: AccountServerModel,
15 videoChannels?: VideoChannel[] 23 videoChannels?: VideoChannel[]
16} 24}
17export class User implements UserServerModel { 25export class User implements UserServerModel {
@@ -32,7 +40,10 @@ export class User implements UserServerModel {
32 this.username = hash.username 40 this.username = hash.username
33 this.email = hash.email 41 this.email = hash.email
34 this.role = hash.role 42 this.role = hash.role
35 this.account = hash.account 43
44 if (hash.account !== undefined) {
45 this.account = new Account(hash.account)
46 }
36 47
37 if (hash.videoChannels !== undefined) { 48 if (hash.videoChannels !== undefined) {
38 this.videoChannels = hash.videoChannels 49 this.videoChannels = hash.videoChannels
@@ -66,6 +77,10 @@ export class User implements UserServerModel {
66 this[key] = obj[key] 77 this[key] = obj[key]
67 } 78 }
68 79
80 if (obj.account !== undefined) {
81 this.account = new Account(obj.account)
82 }
83
69 this.updateComputedAttributes() 84 this.updateComputedAttributes()
70 } 85 }
71 86
diff --git a/client/src/app/shared/video-channel/video-channel.service.ts b/client/src/app/shared/video-channel/video-channel.service.ts
index e1e3bf697..55e4c2a31 100644
--- a/client/src/app/shared/video-channel/video-channel.service.ts
+++ b/client/src/app/shared/video-channel/video-channel.service.ts
@@ -8,6 +8,7 @@ import { AccountService } from '../account/account.service'
8import { ResultList } from '../../../../../shared' 8import { ResultList } from '../../../../../shared'
9import { VideoChannel } from './video-channel.model' 9import { VideoChannel } from './video-channel.model'
10import { environment } from '../../../environments/environment' 10import { environment } from '../../../environments/environment'
11import { Account } from '@app/shared/account/account.model'
11 12
12@Injectable() 13@Injectable()
13export class VideoChannelService { 14export class VideoChannelService {
@@ -29,8 +30,8 @@ export class VideoChannelService {
29 ) 30 )
30 } 31 }
31 32
32 listAccountVideoChannels (accountId: number): Observable<ResultList<VideoChannel>> { 33 listAccountVideoChannels (account: Account): Observable<ResultList<VideoChannel>> {
33 return this.authHttp.get<ResultList<VideoChannelServer>>(AccountService.BASE_ACCOUNT_URL + accountId + '/video-channels') 34 return this.authHttp.get<ResultList<VideoChannelServer>>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/video-channels')
34 .pipe( 35 .pipe(
35 map(res => this.extractVideoChannels(res)), 36 map(res => this.extractVideoChannels(res)),
36 catchError((res) => this.restExtractor.handleError(res)) 37 catchError((res) => this.restExtractor.handleError(res))
diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts
index 5397aa37f..5fc55fca6 100644
--- a/client/src/app/shared/video/video-details.model.ts
+++ b/client/src/app/shared/video/video-details.model.ts
@@ -1,7 +1,7 @@
1import { UserRight, VideoChannel, VideoDetails as VideoDetailsServerModel, VideoFile } from '../../../../../shared' 1import { UserRight, VideoChannel, VideoDetails as VideoDetailsServerModel, VideoFile } from '../../../../../shared'
2import { Account } from '../../../../../shared/models/actors'
3import { AuthUser } from '../../core' 2import { AuthUser } from '../../core'
4import { Video } from '../../shared/video/video.model' 3import { Video } from '../../shared/video/video.model'
4import { Account } from '@app/shared/account/account.model'
5 5
6export class VideoDetails extends Video implements VideoDetailsServerModel { 6export class VideoDetails extends Video implements VideoDetailsServerModel {
7 descriptionPath: string 7 descriptionPath: string
@@ -21,7 +21,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
21 this.descriptionPath = hash.descriptionPath 21 this.descriptionPath = hash.descriptionPath
22 this.files = hash.files 22 this.files = hash.files
23 this.channel = hash.channel 23 this.channel = hash.channel
24 this.account = hash.account 24 this.account = new Account(hash.account)
25 this.tags = hash.tags 25 this.tags = hash.tags
26 this.support = hash.support 26 this.support = hash.support
27 this.commentsEnabled = hash.commentsEnabled 27 this.commentsEnabled = hash.commentsEnabled
diff --git a/client/src/app/shared/video/video-miniature.component.html b/client/src/app/shared/video/video-miniature.component.html
index 1725e9f5c..09ce0ef7f 100644
--- a/client/src/app/shared/video/video-miniature.component.html
+++ b/client/src/app/shared/video/video-miniature.component.html
@@ -6,10 +6,10 @@
6 class="video-miniature-name" 6 class="video-miniature-name"
7 [routerLink]="[ '/videos/watch', video.uuid ]" [attr.title]="video.name" [ngClass]="{ 'blur-filter': isVideoBlur() }" 7 [routerLink]="[ '/videos/watch', video.uuid ]" [attr.title]="video.name" [ngClass]="{ 'blur-filter': isVideoBlur() }"
8 > 8 >
9 {{ video.name }} 9 {{ video.name }}
10 </a> 10 </a>
11 11
12 <span class="video-miniature-created-at-views">{{ video.publishedAt | myFromNow }} - {{ video.views | myNumberFormatter }} views</span> 12 <span class="video-miniature-created-at-views">{{ video.publishedAt | myFromNow }} - {{ video.views | myNumberFormatter }} views</span>
13 <a class="video-miniature-account" [routerLink]="[ '/accounts', video.account.id ]">{{ video.by }}</a> 13 <a class="video-miniature-account" [routerLink]="[ '/accounts', video.by ]">{{ video.by }}</a>
14 </div> 14 </div>
15</div> 15</div>
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index 5b8e2467a..d1e32faeb 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -120,7 +120,7 @@ export class VideoService {
120 params = this.restService.addRestGetParams(params, pagination, sort) 120 params = this.restService.addRestGetParams(params, pagination, sort)
121 121
122 return this.authHttp 122 return this.authHttp
123 .get(AccountService.BASE_ACCOUNT_URL + account.id + '/videos', { params }) 123 .get(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/videos', { params })
124 .pipe( 124 .pipe(
125 map(this.extractVideos), 125 map(this.extractVideos),
126 catchError(res => this.restExtractor.handleError(res)) 126 catchError(res => this.restExtractor.handleError(res))
diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts
index 00c2ed3f1..339da1bf4 100644
--- a/client/src/app/videos/+video-edit/video-update.component.ts
+++ b/client/src/app/videos/+video-edit/video-update.component.ts
@@ -63,7 +63,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
63 }), 63 }),
64 switchMap(video => { 64 switchMap(video => {
65 return this.videoChannelService 65 return this.videoChannelService
66 .listAccountVideoChannels(video.account.id) 66 .listAccountVideoChannels(video.account)
67 .pipe( 67 .pipe(
68 map(result => result.data), 68 map(result => result.data),
69 map(videoChannels => videoChannels.map(c => ({ id: c.id, label: c.displayName }))), 69 map(videoChannels => videoChannels.map(c => ({ id: c.id, label: c.displayName }))),
diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.html
index 212bfdd8c..583a97562 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.html
+++ b/client/src/app/videos/+video-watch/video-watch.component.html
@@ -25,7 +25,7 @@
25 </div> 25 </div>
26 26
27 <div class="video-info-by"> 27 <div class="video-info-by">
28 <a [routerLink]="[ '/accounts', video.account.id ]" title="Go the account page"> 28 <a [routerLink]="[ '/accounts', video.by ]" title="Go the account page">
29 <span>By {{ video.by }}</span> 29 <span>By {{ video.by }}</span>
30 <img [src]="video.accountAvatarUrl" alt="Account avatar" /> 30 <img [src]="video.accountAvatarUrl" alt="Account avatar" />
31 </a> 31 </a>
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts
index ccae0436b..8e937276c 100644
--- a/server/controllers/api/accounts.ts
+++ b/server/controllers/api/accounts.ts
@@ -8,7 +8,7 @@ import {
8 setDefaultPagination, 8 setDefaultPagination,
9 setDefaultSort 9 setDefaultSort
10} from '../../middlewares' 10} from '../../middlewares'
11import { accountsGetValidator, accountsSortValidator, videosSortValidator } from '../../middlewares/validators' 11import { accountsNameWithHostGetValidator, accountsSortValidator, videosSortValidator } from '../../middlewares/validators'
12import { AccountModel } from '../../models/account/account' 12import { AccountModel } from '../../models/account/account'
13import { VideoModel } from '../../models/video/video' 13import { VideoModel } from '../../models/video/video'
14import { isNSFWHidden } from '../../helpers/express-utils' 14import { isNSFWHidden } from '../../helpers/express-utils'
@@ -24,13 +24,13 @@ accountsRouter.get('/',
24 asyncMiddleware(listAccounts) 24 asyncMiddleware(listAccounts)
25) 25)
26 26
27accountsRouter.get('/:id', 27accountsRouter.get('/:accountName',
28 asyncMiddleware(accountsGetValidator), 28 asyncMiddleware(accountsNameWithHostGetValidator),
29 getAccount 29 getAccount
30) 30)
31 31
32accountsRouter.get('/:id/videos', 32accountsRouter.get('/:accountName/videos',
33 asyncMiddleware(accountsGetValidator), 33 asyncMiddleware(accountsNameWithHostGetValidator),
34 paginationValidator, 34 paginationValidator,
35 videosSortValidator, 35 videosSortValidator,
36 setDefaultSort, 36 setDefaultSort,
@@ -39,7 +39,7 @@ accountsRouter.get('/:id/videos',
39 asyncMiddleware(listAccountVideos) 39 asyncMiddleware(listAccountVideos)
40) 40)
41 41
42accountsRouter.get('/:accountId/video-channels', 42accountsRouter.get('/:accountName/video-channels',
43 asyncMiddleware(listVideoAccountChannelsValidator), 43 asyncMiddleware(listVideoAccountChannelsValidator),
44 asyncMiddleware(listVideoAccountChannels) 44 asyncMiddleware(listVideoAccountChannels)
45) 45)
diff --git a/server/controllers/services.ts b/server/controllers/services.ts
index c272edccd..a58a5b8cf 100644
--- a/server/controllers/services.ts
+++ b/server/controllers/services.ts
@@ -10,7 +10,7 @@ servicesRouter.use('/oembed',
10 asyncMiddleware(oembedValidator), 10 asyncMiddleware(oembedValidator),
11 generateOEmbed 11 generateOEmbed
12) 12)
13servicesRouter.use('/redirect/accounts/:nameWithHost', 13servicesRouter.use('/redirect/accounts/:accountName',
14 asyncMiddleware(accountsNameWithHostGetValidator), 14 asyncMiddleware(accountsNameWithHostGetValidator),
15 redirectToAccountUrl 15 redirectToAccountUrl
16) 16)
diff --git a/server/helpers/custom-validators/accounts.ts b/server/helpers/custom-validators/accounts.ts
index 00dea9039..0607d661c 100644
--- a/server/helpers/custom-validators/accounts.ts
+++ b/server/helpers/custom-validators/accounts.ts
@@ -5,6 +5,7 @@ import * as validator from 'validator'
5import { AccountModel } from '../../models/account/account' 5import { AccountModel } from '../../models/account/account'
6import { isUserDescriptionValid, isUserUsernameValid } from './users' 6import { isUserDescriptionValid, isUserUsernameValid } from './users'
7import { exists } from './misc' 7import { exists } from './misc'
8import { CONFIG } from '../../initializers'
8 9
9function isAccountNameValid (value: string) { 10function isAccountNameValid (value: string) {
10 return isUserUsernameValid(value) 11 return isUserUsernameValid(value)
@@ -40,7 +41,7 @@ function isAccountNameWithHostExist (nameWithDomain: string, res: Response, send
40 const [ accountName, host ] = nameWithDomain.split('@') 41 const [ accountName, host ] = nameWithDomain.split('@')
41 42
42 let promise: Bluebird<AccountModel> 43 let promise: Bluebird<AccountModel>
43 if (!host) promise = AccountModel.loadLocalByName(accountName) 44 if (!host || host === CONFIG.WEBSERVER.HOST) promise = AccountModel.loadLocalByName(accountName)
44 else promise = AccountModel.loadLocalByNameAndHost(accountName, host) 45 else promise = AccountModel.loadLocalByNameAndHost(accountName, host)
45 46
46 return isAccountExist(promise, res, sendNotFound) 47 return isAccountExist(promise, res, sendNotFound)
diff --git a/server/middlewares/validators/account.ts b/server/middlewares/validators/account.ts
index c01e742da..b3a51e631 100644
--- a/server/middlewares/validators/account.ts
+++ b/server/middlewares/validators/account.ts
@@ -1,15 +1,8 @@
1import * as express from 'express' 1import * as express from 'express'
2import { param } from 'express-validator/check' 2import { param } from 'express-validator/check'
3import { 3import { isAccountNameValid, isAccountNameWithHostExist, isLocalAccountNameExist } from '../../helpers/custom-validators/accounts'
4 isAccountIdExist,
5 isAccountIdValid,
6 isAccountNameValid,
7 isAccountNameWithHostExist,
8 isLocalAccountNameExist
9} from '../../helpers/custom-validators/accounts'
10import { logger } from '../../helpers/logger' 4import { logger } from '../../helpers/logger'
11import { areValidationErrors } from './utils' 5import { areValidationErrors } from './utils'
12import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
13 6
14const localAccountValidator = [ 7const localAccountValidator = [
15 param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'), 8 param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'),
@@ -24,32 +17,14 @@ const localAccountValidator = [
24 } 17 }
25] 18]
26 19
27const accountsGetValidator = [
28 param('id').custom(isAccountIdValid).withMessage('Should have a valid id/uuid/name/name with host'),
29
30 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
31 logger.debug('Checking accountsGetValidator parameters', { parameters: req.params })
32
33 if (areValidationErrors(req, res)) return
34
35 let accountFetched = false
36 if (isIdOrUUIDValid(req.params.id)) accountFetched = await isAccountIdExist(req.params.id, res, false)
37 if (!accountFetched) accountFetched = await isAccountNameWithHostExist(req.params.id, res, true)
38
39 if (!accountFetched) return
40
41 return next()
42 }
43]
44
45const accountsNameWithHostGetValidator = [ 20const accountsNameWithHostGetValidator = [
46 param('nameWithHost').exists().withMessage('Should have an account name with host'), 21 param('accountName').exists().withMessage('Should have an account name with host'),
47 22
48 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 23 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
49 logger.debug('Checking accountsNameWithHostGetValidator parameters', { parameters: req.params }) 24 logger.debug('Checking accountsNameWithHostGetValidator parameters', { parameters: req.params })
50 25
51 if (areValidationErrors(req, res)) return 26 if (areValidationErrors(req, res)) return
52 if (!await isAccountNameWithHostExist(req.params.nameWithHost, res)) return 27 if (!await isAccountNameWithHostExist(req.params.accountName, res)) return
53 28
54 return next() 29 return next()
55 } 30 }
@@ -59,6 +34,5 @@ const accountsNameWithHostGetValidator = [
59 34
60export { 35export {
61 localAccountValidator, 36 localAccountValidator,
62 accountsGetValidator,
63 accountsNameWithHostGetValidator 37 accountsNameWithHostGetValidator
64} 38}
diff --git a/server/middlewares/validators/video-channels.ts b/server/middlewares/validators/video-channels.ts
index 92c0de419..a5be5f114 100644
--- a/server/middlewares/validators/video-channels.ts
+++ b/server/middlewares/validators/video-channels.ts
@@ -1,7 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body, param } from 'express-validator/check' 2import { body, param } from 'express-validator/check'
3import { UserRight } from '../../../shared' 3import { UserRight } from '../../../shared'
4import { isAccountIdExist } from '../../helpers/custom-validators/accounts' 4import { isAccountIdExist, isAccountNameWithHostExist } from '../../helpers/custom-validators/accounts'
5import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' 5import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
6import { 6import {
7 isVideoChannelDescriptionValid, 7 isVideoChannelDescriptionValid,
@@ -15,13 +15,13 @@ import { VideoChannelModel } from '../../models/video/video-channel'
15import { areValidationErrors } from './utils' 15import { areValidationErrors } from './utils'
16 16
17const listVideoAccountChannelsValidator = [ 17const listVideoAccountChannelsValidator = [
18 param('accountId').custom(isIdOrUUIDValid).withMessage('Should have a valid account id'), 18 param('accountName').exists().withMessage('Should have a valid account name'),
19 19
20 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 20 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
21 logger.debug('Checking listVideoAccountChannelsValidator parameters', { parameters: req.body }) 21 logger.debug('Checking listVideoAccountChannelsValidator parameters', { parameters: req.body })
22 22
23 if (areValidationErrors(req, res)) return 23 if (areValidationErrors(req, res)) return
24 if (!await isAccountIdExist(req.params.accountId, res)) return 24 if (!await isAccountNameWithHostExist(req.params.accountName, res)) return
25 25
26 return next() 26 return next()
27 } 27 }
diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.ts
index 50dc0804e..9e0b1e35c 100644
--- a/server/tests/api/check-params/accounts.ts
+++ b/server/tests/api/check-params/accounts.ts
@@ -35,8 +35,8 @@ describe('Test users API validators', function () {
35 }) 35 })
36 36
37 describe('When getting an account', function () { 37 describe('When getting an account', function () {
38 it('Should return 404 with a non existing id', async function () { 38 it('Should return 404 with a non existing name', async function () {
39 await getAccount(server.url, 4545454, 404) 39 await getAccount(server.url, 'arfaze', 404)
40 }) 40 })
41 }) 41 })
42 42
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index 56b990be6..5080af2c9 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -7,7 +7,8 @@ import {
7 createUser, 7 createUser,
8 deleteVideoChannel, 8 deleteVideoChannel,
9 flushTests, 9 flushTests,
10 getAccountVideoChannelsList, getMyUserInformation, 10 getAccountVideoChannelsList,
11 getMyUserInformation,
11 getVideoChannelsList, 12 getVideoChannelsList,
12 immutableAssign, 13 immutableAssign,
13 killallServers, 14 killallServers,
@@ -20,7 +21,6 @@ import {
20 userLogin 21 userLogin
21} from '../../utils' 22} from '../../utils'
22import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 23import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
23import { getAccountsList } from '../../utils/users/accounts'
24import { User } from '../../../../shared/models/users' 24import { User } from '../../../../shared/models/users'
25 25
26const expect = chai.expect 26const expect = chai.expect
@@ -74,12 +74,8 @@ describe('Test video channels API validator', function () {
74 }) 74 })
75 75
76 describe('When listing account video channels', function () { 76 describe('When listing account video channels', function () {
77 it('Should fail with bad account', async function () {
78 await getAccountVideoChannelsList(server.url, 'hello', 400)
79 })
80
81 it('Should fail with a unknown account', async function () { 77 it('Should fail with a unknown account', async function () {
82 await getAccountVideoChannelsList(server.url, 154, 404) 78 await getAccountVideoChannelsList(server.url, 'unknown', 404)
83 }) 79 })
84 }) 80 })
85 81
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index c81e9752e..7b40b91e7 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -18,7 +18,7 @@ describe('Test videos API validator', function () {
18 const path = '/api/v1/videos/' 18 const path = '/api/v1/videos/'
19 let server: ServerInfo 19 let server: ServerInfo
20 let userAccessToken = '' 20 let userAccessToken = ''
21 let accountUUID: string 21 let accountName: string
22 let channelId: number 22 let channelId: number
23 let channelUUID: string 23 let channelUUID: string
24 let videoId 24 let videoId
@@ -43,7 +43,7 @@ describe('Test videos API validator', function () {
43 const res = await getMyUserInformation(server.url, server.accessToken) 43 const res = await getMyUserInformation(server.url, server.accessToken)
44 channelId = res.body.videoChannels[ 0 ].id 44 channelId = res.body.videoChannels[ 0 ].id
45 channelUUID = res.body.videoChannels[ 0 ].uuid 45 channelUUID = res.body.videoChannels[ 0 ].uuid
46 accountUUID = res.body.account.uuid 46 accountName = res.body.account.name + '@' + res.body.account.host
47 } 47 }
48 }) 48 })
49 49
@@ -116,7 +116,7 @@ describe('Test videos API validator', function () {
116 let path: string 116 let path: string
117 117
118 before(async function () { 118 before(async function () {
119 path = '/api/v1/accounts/' + accountUUID + '/videos' 119 path = '/api/v1/accounts/' + accountName + '/videos'
120 }) 120 })
121 121
122 it('Should fail with a bad start pagination', async function () { 122 it('Should fail with a bad start pagination', async function () {
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index 8b9b63348..0e1e6c97d 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -26,7 +26,7 @@ const expect = chai.expect
26describe('Test users with multiple servers', function () { 26describe('Test users with multiple servers', function () {
27 let servers: ServerInfo[] = [] 27 let servers: ServerInfo[] = []
28 let user: User 28 let user: User
29 let userAccountUUID: string 29 let userAccountName: string
30 let userVideoChannelUUID: string 30 let userVideoChannelUUID: string
31 let userId: number 31 let userId: number
32 let videoUUID: string 32 let videoUUID: string
@@ -56,13 +56,16 @@ describe('Test users with multiple servers', function () {
56 password: 'password' 56 password: 'password'
57 } 57 }
58 const res = await createUser(servers[ 0 ].url, servers[ 0 ].accessToken, user.username, user.password) 58 const res = await createUser(servers[ 0 ].url, servers[ 0 ].accessToken, user.username, user.password)
59 userAccountUUID = res.body.user.account.uuid
60 userId = res.body.user.id 59 userId = res.body.user.id
61
62 userAccessToken = await userLogin(servers[ 0 ], user) 60 userAccessToken = await userLogin(servers[ 0 ], user)
63 } 61 }
64 62
65 { 63 {
64 const res = await getMyUserInformation(servers[0].url, userAccessToken)
65 userAccountName = res.body.account.name + '@' + res.body.account.host
66 }
67
68 {
66 const res = await getMyUserInformation(servers[ 0 ].url, servers[ 0 ].accessToken) 69 const res = await getMyUserInformation(servers[ 0 ].url, servers[ 0 ].accessToken)
67 const user: User = res.body 70 const user: User = res.body
68 userVideoChannelUUID = user.videoChannels[0].uuid 71 userVideoChannelUUID = user.videoChannels[0].uuid
@@ -135,7 +138,7 @@ describe('Test users with multiple servers', function () {
135 const rootServer1List = resAccounts.body.data.find(a => a.name === 'root' && a.host === 'localhost:9001') as Account 138 const rootServer1List = resAccounts.body.data.find(a => a.name === 'root' && a.host === 'localhost:9001') as Account
136 expect(rootServer1List).not.to.be.undefined 139 expect(rootServer1List).not.to.be.undefined
137 140
138 const resAccount = await getAccount(server.url, rootServer1List.id) 141 const resAccount = await getAccount(server.url, rootServer1List.name + '@' + rootServer1List.host)
139 const rootServer1Get = resAccount.body as Account 142 const rootServer1Get = resAccount.body as Account
140 expect(rootServer1Get.name).to.equal('root') 143 expect(rootServer1Get.name).to.equal('root')
141 expect(rootServer1Get.host).to.equal('localhost:9001') 144 expect(rootServer1Get.host).to.equal('localhost:9001')
@@ -148,7 +151,7 @@ describe('Test users with multiple servers', function () {
148 151
149 it('Should list account videos', async function () { 152 it('Should list account videos', async function () {
150 for (const server of servers) { 153 for (const server of servers) {
151 const res = await getAccountVideos(server.url, server.accessToken, userAccountUUID, 0, 5) 154 const res = await getAccountVideos(server.url, server.accessToken, userAccountName, 0, 5)
152 155
153 expect(res.body.total).to.equal(1) 156 expect(res.body.total).to.equal(1)
154 expect(res.body.data).to.be.an('array') 157 expect(res.body.data).to.be.an('array')
@@ -193,7 +196,7 @@ describe('Test users with multiple servers', function () {
193 196
194 it('Should not have actor files', async () => { 197 it('Should not have actor files', async () => {
195 for (const server of servers) { 198 for (const server of servers) {
196 await checkActorFilesWereRemoved(userAccountUUID, server.serverNumber) 199 await checkActorFilesWereRemoved(userAccountName, server.serverNumber)
197 await checkActorFilesWereRemoved(userVideoChannelUUID, server.serverNumber) 200 await checkActorFilesWereRemoved(userVideoChannelUUID, server.serverNumber)
198 } 201 }
199 }) 202 })
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 35c418f7c..7ae505fd7 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -17,7 +17,6 @@ import {
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 updateVideoChannel 18 updateVideoChannel
19} from '../../utils/index' 19} from '../../utils/index'
20import { getAccountsList } from '../../utils/users/accounts'
21 20
22const expect = chai.expect 21const expect = chai.expect
23 22
@@ -99,7 +98,7 @@ describe('Test video channels', function () {
99 }) 98 })
100 99
101 it('Should have two video channels when getting account channels on server 1', async function () { 100 it('Should have two video channels when getting account channels on server 1', async function () {
102 const res = await getAccountVideoChannelsList(servers[0].url, userInfo.account.uuid) 101 const res = await getAccountVideoChannelsList(servers[0].url, userInfo.account.name + '@' + userInfo.account.host)
103 expect(res.body.total).to.equal(2) 102 expect(res.body.total).to.equal(2)
104 expect(res.body.data).to.be.an('array') 103 expect(res.body.data).to.be.an('array')
105 expect(res.body.data).to.have.lengthOf(2) 104 expect(res.body.data).to.have.lengthOf(2)
@@ -112,7 +111,7 @@ describe('Test video channels', function () {
112 }) 111 })
113 112
114 it('Should have one video channel when getting account channels on server 2', async function () { 113 it('Should have one video channel when getting account channels on server 2', async function () {
115 const res = await getAccountVideoChannelsList(servers[1].url, userInfo.account.uuid) 114 const res = await getAccountVideoChannelsList(servers[1].url, userInfo.account.name + '@' + userInfo.account.host)
116 expect(res.body.total).to.equal(1) 115 expect(res.body.total).to.equal(1)
117 expect(res.body.data).to.be.an('array') 116 expect(res.body.data).to.be.an('array')
118 expect(res.body.data).to.have.lengthOf(1) 117 expect(res.body.data).to.have.lengthOf(1)
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index b8c85f45b..a8f152561 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -32,13 +32,13 @@ describe('Test video NSFW policy', function () {
32 .then(res => { 32 .then(res => {
33 const user: User = res.body 33 const user: User = res.body
34 const videoChannelUUID = user.videoChannels[0].uuid 34 const videoChannelUUID = user.videoChannels[0].uuid
35 const accountUUID = user.account.uuid 35 const accountName = user.account.name + '@' + user.account.host
36 36
37 if (token) { 37 if (token) {
38 return Promise.all([ 38 return Promise.all([
39 getVideosListWithToken(server.url, token), 39 getVideosListWithToken(server.url, token),
40 searchVideoWithToken(server.url, 'n', token), 40 searchVideoWithToken(server.url, 'n', token),
41 getAccountVideos(server.url, token, accountUUID, 0, 5), 41 getAccountVideos(server.url, token, accountName, 0, 5),
42 getVideoChannelVideos(server.url, token, videoChannelUUID, 0, 5) 42 getVideoChannelVideos(server.url, token, videoChannelUUID, 0, 5)
43 ]) 43 ])
44 } 44 }
@@ -46,7 +46,7 @@ describe('Test video NSFW policy', function () {
46 return Promise.all([ 46 return Promise.all([
47 getVideosList(server.url), 47 getVideosList(server.url),
48 searchVideo(server.url, 'n'), 48 searchVideo(server.url, 'n'),
49 getAccountVideos(server.url, undefined, accountUUID, 0, 5), 49 getAccountVideos(server.url, undefined, accountName, 0, 5),
50 getVideoChannelVideos(server.url, undefined, videoChannelUUID, 0, 5) 50 getVideoChannelVideos(server.url, undefined, videoChannelUUID, 0, 5)
51 ]) 51 ])
52 }) 52 })
diff --git a/server/tests/utils/users/accounts.ts b/server/tests/utils/users/accounts.ts
index a5c13c319..30b3c54f8 100644
--- a/server/tests/utils/users/accounts.ts
+++ b/server/tests/utils/users/accounts.ts
@@ -19,8 +19,8 @@ function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected =
19 }) 19 })
20} 20}
21 21
22function getAccount (url: string, accountId: number | string, statusCodeExpected = 200) { 22function getAccount (url: string, accountName: string, statusCodeExpected = 200) {
23 const path = '/api/v1/accounts/' + accountId 23 const path = '/api/v1/accounts/' + accountName
24 24
25 return makeGetRequest({ 25 return makeGetRequest({
26 url, 26 url,
diff --git a/server/tests/utils/videos/video-channels.ts b/server/tests/utils/videos/video-channels.ts
index 021c4c420..a064598f4 100644
--- a/server/tests/utils/videos/video-channels.ts
+++ b/server/tests/utils/videos/video-channels.ts
@@ -16,8 +16,8 @@ function getVideoChannelsList (url: string, start: number, count: number, sort?:
16 .expect('Content-Type', /json/) 16 .expect('Content-Type', /json/)
17} 17}
18 18
19function getAccountVideoChannelsList (url: string, accountId: number | string, specialStatus = 200) { 19function getAccountVideoChannelsList (url: string, accountName: string, specialStatus = 200) {
20 const path = '/api/v1/accounts/' + accountId + '/video-channels' 20 const path = '/api/v1/accounts/' + accountName + '/video-channels'
21 21
22 return request(url) 22 return request(url)
23 .get(path) 23 .get(path)
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts
index 07c4ffc77..46fa5f79d 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/server/tests/utils/videos/videos.ts
@@ -167,8 +167,8 @@ function getMyVideos (url: string, accessToken: string, start: number, count: nu
167 .expect('Content-Type', /json/) 167 .expect('Content-Type', /json/)
168} 168}
169 169
170function getAccountVideos (url: string, accessToken: string, accountId: number | string, start: number, count: number, sort?: string) { 170function getAccountVideos (url: string, accessToken: string, accountName: string, start: number, count: number, sort?: string) {
171 const path = '/api/v1/accounts/' + accountId + '/videos' 171 const path = '/api/v1/accounts/' + accountName + '/videos'
172 172
173 return makeGetRequest({ 173 return makeGetRequest({
174 url, 174 url,
diff --git a/support/doc/api/html/index.html b/support/doc/api/html/index.html
index d41fc3913..b75a2a8ba 100644
--- a/support/doc/api/html/index.html
+++ b/support/doc/api/html/index.html
@@ -25,10 +25,10 @@
25 <a href="#tag-Accounts">Accounts</a> 25 <a href="#tag-Accounts">Accounts</a>
26 <ul> 26 <ul>
27 <li> 27 <li>
28 <a href="#operation--accounts--id--get"> GET /accounts/{id} </a> 28 <a href="#operation--accounts--name--get"> GET /accounts/{name} </a>
29 </li> 29 </li>
30 <li> 30 <li>
31 <a href="#operation--accounts--id--videos-get"> GET /accounts/{id}/videos </a> 31 <a href="#operation--accounts--name--videos-get"> GET /accounts/{name}/videos </a>
32 </li> 32 </li>
33 <li> 33 <li>
34 <a href="#operation--accounts-get"> GET /accounts </a> 34 <a href="#operation--accounts-get"> GET /accounts </a>
@@ -205,7 +205,7 @@
205 <a href="#operation--video-channels--id--videos-get"> GET /video-channels/{id}/videos </a> 205 <a href="#operation--video-channels--id--videos-get"> GET /video-channels/{id}/videos </a>
206 </li> 206 </li>
207 <li> 207 <li>
208 <a href="#operation--accounts--accountId--video-channels-get"> GET /accounts/{accountId}/video-channels </a> 208 <a href="#operation--accounts--name--video-channels-get"> GET /accounts/{name}/video-channels </a>
209 </li> 209 </li>
210 </ul> 210 </ul>
211 </section> 211 </section>
@@ -333,7 +333,7 @@
333 </div> 333 </div>
334 </div> 334 </div>
335 <h1 id="tag-Accounts" class="swagger-summary-tag" data-traverse-target="tag-Accounts">Accounts</h1> 335 <h1 id="tag-Accounts" class="swagger-summary-tag" data-traverse-target="tag-Accounts">Accounts</h1>
336 <div id="operation--accounts--id--get" class="operation panel" data-traverse-target="operation--accounts--id--get"> 336 <div id="operation--accounts--name--get" class="operation panel" data-traverse-target="operation--accounts--name--get">
337 <!-- <section class="operation-tags row"> --> 337 <!-- <section class="operation-tags row"> -->
338 <!-- <div class="doc-copy"> --> 338 <!-- <div class="doc-copy"> -->
339 <div class="operation-tags"> 339 <div class="operation-tags">
@@ -345,7 +345,7 @@
345 <h2 class="operation-title"> 345 <h2 class="operation-title">
346 <span class="operation-name"> 346 <span class="operation-name">
347 <span class="operation-name">GET</span> 347 <span class="operation-name">GET</span>
348 <span class="operation-path">/accounts/{id}</span> 348 <span class="operation-path">/accounts/{name}</span>
349 </span> 349 </span>
350 </h2> 350 </h2>
351 <div class="doc-row"> 351 <div class="doc-row">
@@ -353,7 +353,7 @@
353 <section class="swagger-request-params"> 353 <section class="swagger-request-params">
354 <div class="prop-row prop-group"> 354 <div class="prop-row prop-group">
355 <div class="prop-name"> 355 <div class="prop-name">
356 <div class="prop-title">id</div> 356 <div class="prop-title">name</div>
357 <span class="json-property-required"></span> 357 <span class="json-property-required"></span>
358 <div class="prop-subtitle"> in path </div> 358 <div class="prop-subtitle"> in path </div>
359 <div class="prop-subtitle"> 359 <div class="prop-subtitle">
@@ -362,7 +362,8 @@
362 </div> 362 </div>
363 </div> 363 </div>
364 <div class="prop-value"> 364 <div class="prop-value">
365 <p>The id of the account</p> 365 <p>The name of the account (chocobozzz or
366 <a href="mailto:chocobozzz@peertube.cpy.re">chocobozzz@peertube.cpy.re</a> for example)</p>
366 </div> 367 </div>
367 </div> 368 </div>
368 <div class="prop-row prop-group"> 369 <div class="prop-row prop-group">
@@ -458,7 +459,7 @@
458 </div> 459 </div>
459 </div> 460 </div>
460 </div> 461 </div>
461 <div id="operation--accounts--id--videos-get" class="operation panel" data-traverse-target="operation--accounts--id--videos-get"> 462 <div id="operation--accounts--name--videos-get" class="operation panel" data-traverse-target="operation--accounts--name--videos-get">
462 <!-- <section class="operation-tags row"> --> 463 <!-- <section class="operation-tags row"> -->
463 <!-- <div class="doc-copy"> --> 464 <!-- <div class="doc-copy"> -->
464 <div class="operation-tags"> 465 <div class="operation-tags">
@@ -470,7 +471,7 @@
470 <h2 class="operation-title"> 471 <h2 class="operation-title">
471 <span class="operation-name"> 472 <span class="operation-name">
472 <span class="operation-name">GET</span> 473 <span class="operation-name">GET</span>
473 <span class="operation-path">/accounts/{id}/videos</span> 474 <span class="operation-path">/accounts/{name}/videos</span>
474 </span> 475 </span>
475 </h2> 476 </h2>
476 <div class="doc-row"> 477 <div class="doc-row">
@@ -478,7 +479,7 @@
478 <section class="swagger-request-params"> 479 <section class="swagger-request-params">
479 <div class="prop-row prop-group"> 480 <div class="prop-row prop-group">
480 <div class="prop-name"> 481 <div class="prop-name">
481 <div class="prop-title">id</div> 482 <div class="prop-title">name</div>
482 <span class="json-property-required"></span> 483 <span class="json-property-required"></span>
483 <div class="prop-subtitle"> in path </div> 484 <div class="prop-subtitle"> in path </div>
484 <div class="prop-subtitle"> 485 <div class="prop-subtitle">
@@ -487,7 +488,8 @@
487 </div> 488 </div>
488 </div> 489 </div>
489 <div class="prop-value"> 490 <div class="prop-value">
490 <p>The id of the account</p> 491 <p>The name of the account (chocobozzz or
492 <a href="mailto:chocobozzz@peertube.cpy.re">chocobozzz@peertube.cpy.re</a> for example)</p>
491 </div> 493 </div>
492 </div> 494 </div>
493 </section> 495 </section>
@@ -5329,7 +5331,7 @@
5329 </div> 5331 </div>
5330 </div> 5332 </div>
5331 </div> 5333 </div>
5332 <div id="operation--accounts--accountId--video-channels-get" class="operation panel" data-traverse-target="operation--accounts--accountId--video-channels-get"> 5334 <div id="operation--accounts--name--video-channels-get" class="operation panel" data-traverse-target="operation--accounts--name--video-channels-get">
5333 <!-- <section class="operation-tags row"> --> 5335 <!-- <section class="operation-tags row"> -->
5334 <!-- <div class="doc-copy"> --> 5336 <!-- <div class="doc-copy"> -->
5335 <div class="operation-tags"> 5337 <div class="operation-tags">
@@ -5341,7 +5343,7 @@
5341 <h2 class="operation-title"> 5343 <h2 class="operation-title">
5342 <span class="operation-name"> 5344 <span class="operation-name">
5343 <span class="operation-name">GET</span> 5345 <span class="operation-name">GET</span>
5344 <span class="operation-path">/accounts/{accountId}/video-channels</span> 5346 <span class="operation-path">/accounts/{name}/video-channels</span>
5345 </span> 5347 </span>
5346 </h2> 5348 </h2>
5347 <div class="doc-row"> 5349 <div class="doc-row">
@@ -5349,7 +5351,7 @@
5349 <section class="swagger-request-params"> 5351 <section class="swagger-request-params">
5350 <div class="prop-row prop-group"> 5352 <div class="prop-row prop-group">
5351 <div class="prop-name"> 5353 <div class="prop-name">
5352 <div class="prop-title">accountId</div> 5354 <div class="prop-title">name</div>
5353 <span class="json-property-required"></span> 5355 <span class="json-property-required"></span>
5354 <div class="prop-subtitle"> in path </div> 5356 <div class="prop-subtitle"> in path </div>
5355 <div class="prop-subtitle"> 5357 <div class="prop-subtitle">
@@ -5358,7 +5360,8 @@
5358 </div> 5360 </div>
5359 </div> 5361 </div>
5360 <div class="prop-value"> 5362 <div class="prop-value">
5361 <p>The account id </p> 5363 <p>The name of the account (chocobozzz or
5364 <a href="mailto:chocobozzz@peertube.cpy.re">chocobozzz@peertube.cpy.re</a> for example)</p>
5362 </div> 5365 </div>
5363 </div> 5366 </div>
5364 </section> 5367 </section>
@@ -6403,6 +6406,41 @@
6403 <span class="json-property-type">object</span> 6406 <span class="json-property-type">object</span>
6404 <span class="json-property-range" title="Value limits"></span> 6407 <span class="json-property-range" title="Value limits"></span>
6405 </dt> 6408 </dt>
6409 <dt class="json-inner-schema">
6410 <section class="json-schema-properties">
6411 <dl>
6412 <dt data-property-name="name">
6413 <span class="json-property-name">name:</span>
6414 <span class="json-property-type">string</span>
6415 <span class="json-property-range" title="Value limits"></span>
6416 </dt>
6417 <dt data-property-name="displayName">
6418 <span class="json-property-name">displayName:</span>
6419 <span class="json-property-type">string</span>
6420 <span class="json-property-range" title="Value limits"></span>
6421 </dt>
6422 <dt data-property-name="url">
6423 <span class="json-property-name">url:</span>
6424 <span class="json-property-type">string</span>
6425 <span class="json-property-range" title="Value limits"></span>
6426 </dt>
6427 <dt data-property-name="host">
6428 <span class="json-property-name">host:</span>
6429 <span class="json-property-type">string</span>
6430 <span class="json-property-range" title="Value limits"></span>
6431 </dt>
6432 <dt data-property-name="avatar">
6433 <span class="json-property-name">avatar:</span>
6434 <span class="json-property-type">
6435 <span class="">
6436 <a class="json-schema-ref" href="#/definitions/Avatar">Avatar</a>
6437 </span>
6438 </span>
6439 <span class="json-property-range" title="Value limits"></span>
6440 </dt>
6441 </dl>
6442 </section>
6443 </dt>
6406 </dl> 6444 </dl>
6407 </section> 6445 </section>
6408 </div> 6446 </div>
@@ -6494,6 +6532,32 @@
6494 <span class="json-property-type">object</span> 6532 <span class="json-property-type">object</span>
6495 <span class="json-property-range" title="Value limits"></span> 6533 <span class="json-property-range" title="Value limits"></span>
6496 </dt> 6534 </dt>
6535 <dt class="json-inner-schema">
6536 <section class="json-schema-properties">
6537 <dl>
6538 <dt data-property-name="id">
6539 <span class="json-property-name">id:</span>
6540 <span class="json-property-type">number</span>
6541 <span class="json-property-range" title="Value limits"></span>
6542 </dt>
6543 <dt data-property-name="name">
6544 <span class="json-property-name">name:</span>
6545 <span class="json-property-type">string</span>
6546 <span class="json-property-range" title="Value limits"></span>
6547 </dt>
6548 <dt data-property-name="uuid">
6549 <span class="json-property-name">uuid:</span>
6550 <span class="json-property-type">string</span>
6551 <span class="json-property-range" title="Value limits"></span>
6552 </dt>
6553 <dt data-property-name="url">
6554 <span class="json-property-name">url:</span>
6555 <span class="json-property-type">string</span>
6556 <span class="json-property-range" title="Value limits"></span>
6557 </dt>
6558 </dl>
6559 </section>
6560 </dt>
6497 <dt data-property-name="createdAt"> 6561 <dt data-property-name="createdAt">
6498 <span class="json-property-name">createdAt:</span> 6562 <span class="json-property-name">createdAt:</span>
6499 <span class="json-property-type">string</span> 6563 <span class="json-property-type">string</span>
@@ -6671,6 +6735,22 @@
6671 <span class="json-property-type">object</span> 6735 <span class="json-property-type">object</span>
6672 <span class="json-property-range" title="Value limits"></span> 6736 <span class="json-property-range" title="Value limits"></span>
6673 </dt> 6737 </dt>
6738 <dt class="json-inner-schema">
6739 <section class="json-schema-properties">
6740 <dl>
6741 <dt data-property-name="id">
6742 <span class="json-property-name">id:</span>
6743 <span class="json-property-type">number</span>
6744 <span class="json-property-range" title="Value limits"></span>
6745 </dt>
6746 <dt data-property-name="uuid">
6747 <span class="json-property-name">uuid:</span>
6748 <span class="json-property-type">string</span>
6749 <span class="json-property-range" title="Value limits"></span>
6750 </dt>
6751 </dl>
6752 </section>
6753 </dt>
6674 </dl> 6754 </dl>
6675 </section> 6755 </section>
6676 </div> 6756 </div>
@@ -6830,6 +6910,17 @@
6830 </span> 6910 </span>
6831 <span class="json-property-range" title="Value limits"></span> 6911 <span class="json-property-range" title="Value limits"></span>
6832 </dt> 6912 </dt>
6913 <dt class="json-inner-schema">
6914 <section class="json-schema-array-items">
6915 <span class="json-property-type">
6916 <span class="">
6917 <a class="json-schema-ref" href="#/definitions/VideoCommentThreadTree">VideoCommentThreadTree</a>
6918 </span>
6919 </span>
6920 <span class="json-property-range" title="Value limits"></span>
6921 <div class="json-inner-schema"> </div>
6922 </section>
6923 </dt>
6833 </dl> 6924 </dl>
6834 </section> 6925 </section>
6835 </div> 6926 </div>
@@ -7210,6 +7301,17 @@
7210 </span> 7301 </span>
7211 <span class="json-property-range" title="Value limits"></span> 7302 <span class="json-property-range" title="Value limits"></span>
7212 </dt> 7303 </dt>
7304 <dt class="json-inner-schema">
7305 <section class="json-schema-array-items">
7306 <span class="json-property-type">
7307 <span class="">
7308 <a class="json-schema-ref" href="#/definitions/VideoChannel">VideoChannel</a>
7309 </span>
7310 </span>
7311 <span class="json-property-range" title="Value limits"></span>
7312 <div class="json-inner-schema"> </div>
7313 </section>
7314 </dt>
7213 </dl> 7315 </dl>
7214 </section> 7316 </section>
7215 </div> 7317 </div>
@@ -7278,21 +7380,124 @@
7278 <span class="json-property-type">object</span> 7380 <span class="json-property-type">object</span>
7279 <span class="json-property-range" title="Value limits"></span> 7381 <span class="json-property-range" title="Value limits"></span>
7280 </dt> 7382 </dt>
7383 <dt class="json-inner-schema">
7384 <section class="json-schema-properties">
7385 <dl>
7386 <dt data-property-name="allowed">
7387 <span class="json-property-name">allowed:</span>
7388 <span class="json-property-type">boolean</span>
7389 <span class="json-property-range" title="Value limits"></span>
7390 </dt>
7391 </dl>
7392 </section>
7393 </dt>
7281 <dt data-property-name="transcoding"> 7394 <dt data-property-name="transcoding">
7282 <span class="json-property-name">transcoding:</span> 7395 <span class="json-property-name">transcoding:</span>
7283 <span class="json-property-type">object</span> 7396 <span class="json-property-type">object</span>
7284 <span class="json-property-range" title="Value limits"></span> 7397 <span class="json-property-range" title="Value limits"></span>
7285 </dt> 7398 </dt>
7399 <dt class="json-inner-schema">
7400 <section class="json-schema-properties">
7401 <dl>
7402 <dt data-property-name="enabledResolutions">
7403 <span class="json-property-name">enabledResolutions:</span>
7404 <span class="json-property-type">number[]</span>
7405 <span class="json-property-range" title="Value limits"></span>
7406 </dt>
7407 <dt class="json-inner-schema">
7408 <section class="json-schema-array-items">
7409 <span class="json-property-type">number</span>
7410 <span class="json-property-range" title="Value limits"></span>
7411 <div class="json-inner-schema"> </div>
7412 </section>
7413 </dt>
7414 </dl>
7415 </section>
7416 </dt>
7286 <dt data-property-name="avatar"> 7417 <dt data-property-name="avatar">
7287 <span class="json-property-name">avatar:</span> 7418 <span class="json-property-name">avatar:</span>
7288 <span class="json-property-type">object</span> 7419 <span class="json-property-type">object</span>
7289 <span class="json-property-range" title="Value limits"></span> 7420 <span class="json-property-range" title="Value limits"></span>
7290 </dt> 7421 </dt>
7422 <dt class="json-inner-schema">
7423 <section class="json-schema-properties">
7424 <dl>
7425 <dt data-property-name="file">
7426 <span class="json-property-name">file:</span>
7427 <span class="json-property-type">object</span>
7428 <span class="json-property-range" title="Value limits"></span>
7429 </dt>
7430 <dt class="json-inner-schema">
7431 <section class="json-schema-properties">
7432 <dl>
7433 <dt data-property-name="size">
7434 <span class="json-property-name">size:</span>
7435 <span class="json-property-type">object</span>
7436 <span class="json-property-range" title="Value limits"></span>
7437 </dt>
7438 <dt class="json-inner-schema">
7439 <section class="json-schema-properties">
7440 <dl>
7441 <dt data-property-name="max">
7442 <span class="json-property-name">max:</span>
7443 <span class="json-property-type">number</span>
7444 <span class="json-property-range" title="Value limits"></span>
7445 </dt>
7446 </dl>
7447 </section>
7448 </dt>
7449 </dl>
7450 </section>
7451 </dt>
7452 <dt data-property-name="extensions">
7453 <span class="json-property-name">extensions:</span>
7454 <span class="json-property-type">string[]</span>
7455 <span class="json-property-range" title="Value limits"></span>
7456 </dt>
7457 <dt class="json-inner-schema">
7458 <section class="json-schema-array-items">
7459 <span class="json-property-type">string</span>
7460 <span class="json-property-range" title="Value limits"></span>
7461 <div class="json-inner-schema"> </div>
7462 </section>
7463 </dt>
7464 </dl>
7465 </section>
7466 </dt>
7291 <dt data-property-name="video"> 7467 <dt data-property-name="video">
7292 <span class="json-property-name">video:</span> 7468 <span class="json-property-name">video:</span>
7293 <span class="json-property-type">object</span> 7469 <span class="json-property-type">object</span>
7294 <span class="json-property-range" title="Value limits"></span> 7470 <span class="json-property-range" title="Value limits"></span>
7295 </dt> 7471 </dt>
7472 <dt class="json-inner-schema">
7473 <section class="json-schema-properties">
7474 <dl>
7475 <dt data-property-name="file">
7476 <span class="json-property-name">file:</span>
7477 <span class="json-property-type">object</span>
7478 <span class="json-property-range" title="Value limits"></span>
7479 </dt>
7480 <dt class="json-inner-schema">
7481 <section class="json-schema-properties">
7482 <dl>
7483 <dt data-property-name="extensions">
7484 <span class="json-property-name">extensions:</span>
7485 <span class="json-property-type">string[]</span>
7486 <span class="json-property-range" title="Value limits"></span>
7487 </dt>
7488 <dt class="json-inner-schema">
7489 <section class="json-schema-array-items">
7490 <span class="json-property-type">string</span>
7491 <span class="json-property-range" title="Value limits"></span>
7492 <div class="json-inner-schema"> </div>
7493 </section>
7494 </dt>
7495 </dl>
7496 </section>
7497 </dt>
7498 </dl>
7499 </section>
7500 </dt>
7296 </dl> 7501 </dl>
7297 </section> 7502 </section>
7298 </div> 7503 </div>
@@ -7579,6 +7784,22 @@
7579 <span class="json-property-type">object</span> 7784 <span class="json-property-type">object</span>
7580 <span class="json-property-range" title="Value limits"></span> 7785 <span class="json-property-range" title="Value limits"></span>
7581 </dt> 7786 </dt>
7787 <dt class="json-inner-schema">
7788 <section class="json-schema-properties">
7789 <dl>
7790 <dt data-property-name="id">
7791 <span class="json-property-name">id:</span>
7792 <span class="json-property-type">number</span>
7793 <span class="json-property-range" title="Value limits"></span>
7794 </dt>
7795 <dt data-property-name="uuid">
7796 <span class="json-property-name">uuid:</span>
7797 <span class="json-property-type">string</span>
7798 <span class="json-property-range" title="Value limits"></span>
7799 </dt>
7800 </dl>
7801 </section>
7802 </dt>
7582 </dl> 7803 </dl>
7583 </section> 7804 </section>
7584 </div> 7805 </div>
@@ -7624,6 +7845,17 @@
7624 </span> 7845 </span>
7625 <span class="json-property-range" title="Value limits"></span> 7846 <span class="json-property-range" title="Value limits"></span>
7626 </dt> 7847 </dt>
7848 <dt class="json-inner-schema">
7849 <section class="json-schema-array-items">
7850 <span class="json-property-type">
7851 <span class="">
7852 <a class="json-schema-ref" href="#/definitions/VideoComment">VideoComment</a>
7853 </span>
7854 </span>
7855 <span class="json-property-range" title="Value limits"></span>
7856 <div class="json-inner-schema"> </div>
7857 </section>
7858 </dt>
7627 </dl> 7859 </dl>
7628 </section> 7860 </section>
7629 </div> 7861 </div>
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml
index 46b73145a..a1e286973 100644
--- a/support/doc/api/openapi.yaml
+++ b/support/doc/api/openapi.yaml
@@ -16,7 +16,7 @@ basePath: '/api/v1'
16schemes: 16schemes:
17 - https 17 - https
18paths: 18paths:
19 '/accounts/{id}': 19 '/accounts/{name}':
20 get: 20 get:
21 tags: 21 tags:
22 - Accounts 22 - Accounts
@@ -25,11 +25,11 @@ paths:
25 produces: 25 produces:
26 - application/json 26 - application/json
27 parameters: 27 parameters:
28 - name: id 28 - name: name
29 in: path 29 in: path
30 required: true 30 required: true
31 type: string 31 type: string
32 description: 'The id of the account' 32 description: 'The name of the account (chocobozzz or chocobozzz@peertube.cpy.re for example)'
33 - name: start 33 - name: start
34 in: query 34 in: query
35 required: false 35 required: false
@@ -50,7 +50,7 @@ paths:
50 description: successful operation 50 description: successful operation
51 schema: 51 schema:
52 $ref: '#/definitions/Account' 52 $ref: '#/definitions/Account'
53 '/accounts/{id}/videos': 53 '/accounts/{name}/videos':
54 get: 54 get:
55 tags: 55 tags:
56 - Accounts 56 - Accounts
@@ -59,11 +59,11 @@ paths:
59 produces: 59 produces:
60 - application/json 60 - application/json
61 parameters: 61 parameters:
62 - name: id 62 - name: name
63 in: path 63 in: path
64 required: true 64 required: true
65 type: string 65 type: string
66 description: 'The id of the account' 66 description: 'The name of the account (chocobozzz or chocobozzz@peertube.cpy.re for example)'
67 responses: 67 responses:
68 '200': 68 '200':
69 description: successful operation 69 description: successful operation
@@ -1112,7 +1112,7 @@ paths:
1112 description: successful operation 1112 description: successful operation
1113 schema: 1113 schema:
1114 $ref: '#/definitions/Video' 1114 $ref: '#/definitions/Video'
1115 /accounts/{accountId}/video-channels: 1115 /accounts/{name}/video-channels:
1116 get: 1116 get:
1117 tags: 1117 tags:
1118 - VideoChannel 1118 - VideoChannel
@@ -1121,11 +1121,11 @@ paths:
1121 produces: 1121 produces:
1122 - application/json 1122 - application/json
1123 parameters: 1123 parameters:
1124 - name: accountId 1124 - name: name
1125 in: path 1125 in: path
1126 required: true 1126 required: true
1127 type: string 1127 type: string
1128 description: 'The account id ' 1128 description: 'The name of the account (chocobozzz or chocobozzz@peertube.cpy.re for example)'
1129 responses: 1129 responses:
1130 '200': 1130 '200':
1131 description: successful operation 1131 description: successful operation