mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 17:59:37 +02:00
Use handle for param name
This commit is contained in:
parent
ade57193ac
commit
6f68db1be9
9 changed files with 34 additions and 41 deletions
|
@ -62,7 +62,6 @@ describe('Test multiple servers', function () {
|
|||
})
|
||||
|
||||
describe('Should upload the video and propagate on each server', function () {
|
||||
|
||||
it('Should upload the video on server 1 and propagate on each server', async function () {
|
||||
this.timeout(60000)
|
||||
|
||||
|
@ -362,7 +361,6 @@ describe('Test multiple servers', function () {
|
|||
})
|
||||
|
||||
describe('Local videos listing', function () {
|
||||
|
||||
it('Should list only local videos on server 1', async function () {
|
||||
const { data, total } = await servers[0].videos.list({ isLocal: true })
|
||||
|
||||
|
@ -393,7 +391,6 @@ describe('Test multiple servers', function () {
|
|||
})
|
||||
|
||||
describe('All videos listing', function () {
|
||||
|
||||
it('Should list and sort by "localVideoFilesSize"', async function () {
|
||||
const { data, total } = await servers[2].videos.list({ sort: '-localVideoFilesSize' })
|
||||
|
||||
|
@ -408,7 +405,6 @@ describe('Test multiple servers', function () {
|
|||
})
|
||||
|
||||
describe('Should seed the uploaded video', function () {
|
||||
|
||||
it('Should add the file 1 by asking server 3', async function () {
|
||||
this.retries(2)
|
||||
this.timeout(30000)
|
||||
|
@ -1038,7 +1034,6 @@ describe('Test multiple servers', function () {
|
|||
})
|
||||
|
||||
describe('With minimum parameters', function () {
|
||||
|
||||
it('Should upload and propagate the video', async function () {
|
||||
this.timeout(240000)
|
||||
|
||||
|
@ -1120,13 +1115,11 @@ describe('Test multiple servers', function () {
|
|||
})
|
||||
|
||||
describe('TMP directory', function () {
|
||||
|
||||
it('Should have an empty tmp directory', async function () {
|
||||
for (const server of servers) {
|
||||
await checkTmpIsEmpty(server)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
after(async function () {
|
||||
|
|
|
@ -64,28 +64,28 @@ activityPubClientRouter.use(cors())
|
|||
// Intercept ActivityPub client requests
|
||||
|
||||
activityPubClientRouter.get(
|
||||
[ '/accounts?/:name', '/accounts?/:name/video-channels', '/a/:name', '/a/:name/video-channels' ],
|
||||
[ '/accounts?/:handle', '/accounts?/:handle/video-channels', '/a/:handle', '/a/:handle/video-channels' ],
|
||||
executeIfActivityPub,
|
||||
activityPubRateLimiter,
|
||||
asyncMiddleware(accountHandleGetValidatorFactory({ checkIsLocal: true, checkManage: false })),
|
||||
asyncMiddleware(accountController)
|
||||
)
|
||||
activityPubClientRouter.get(
|
||||
'/accounts?/:name/followers',
|
||||
'/accounts?/:handle/followers',
|
||||
executeIfActivityPub,
|
||||
activityPubRateLimiter,
|
||||
asyncMiddleware(accountHandleGetValidatorFactory({ checkIsLocal: true, checkManage: false })),
|
||||
asyncMiddleware(accountFollowersController)
|
||||
)
|
||||
activityPubClientRouter.get(
|
||||
'/accounts?/:name/following',
|
||||
'/accounts?/:handle/following',
|
||||
executeIfActivityPub,
|
||||
activityPubRateLimiter,
|
||||
asyncMiddleware(accountHandleGetValidatorFactory({ checkIsLocal: true, checkManage: false })),
|
||||
asyncMiddleware(accountFollowingController)
|
||||
)
|
||||
activityPubClientRouter.get(
|
||||
'/accounts?/:name/playlists',
|
||||
'/accounts?/:handle/playlists',
|
||||
executeIfActivityPub,
|
||||
activityPubRateLimiter,
|
||||
asyncMiddleware(accountHandleGetValidatorFactory({ checkIsLocal: true, checkManage: false })),
|
||||
|
@ -208,28 +208,28 @@ activityPubClientRouter.get(
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
activityPubClientRouter.get(
|
||||
[ '/video-channels/:nameWithHost', '/video-channels/:nameWithHost/videos', '/c/:nameWithHost', '/c/:nameWithHost/videos' ],
|
||||
[ '/video-channels/:handle', '/video-channels/:handle/videos', '/c/:handle', '/c/:handle/videos' ],
|
||||
executeIfActivityPub,
|
||||
activityPubRateLimiter,
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: true, checkManage: false })),
|
||||
asyncMiddleware(videoChannelController)
|
||||
)
|
||||
activityPubClientRouter.get(
|
||||
'/video-channels/:nameWithHost/followers',
|
||||
'/video-channels/:handle/followers',
|
||||
executeIfActivityPub,
|
||||
activityPubRateLimiter,
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: true, checkManage: false })),
|
||||
asyncMiddleware(videoChannelFollowersController)
|
||||
)
|
||||
activityPubClientRouter.get(
|
||||
'/video-channels/:nameWithHost/following',
|
||||
'/video-channels/:handle/following',
|
||||
executeIfActivityPub,
|
||||
activityPubRateLimiter,
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: true, checkManage: false })),
|
||||
asyncMiddleware(videoChannelFollowingController)
|
||||
)
|
||||
activityPubClientRouter.get(
|
||||
'/video-channels/:nameWithHost/playlists',
|
||||
'/video-channels/:handle/playlists',
|
||||
executeIfActivityPub,
|
||||
activityPubRateLimiter,
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: true, checkManage: false })),
|
||||
|
|
|
@ -25,7 +25,7 @@ inboxRouter.post(
|
|||
)
|
||||
|
||||
inboxRouter.post(
|
||||
'/accounts/:name/inbox',
|
||||
'/accounts/:handle/inbox',
|
||||
activityPubRateLimiter,
|
||||
signatureValidator,
|
||||
asyncMiddleware(checkSignature),
|
||||
|
@ -35,7 +35,7 @@ inboxRouter.post(
|
|||
)
|
||||
|
||||
inboxRouter.post(
|
||||
'/video-channels/:nameWithHost/inbox',
|
||||
'/video-channels/:handle/inbox',
|
||||
activityPubRateLimiter,
|
||||
signatureValidator,
|
||||
asyncMiddleware(checkSignature),
|
||||
|
|
|
@ -20,7 +20,7 @@ import { activityPubResponse } from './utils.js'
|
|||
const outboxRouter = express.Router()
|
||||
|
||||
outboxRouter.get(
|
||||
'/accounts/:name/outbox',
|
||||
'/accounts/:handle/outbox',
|
||||
activityPubRateLimiter,
|
||||
apPaginationValidator,
|
||||
accountHandleGetValidatorFactory({ checkIsLocal: true, checkManage: false }),
|
||||
|
@ -28,7 +28,7 @@ outboxRouter.get(
|
|||
)
|
||||
|
||||
outboxRouter.get(
|
||||
'/video-channels/:nameWithHost/outbox',
|
||||
'/video-channels/:handle/outbox',
|
||||
activityPubRateLimiter,
|
||||
apPaginationValidator,
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: true, checkManage: false })),
|
||||
|
|
|
@ -52,13 +52,13 @@ accountsRouter.get(
|
|||
)
|
||||
|
||||
accountsRouter.get(
|
||||
'/:accountName',
|
||||
'/:handle',
|
||||
asyncMiddleware(accountHandleGetValidatorFactory({ checkIsLocal: false, checkManage: false })),
|
||||
getAccount
|
||||
)
|
||||
|
||||
accountsRouter.get(
|
||||
'/:accountName/videos',
|
||||
'/:handle/videos',
|
||||
asyncMiddleware(accountHandleGetValidatorFactory({ checkIsLocal: false, checkManage: false })),
|
||||
paginationValidator,
|
||||
videosSortValidator,
|
||||
|
@ -70,7 +70,7 @@ accountsRouter.get(
|
|||
)
|
||||
|
||||
accountsRouter.get(
|
||||
'/:accountName/video-channels',
|
||||
'/:handle/video-channels',
|
||||
asyncMiddleware(accountHandleGetValidatorFactory({ checkIsLocal: false, checkManage: false })),
|
||||
videoChannelStatsValidator,
|
||||
paginationValidator,
|
||||
|
@ -81,7 +81,7 @@ accountsRouter.get(
|
|||
)
|
||||
|
||||
accountsRouter.get(
|
||||
'/:accountName/video-playlists',
|
||||
'/:handle/video-playlists',
|
||||
optionalAuthenticate,
|
||||
asyncMiddleware(accountHandleGetValidatorFactory({ checkIsLocal: false, checkManage: false })),
|
||||
paginationValidator,
|
||||
|
@ -94,7 +94,7 @@ accountsRouter.get(
|
|||
)
|
||||
|
||||
accountsRouter.get(
|
||||
'/:accountName/video-channel-syncs',
|
||||
'/:handle/video-channel-syncs',
|
||||
authenticate,
|
||||
asyncMiddleware(accountHandleGetValidatorFactory({ checkIsLocal: true, checkManage: true })),
|
||||
paginationValidator,
|
||||
|
@ -105,7 +105,7 @@ accountsRouter.get(
|
|||
)
|
||||
|
||||
accountsRouter.get(
|
||||
'/:accountName/ratings',
|
||||
'/:handle/ratings',
|
||||
authenticate,
|
||||
asyncMiddleware(accountHandleGetValidatorFactory({ checkIsLocal: true, checkManage: true })),
|
||||
paginationValidator,
|
||||
|
@ -117,7 +117,7 @@ accountsRouter.get(
|
|||
)
|
||||
|
||||
accountsRouter.get(
|
||||
'/:accountName/followers',
|
||||
'/:handle/followers',
|
||||
authenticate,
|
||||
asyncMiddleware(accountHandleGetValidatorFactory({ checkIsLocal: true, checkManage: true })),
|
||||
paginationValidator,
|
||||
|
|
|
@ -76,7 +76,7 @@ videoChannelRouter.get(
|
|||
videoChannelRouter.post('/', authenticate, asyncMiddleware(videoChannelsAddValidator), asyncRetryTransactionMiddleware(createVideoChannel))
|
||||
|
||||
videoChannelRouter.post(
|
||||
'/:nameWithHost/avatar/pick',
|
||||
'/:handle/avatar/pick',
|
||||
authenticate,
|
||||
reqAvatarFile,
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: true, checkManage: true })),
|
||||
|
@ -85,7 +85,7 @@ videoChannelRouter.post(
|
|||
)
|
||||
|
||||
videoChannelRouter.post(
|
||||
'/:nameWithHost/banner/pick',
|
||||
'/:handle/banner/pick',
|
||||
authenticate,
|
||||
reqBannerFile,
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: true, checkManage: true })),
|
||||
|
@ -94,21 +94,21 @@ videoChannelRouter.post(
|
|||
)
|
||||
|
||||
videoChannelRouter.delete(
|
||||
'/:nameWithHost/avatar',
|
||||
'/:handle/avatar',
|
||||
authenticate,
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: true, checkManage: true })),
|
||||
asyncMiddleware(deleteVideoChannelAvatar)
|
||||
)
|
||||
|
||||
videoChannelRouter.delete(
|
||||
'/:nameWithHost/banner',
|
||||
'/:handle/banner',
|
||||
authenticate,
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: true, checkManage: true })),
|
||||
asyncMiddleware(deleteVideoChannelBanner)
|
||||
)
|
||||
|
||||
videoChannelRouter.put(
|
||||
'/:nameWithHost',
|
||||
'/:handle',
|
||||
authenticate,
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: true, checkManage: true })),
|
||||
videoChannelsUpdateValidator,
|
||||
|
@ -116,7 +116,7 @@ videoChannelRouter.put(
|
|||
)
|
||||
|
||||
videoChannelRouter.delete(
|
||||
'/:nameWithHost',
|
||||
'/:handle',
|
||||
authenticate,
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: true, checkManage: true })),
|
||||
asyncMiddleware(videoChannelsRemoveValidator),
|
||||
|
@ -124,13 +124,13 @@ videoChannelRouter.delete(
|
|||
)
|
||||
|
||||
videoChannelRouter.get(
|
||||
'/:nameWithHost',
|
||||
'/:handle',
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: false, checkManage: false })),
|
||||
asyncMiddleware(getVideoChannel)
|
||||
)
|
||||
|
||||
videoChannelRouter.get(
|
||||
'/:nameWithHost/video-playlists',
|
||||
'/:handle/video-playlists',
|
||||
optionalAuthenticate,
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: false, checkManage: false })),
|
||||
paginationValidator,
|
||||
|
@ -142,7 +142,7 @@ videoChannelRouter.get(
|
|||
)
|
||||
|
||||
videoChannelRouter.get(
|
||||
'/:nameWithHost/videos',
|
||||
'/:handle/videos',
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: false, checkManage: false })),
|
||||
paginationValidator,
|
||||
videosSortValidator,
|
||||
|
@ -154,7 +154,7 @@ videoChannelRouter.get(
|
|||
)
|
||||
|
||||
videoChannelRouter.get(
|
||||
'/:nameWithHost/followers',
|
||||
'/:handle/followers',
|
||||
authenticate,
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: false, checkManage: true })),
|
||||
paginationValidator,
|
||||
|
@ -165,7 +165,7 @@ videoChannelRouter.get(
|
|||
)
|
||||
|
||||
videoChannelRouter.post(
|
||||
'/:nameWithHost/import-videos',
|
||||
'/:handle/import-videos',
|
||||
authenticate,
|
||||
asyncMiddleware(videoChannelsHandleValidatorFactory({ checkIsLocal: true, checkManage: true })),
|
||||
asyncMiddleware(videoChannelImportVideosValidator),
|
||||
|
|
|
@ -10,7 +10,7 @@ const servicesRouter = express.Router()
|
|||
|
||||
servicesRouter.use('/oembed', cors(), apiRateLimiter, asyncMiddleware(oembedValidator), generateOEmbed)
|
||||
servicesRouter.use(
|
||||
'/redirect/accounts/:accountName',
|
||||
'/redirect/accounts/:handle',
|
||||
apiRateLimiter,
|
||||
asyncMiddleware(accountHandleGetValidatorFactory({ checkIsLocal: false, checkManage: false })),
|
||||
redirectToAccountUrl
|
||||
|
|
|
@ -10,7 +10,7 @@ export const accountHandleGetValidatorFactory = (options: {
|
|||
const { checkManage, checkIsLocal } = options
|
||||
|
||||
return [
|
||||
param('accountName')
|
||||
param('handle')
|
||||
.exists(),
|
||||
|
||||
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
|
|
|
@ -89,7 +89,7 @@ export const videoChannelsHandleValidatorFactory = (options: {
|
|||
const { checkIsLocal, checkManage } = options
|
||||
|
||||
return [
|
||||
param('nameWithHost')
|
||||
param('handle')
|
||||
.exists(),
|
||||
|
||||
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue