Video blacklist refractoring
This commit is contained in:
parent
769d332177
commit
35bf0c83c8
|
@ -9,7 +9,7 @@ import { RequestSchedulersRoutes } from './request-schedulers'
|
||||||
import { UsersRoutes } from './users'
|
import { UsersRoutes } from './users'
|
||||||
import { VideoAbusesRoutes } from './video-abuses'
|
import { VideoAbusesRoutes } from './video-abuses'
|
||||||
import { AdminGuard } from './admin-guard.service'
|
import { AdminGuard } from './admin-guard.service'
|
||||||
import { BlacklistRoutes } from './blacklist'
|
import { VideoBlacklistRoutes } from './video-blacklist'
|
||||||
|
|
||||||
const adminRoutes: Routes = [
|
const adminRoutes: Routes = [
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ const adminRoutes: Routes = [
|
||||||
...RequestSchedulersRoutes,
|
...RequestSchedulersRoutes,
|
||||||
...UsersRoutes,
|
...UsersRoutes,
|
||||||
...VideoAbusesRoutes,
|
...VideoAbusesRoutes,
|
||||||
...BlacklistRoutes
|
...VideoBlacklistRoutes
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -3,6 +3,5 @@ import { Component } from '@angular/core'
|
||||||
@Component({
|
@Component({
|
||||||
template: '<router-outlet></router-outlet>'
|
template: '<router-outlet></router-outlet>'
|
||||||
})
|
})
|
||||||
|
|
||||||
export class AdminComponent {
|
export class AdminComponent {
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendServic
|
||||||
import { RequestSchedulersComponent, RequestSchedulersStatsComponent, RequestSchedulersService } from './request-schedulers'
|
import { RequestSchedulersComponent, RequestSchedulersStatsComponent, RequestSchedulersService } from './request-schedulers'
|
||||||
import { UsersComponent, UserAddComponent, UserUpdateComponent, UserListComponent, UserService } from './users'
|
import { UsersComponent, UserAddComponent, UserUpdateComponent, UserListComponent, UserService } from './users'
|
||||||
import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses'
|
import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses'
|
||||||
import { BlacklistComponent, BlacklistListComponent, BlacklistService } from './blacklist'
|
import { VideoBlacklistComponent, VideoBlacklistListComponent } from './video-blacklist'
|
||||||
import { SharedModule } from '../shared'
|
import { SharedModule } from '../shared'
|
||||||
import { AdminGuard } from './admin-guard.service'
|
import { AdminGuard } from './admin-guard.service'
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ import { AdminGuard } from './admin-guard.service'
|
||||||
UserUpdateComponent,
|
UserUpdateComponent,
|
||||||
UserListComponent,
|
UserListComponent,
|
||||||
|
|
||||||
BlacklistComponent,
|
VideoBlacklistComponent,
|
||||||
BlacklistListComponent,
|
VideoBlacklistListComponent,
|
||||||
|
|
||||||
VideoAbusesComponent,
|
VideoAbusesComponent,
|
||||||
VideoAbuseListComponent
|
VideoAbuseListComponent
|
||||||
|
@ -46,8 +46,7 @@ import { AdminGuard } from './admin-guard.service'
|
||||||
FriendService,
|
FriendService,
|
||||||
RequestSchedulersService,
|
RequestSchedulersService,
|
||||||
UserService,
|
UserService,
|
||||||
AdminGuard,
|
AdminGuard
|
||||||
BlacklistService
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AdminModule { }
|
export class AdminModule { }
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './blacklist-list.component'
|
|
|
@ -1,27 +0,0 @@
|
||||||
import { Routes } from '@angular/router'
|
|
||||||
|
|
||||||
import { BlacklistComponent } from './blacklist.component'
|
|
||||||
import { BlacklistListComponent } from './blacklist-list'
|
|
||||||
|
|
||||||
export const BlacklistRoutes: Routes = [
|
|
||||||
{
|
|
||||||
path: 'blacklist',
|
|
||||||
component: BlacklistComponent,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
redirectTo: 'list',
|
|
||||||
pathMatch: 'full'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'list',
|
|
||||||
component: BlacklistListComponent,
|
|
||||||
data: {
|
|
||||||
meta: {
|
|
||||||
title: 'Blacklisted videos'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -1,4 +0,0 @@
|
||||||
export * from './shared'
|
|
||||||
export * from './blacklist-list'
|
|
||||||
export * from './blacklist.component'
|
|
||||||
export * from './blacklist.routes'
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './blacklist.service'
|
|
3
client/src/app/+admin/video-blacklist/index.ts
Normal file
3
client/src/app/+admin/video-blacklist/index.ts
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export * from './video-blacklist-list'
|
||||||
|
export * from './video-blacklist.component'
|
||||||
|
export * from './video-blacklist.routes'
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './video-blacklist-list.component'
|
|
@ -18,8 +18,8 @@
|
||||||
<p-column field="createdAt" header="Created date" [sortable]="true"></p-column>
|
<p-column field="createdAt" header="Created date" [sortable]="true"></p-column>
|
||||||
<p-column header="Delete" styleClass="action-cell">
|
<p-column header="Delete" styleClass="action-cell">
|
||||||
<ng-template pTemplate="body" let-entry="rowData">
|
<ng-template pTemplate="body" let-entry="rowData">
|
||||||
<span (click)="removeVideoFromBlacklist(entry)" class="glyphicon glyphicon-remove glyphicon-black" title="Remove this video"></span>
|
<span (click)="removeVideoFromBlacklist(entry)" class="glyphicon glyphicon-remove glyphicon-black" title="Remove this video from blacklist"></span>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</p-column>
|
</p-column>
|
||||||
</p-dataTable>
|
</p-dataTable>
|
||||||
</div>
|
</div>
|
|
@ -4,16 +4,15 @@ import { SortMeta } from 'primeng/components/common/sortmeta'
|
||||||
import { NotificationsService } from 'angular2-notifications'
|
import { NotificationsService } from 'angular2-notifications'
|
||||||
|
|
||||||
import { ConfirmService } from '../../../core'
|
import { ConfirmService } from '../../../core'
|
||||||
import { RestTable, RestPagination } from '../../../shared'
|
import { VideoBlacklistService, RestTable, RestPagination } from '../../../shared'
|
||||||
import { BlacklistService } from '../shared'
|
|
||||||
import { BlacklistedVideo } from '../../../../../../shared'
|
import { BlacklistedVideo } from '../../../../../../shared'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-blacklist-list',
|
selector: 'my-video-blacklist-list',
|
||||||
templateUrl: './blacklist-list.component.html',
|
templateUrl: './video-blacklist-list.component.html',
|
||||||
styleUrls: []
|
styleUrls: []
|
||||||
})
|
})
|
||||||
export class BlacklistListComponent extends RestTable implements OnInit {
|
export class VideoBlacklistListComponent extends RestTable implements OnInit {
|
||||||
blacklist: BlacklistedVideo[] = []
|
blacklist: BlacklistedVideo[] = []
|
||||||
totalRecords = 0
|
totalRecords = 0
|
||||||
rowsPerPage = 10
|
rowsPerPage = 10
|
||||||
|
@ -23,7 +22,7 @@ export class BlacklistListComponent extends RestTable implements OnInit {
|
||||||
constructor (
|
constructor (
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
private confirmService: ConfirmService,
|
private confirmService: ConfirmService,
|
||||||
private blacklistService: BlacklistService
|
private videoBlacklistService: VideoBlacklistService
|
||||||
) {
|
) {
|
||||||
super()
|
super()
|
||||||
}
|
}
|
||||||
|
@ -39,7 +38,7 @@ export class BlacklistListComponent extends RestTable implements OnInit {
|
||||||
res => {
|
res => {
|
||||||
if (res === false) return
|
if (res === false) return
|
||||||
|
|
||||||
this.blacklistService.removeVideoFromBlacklist(entry).subscribe(
|
this.videoBlacklistService.removeVideoFromBlacklist(entry.videoId).subscribe(
|
||||||
status => {
|
status => {
|
||||||
this.notificationsService.success('Success', `Video ${entry.name} removed from the blacklist.`)
|
this.notificationsService.success('Success', `Video ${entry.name} removed from the blacklist.`)
|
||||||
this.loadData()
|
this.loadData()
|
||||||
|
@ -52,7 +51,7 @@ export class BlacklistListComponent extends RestTable implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected loadData () {
|
protected loadData () {
|
||||||
this.blacklistService.getBlacklist(this.pagination, this.sort)
|
this.videoBlacklistService.listBlacklist(this.pagination, this.sort)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
resultList => {
|
resultList => {
|
||||||
this.blacklist = resultList.data
|
this.blacklist = resultList.data
|
|
@ -3,6 +3,5 @@ import { Component } from '@angular/core'
|
||||||
@Component({
|
@Component({
|
||||||
template: '<router-outlet></router-outlet>'
|
template: '<router-outlet></router-outlet>'
|
||||||
})
|
})
|
||||||
|
export class VideoBlacklistComponent {
|
||||||
export class BlacklistComponent {
|
|
||||||
}
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { Routes } from '@angular/router'
|
||||||
|
|
||||||
|
import { VideoBlacklistComponent } from './video-blacklist.component'
|
||||||
|
import { VideoBlacklistListComponent } from './video-blacklist-list'
|
||||||
|
|
||||||
|
export const VideoBlacklistRoutes: Routes = [
|
||||||
|
{
|
||||||
|
path: 'video-blacklist',
|
||||||
|
component: VideoBlacklistComponent,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
redirectTo: 'list',
|
||||||
|
pathMatch: 'full'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'list',
|
||||||
|
component: VideoBlacklistListComponent,
|
||||||
|
data: {
|
||||||
|
meta: {
|
||||||
|
title: 'Blacklisted videos'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
|
@ -11,7 +11,7 @@ import { UserService } from './shared'
|
||||||
})
|
})
|
||||||
export class AppComponent implements OnInit {
|
export class AppComponent implements OnInit {
|
||||||
notificationOptions = {
|
notificationOptions = {
|
||||||
timeOut: 3000,
|
timeOut: 5000,
|
||||||
lastOnBottom: true,
|
lastOnBottom: true,
|
||||||
clickToClose: true,
|
clickToClose: true,
|
||||||
maxLength: 0,
|
maxLength: 0,
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
Video abuses
|
Video abuses
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a routerLink="/admin/blacklist/list" routerLinkActive="active">
|
<a routerLink="/admin/video-blacklist/list" routerLinkActive="active">
|
||||||
<span class="hidden-xs glyphicon glyphicon-eye-close"></span>
|
<span class="hidden-xs glyphicon glyphicon-eye-close"></span>
|
||||||
Video blacklist
|
Video blacklist
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -4,5 +4,6 @@ export * from './rest'
|
||||||
export * from './search'
|
export * from './search'
|
||||||
export * from './users'
|
export * from './users'
|
||||||
export * from './video-abuse'
|
export * from './video-abuse'
|
||||||
|
export * from './video-blacklist'
|
||||||
export * from './shared.module'
|
export * from './shared.module'
|
||||||
export * from './utils'
|
export * from './utils'
|
||||||
|
|
|
@ -18,6 +18,7 @@ import { RestExtractor, RestService } from './rest'
|
||||||
import { SearchComponent, SearchService } from './search'
|
import { SearchComponent, SearchService } from './search'
|
||||||
import { UserService } from './users'
|
import { UserService } from './users'
|
||||||
import { VideoAbuseService } from './video-abuse'
|
import { VideoAbuseService } from './video-abuse'
|
||||||
|
import { VideoBlacklistService } from './video-blacklist'
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -67,6 +68,7 @@ import { VideoAbuseService } from './video-abuse'
|
||||||
RestService,
|
RestService,
|
||||||
SearchService,
|
SearchService,
|
||||||
VideoAbuseService,
|
VideoAbuseService,
|
||||||
|
VideoBlacklistService,
|
||||||
UserService
|
UserService
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
1
client/src/app/shared/video-blacklist/index.ts
Normal file
1
client/src/app/shared/video-blacklist/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export * from './video-blacklist.service'
|
|
@ -6,13 +6,13 @@ import 'rxjs/add/operator/map'
|
||||||
|
|
||||||
import { SortMeta } from 'primeng/components/common/sortmeta'
|
import { SortMeta } from 'primeng/components/common/sortmeta'
|
||||||
|
|
||||||
import { RestExtractor, RestPagination, RestService } from '../../../shared'
|
import { RestExtractor, RestPagination, RestService } from '../rest'
|
||||||
import { Utils } from '../../../shared'
|
import { Utils } from '../utils'
|
||||||
import { BlacklistedVideo, ResultList } from '../../../../../../shared'
|
import { BlacklistedVideo, ResultList } from '../../../../../shared'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BlacklistService {
|
export class VideoBlacklistService {
|
||||||
private static BASE_BLACKLISTS_URL = API_URL + '/api/v1/blacklist/'
|
private static BASE_VIDEOS_URL = API_URL + '/api/v1/videos/'
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private authHttp: HttpClient,
|
private authHttp: HttpClient,
|
||||||
|
@ -20,22 +20,28 @@ export class BlacklistService {
|
||||||
private restExtractor: RestExtractor
|
private restExtractor: RestExtractor
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
getBlacklist (pagination: RestPagination, sort: SortMeta): Observable<ResultList<BlacklistedVideo>> {
|
listBlacklist (pagination: RestPagination, sort: SortMeta): Observable<ResultList<BlacklistedVideo>> {
|
||||||
let params = new HttpParams()
|
let params = new HttpParams()
|
||||||
params = this.restService.addRestGetParams(params, pagination, sort)
|
params = this.restService.addRestGetParams(params, pagination, sort)
|
||||||
|
|
||||||
return this.authHttp.get<ResultList<BlacklistedVideo>>(BlacklistService.BASE_BLACKLISTS_URL, { params })
|
return this.authHttp.get<ResultList<BlacklistedVideo>>(VideoBlacklistService.BASE_VIDEOS_URL + 'blacklist', { params })
|
||||||
.map(res => this.restExtractor.convertResultListDateToHuman(res))
|
.map(res => this.restExtractor.convertResultListDateToHuman(res))
|
||||||
.map(res => this.restExtractor.applyToResultListData(res, this.formatBlacklistedVideo.bind(this)))
|
.map(res => this.restExtractor.applyToResultListData(res, this.formatBlacklistedVideo.bind(this)))
|
||||||
.catch(res => this.restExtractor.handleError(res))
|
.catch(res => this.restExtractor.handleError(res))
|
||||||
}
|
}
|
||||||
|
|
||||||
removeVideoFromBlacklist (entry: BlacklistedVideo) {
|
removeVideoFromBlacklist (videoId: number) {
|
||||||
return this.authHttp.delete(BlacklistService.BASE_BLACKLISTS_URL + entry.id)
|
return this.authHttp.delete(VideoBlacklistService.BASE_VIDEOS_URL + videoId + '/blacklist')
|
||||||
.map(this.restExtractor.extractDataBool)
|
.map(this.restExtractor.extractDataBool)
|
||||||
.catch(res => this.restExtractor.handleError(res))
|
.catch(res => this.restExtractor.handleError(res))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
blacklistVideo (videoId: number) {
|
||||||
|
return this.authHttp.post(VideoBlacklistService.BASE_VIDEOS_URL + videoId + '/blacklist', {})
|
||||||
|
.map(this.restExtractor.extractDataBool)
|
||||||
|
.catch(res => this.restExtractor.handleError(res))
|
||||||
|
}
|
||||||
|
|
||||||
private formatBlacklistedVideo (blacklistedVideo: BlacklistedVideo) {
|
private formatBlacklistedVideo (blacklistedVideo: BlacklistedVideo) {
|
||||||
return Object.assign(blacklistedVideo, {
|
return Object.assign(blacklistedVideo, {
|
||||||
createdAt: Utils.dateToHuman(blacklistedVideo.createdAt)
|
createdAt: Utils.dateToHuman(blacklistedVideo.createdAt)
|
|
@ -14,7 +14,7 @@ import { VideoMagnetComponent } from './video-magnet.component'
|
||||||
import { VideoShareComponent } from './video-share.component'
|
import { VideoShareComponent } from './video-share.component'
|
||||||
import { VideoReportComponent } from './video-report.component'
|
import { VideoReportComponent } from './video-report.component'
|
||||||
import { Video, VideoService } from '../shared'
|
import { Video, VideoService } from '../shared'
|
||||||
import { WebTorrentService } from './webtorrent.service'
|
import { VideoBlacklistService } from '../../shared'
|
||||||
import { UserVideoRateType, VideoRateType } from '../../../../../shared'
|
import { UserVideoRateType, VideoRateType } from '../../../../../shared'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -45,6 +45,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private videoService: VideoService,
|
private videoService: VideoService,
|
||||||
|
private videoBlacklistService: VideoBlacklistService,
|
||||||
private confirmService: ConfirmService,
|
private confirmService: ConfirmService,
|
||||||
private metaService: MetaService,
|
private metaService: MetaService,
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
|
@ -137,15 +138,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
res => {
|
res => {
|
||||||
if (res === false) return
|
if (res === false) return
|
||||||
|
|
||||||
this.videoService.blacklistVideo(this.video.id)
|
this.videoBlacklistService.blacklistVideo(this.video.id)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
status => {
|
status => {
|
||||||
this.notificationsService.success('Success', `Video ${this.video.name} had been blacklisted.`)
|
this.notificationsService.success('Success', `Video ${this.video.name} had been blacklisted.`)
|
||||||
this.router.navigate(['/videos/list'])
|
this.router.navigate(['/videos/list'])
|
||||||
},
|
},
|
||||||
|
|
||||||
error => this.notificationsService.error('Error', error.text)
|
error => this.notificationsService.error('Error', error.text)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,12 +122,6 @@ export class VideoService {
|
||||||
.catch(res => this.restExtractor.handleError(res))
|
.catch(res => this.restExtractor.handleError(res))
|
||||||
}
|
}
|
||||||
|
|
||||||
blacklistVideo (id: number) {
|
|
||||||
return this.authHttp.post(VideoService.BASE_VIDEO_URL + id + '/blacklist', {})
|
|
||||||
.map(this.restExtractor.extractDataBool)
|
|
||||||
.catch(res => this.restExtractor.handleError(res))
|
|
||||||
}
|
|
||||||
|
|
||||||
private videoPaginationToRestPagination (videoPagination: VideoPagination) {
|
private videoPaginationToRestPagination (videoPagination: VideoPagination) {
|
||||||
const start: number = (videoPagination.currentPage - 1) * videoPagination.itemsPerPage
|
const start: number = (videoPagination.currentPage - 1) * videoPagination.itemsPerPage
|
||||||
const count: number = videoPagination.itemsPerPage
|
const count: number = videoPagination.itemsPerPage
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
import * as express from 'express'
|
|
||||||
|
|
||||||
import { database } from '../../initializers'
|
|
||||||
import { getFormattedObjects } from '../../helpers'
|
|
||||||
import { BlacklistedVideo } from '../../../shared'
|
|
||||||
import { BlacklistedVideoInstance } from '../../models'
|
|
||||||
|
|
||||||
import {
|
|
||||||
removeVideoFromBlacklist
|
|
||||||
} from '../../lib'
|
|
||||||
import {
|
|
||||||
authenticate,
|
|
||||||
ensureIsAdmin,
|
|
||||||
paginationValidator,
|
|
||||||
blacklistSortValidator,
|
|
||||||
setBlacklistSort,
|
|
||||||
setPagination,
|
|
||||||
blacklistRemoveValidator
|
|
||||||
} from '../../middlewares'
|
|
||||||
|
|
||||||
const blacklistRouter = express.Router()
|
|
||||||
|
|
||||||
blacklistRouter.get('/',
|
|
||||||
authenticate,
|
|
||||||
ensureIsAdmin,
|
|
||||||
paginationValidator,
|
|
||||||
blacklistSortValidator,
|
|
||||||
setBlacklistSort,
|
|
||||||
setPagination,
|
|
||||||
listBlacklist
|
|
||||||
)
|
|
||||||
|
|
||||||
blacklistRouter.delete('/:id',
|
|
||||||
authenticate,
|
|
||||||
ensureIsAdmin,
|
|
||||||
blacklistRemoveValidator,
|
|
||||||
removeVideoFromBlacklistController
|
|
||||||
)
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export {
|
|
||||||
blacklistRouter
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function listBlacklist (req: express.Request, res: express.Response, next: express.NextFunction) {
|
|
||||||
database.BlacklistedVideo.listForApi(req.query.start, req.query.count, req.query.sort)
|
|
||||||
.then(resultList => res.json(getFormattedObjects<BlacklistedVideo, BlacklistedVideoInstance>(resultList.data, resultList.total)))
|
|
||||||
.catch(err => next(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeVideoFromBlacklistController (req: express.Request, res: express.Response, next: express.NextFunction) {
|
|
||||||
const entry = res.locals.blacklistEntryToRemove as BlacklistedVideoInstance
|
|
||||||
|
|
||||||
removeVideoFromBlacklist(entry)
|
|
||||||
.then(() => res.sendStatus(204))
|
|
||||||
.catch(err => next(err))
|
|
||||||
}
|
|
|
@ -9,7 +9,6 @@ import { remoteRouter } from './remote'
|
||||||
import { requestSchedulerRouter } from './request-schedulers'
|
import { requestSchedulerRouter } from './request-schedulers'
|
||||||
import { usersRouter } from './users'
|
import { usersRouter } from './users'
|
||||||
import { videosRouter } from './videos'
|
import { videosRouter } from './videos'
|
||||||
import { blacklistRouter } from './blacklist'
|
|
||||||
|
|
||||||
const apiRouter = express.Router()
|
const apiRouter = express.Router()
|
||||||
|
|
||||||
|
@ -20,7 +19,6 @@ apiRouter.use('/remote', remoteRouter)
|
||||||
apiRouter.use('/request-schedulers', requestSchedulerRouter)
|
apiRouter.use('/request-schedulers', requestSchedulerRouter)
|
||||||
apiRouter.use('/users', usersRouter)
|
apiRouter.use('/users', usersRouter)
|
||||||
apiRouter.use('/videos', videosRouter)
|
apiRouter.use('/videos', videosRouter)
|
||||||
apiRouter.use('/blacklist', blacklistRouter)
|
|
||||||
apiRouter.use('/ping', pong)
|
apiRouter.use('/ping', pong)
|
||||||
apiRouter.use('/*', badRequest)
|
apiRouter.use('/*', badRequest)
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,46 @@
|
||||||
import * as express from 'express'
|
import * as express from 'express'
|
||||||
|
|
||||||
import { database as db } from '../../../initializers/database'
|
import { database as db } from '../../../initializers'
|
||||||
import { logger } from '../../../helpers'
|
import { logger, getFormattedObjects } from '../../../helpers'
|
||||||
import {
|
import {
|
||||||
authenticate,
|
authenticate,
|
||||||
ensureIsAdmin,
|
ensureIsAdmin,
|
||||||
videosBlacklistValidator
|
videosBlacklistAddValidator,
|
||||||
|
videosBlacklistRemoveValidator,
|
||||||
|
paginationValidator,
|
||||||
|
blacklistSortValidator,
|
||||||
|
setBlacklistSort,
|
||||||
|
setPagination
|
||||||
} from '../../../middlewares'
|
} from '../../../middlewares'
|
||||||
|
import { BlacklistedVideoInstance } from '../../../models'
|
||||||
|
import { BlacklistedVideo } from '../../../../shared'
|
||||||
|
|
||||||
const blacklistRouter = express.Router()
|
const blacklistRouter = express.Router()
|
||||||
|
|
||||||
blacklistRouter.post('/:id/blacklist',
|
blacklistRouter.post('/:videoId/blacklist',
|
||||||
authenticate,
|
authenticate,
|
||||||
ensureIsAdmin,
|
ensureIsAdmin,
|
||||||
videosBlacklistValidator,
|
videosBlacklistAddValidator,
|
||||||
addVideoToBlacklist
|
addVideoToBlacklist
|
||||||
)
|
)
|
||||||
|
|
||||||
|
blacklistRouter.get('/blacklist',
|
||||||
|
authenticate,
|
||||||
|
ensureIsAdmin,
|
||||||
|
paginationValidator,
|
||||||
|
blacklistSortValidator,
|
||||||
|
setBlacklistSort,
|
||||||
|
setPagination,
|
||||||
|
listBlacklist
|
||||||
|
)
|
||||||
|
|
||||||
|
blacklistRouter.delete('/:videoId/blacklist',
|
||||||
|
authenticate,
|
||||||
|
ensureIsAdmin,
|
||||||
|
videosBlacklistRemoveValidator,
|
||||||
|
removeVideoFromBlacklistController
|
||||||
|
)
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
@ -39,3 +63,23 @@ function addVideoToBlacklist (req: express.Request, res: express.Response, next:
|
||||||
return next(err)
|
return next(err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function listBlacklist (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||||
|
db.BlacklistedVideo.listForApi(req.query.start, req.query.count, req.query.sort)
|
||||||
|
.then(resultList => res.json(getFormattedObjects<BlacklistedVideo, BlacklistedVideoInstance>(resultList.data, resultList.total)))
|
||||||
|
.catch(err => next(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeVideoFromBlacklistController (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||||
|
const blacklistedVideo = res.locals.blacklistedVideo as BlacklistedVideoInstance
|
||||||
|
|
||||||
|
blacklistedVideo.destroy()
|
||||||
|
.then(() => {
|
||||||
|
logger.info('Video %s removed from blacklist.', res.locals.video.uuid)
|
||||||
|
res.sendStatus(204)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
logger.error('Some error while removing video %s from blacklist.', res.locals.video.uuid, err)
|
||||||
|
next(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { values } from 'lodash'
|
import { values } from 'lodash'
|
||||||
import * as validator from 'validator'
|
import * as validator from 'validator'
|
||||||
|
import * as Promise from 'bluebird'
|
||||||
|
import * as express from 'express'
|
||||||
import 'express-validator'
|
import 'express-validator'
|
||||||
import 'multer'
|
import 'multer'
|
||||||
|
|
||||||
|
@ -8,10 +10,13 @@ import {
|
||||||
VIDEO_CATEGORIES,
|
VIDEO_CATEGORIES,
|
||||||
VIDEO_LICENCES,
|
VIDEO_LICENCES,
|
||||||
VIDEO_LANGUAGES,
|
VIDEO_LANGUAGES,
|
||||||
VIDEO_RATE_TYPES
|
VIDEO_RATE_TYPES,
|
||||||
|
database as db
|
||||||
} from '../../initializers'
|
} from '../../initializers'
|
||||||
import { isUserUsernameValid } from './users'
|
import { isUserUsernameValid } from './users'
|
||||||
import { isArray, exists } from './misc'
|
import { isArray, exists } from './misc'
|
||||||
|
import { VideoInstance } from '../../models'
|
||||||
|
import { logger } from '../../helpers'
|
||||||
import { VideoRateType } from '../../../shared'
|
import { VideoRateType } from '../../../shared'
|
||||||
|
|
||||||
const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS
|
const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS
|
||||||
|
@ -138,6 +143,30 @@ function isVideoFileInfoHashValid (value: string) {
|
||||||
return exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.INFO_HASH)
|
return exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.INFO_HASH)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkVideoExists (id: string, res: express.Response, callback: () => void) {
|
||||||
|
let promise: Promise<VideoInstance>
|
||||||
|
if (validator.isInt(id)) {
|
||||||
|
promise = db.Video.loadAndPopulateAuthorAndPodAndTags(+id)
|
||||||
|
} else { // UUID
|
||||||
|
promise = db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
promise.then(video => {
|
||||||
|
if (!video) {
|
||||||
|
return res.status(404)
|
||||||
|
.json({ error: 'Video not found' })
|
||||||
|
.end()
|
||||||
|
}
|
||||||
|
|
||||||
|
res.locals.video = video
|
||||||
|
callback()
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
logger.error('Error in video request validator.', err)
|
||||||
|
return res.sendStatus(500)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
@ -166,5 +195,6 @@ export {
|
||||||
isVideoDislikesValid,
|
isVideoDislikesValid,
|
||||||
isVideoEventCountValid,
|
isVideoEventCountValid,
|
||||||
isVideoFileSizeValid,
|
isVideoFileSizeValid,
|
||||||
isVideoFileResolutionValid
|
isVideoFileResolutionValid,
|
||||||
|
checkVideoExists
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
import { logger } from '../helpers'
|
|
||||||
import { BlacklistedVideoInstance } from '../models'
|
|
||||||
|
|
||||||
function removeVideoFromBlacklist (entry: BlacklistedVideoInstance) {
|
|
||||||
return entry.destroy()
|
|
||||||
.then(() => {
|
|
||||||
logger.info('Video removed from the blacklist')
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
logger.error('Some error while removing video from the blacklist.', err)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export {
|
|
||||||
removeVideoFromBlacklist
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
|
@ -3,4 +3,3 @@ export * from './jobs'
|
||||||
export * from './request'
|
export * from './request'
|
||||||
export * from './friends'
|
export * from './friends'
|
||||||
export * from './oauth-model'
|
export * from './oauth-model'
|
||||||
export * from './blacklist'
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
import { param } from 'express-validator/check'
|
|
||||||
import * as express from 'express'
|
|
||||||
|
|
||||||
import { database as db } from '../../initializers/database'
|
|
||||||
import { checkErrors } from './utils'
|
|
||||||
import { logger } from '../../helpers'
|
|
||||||
|
|
||||||
const blacklistRemoveValidator = [
|
|
||||||
param('id').isNumeric().not().isEmpty().withMessage('Should have a valid id'),
|
|
||||||
|
|
||||||
(req: express.Request, res: express.Response, next: express.NextFunction) => {
|
|
||||||
logger.debug('Checking blacklistRemove parameters.', { parameters: req.params })
|
|
||||||
|
|
||||||
checkErrors(req, res, () => {
|
|
||||||
db.BlacklistedVideo.loadById(req.params.id)
|
|
||||||
.then(entry => {
|
|
||||||
if (!entry) return res.status(404).send('Blacklisted video not found')
|
|
||||||
|
|
||||||
res.locals.blacklistEntryToRemove = entry
|
|
||||||
|
|
||||||
next()
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
logger.error('Error in blacklistRemove request validator', { error: err })
|
|
||||||
return res.sendStatus(500)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export {
|
|
||||||
blacklistRemoveValidator
|
|
||||||
}
|
|
|
@ -4,4 +4,4 @@ export * from './pods'
|
||||||
export * from './sort'
|
export * from './sort'
|
||||||
export * from './users'
|
export * from './users'
|
||||||
export * from './videos'
|
export * from './videos'
|
||||||
export * from './blacklist'
|
export * from './video-blacklist'
|
||||||
|
|
67
server/middlewares/validators/video-blacklist.ts
Normal file
67
server/middlewares/validators/video-blacklist.ts
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
import { param } from 'express-validator/check'
|
||||||
|
import * as express from 'express'
|
||||||
|
|
||||||
|
import { database as db } from '../../initializers/database'
|
||||||
|
import { checkErrors } from './utils'
|
||||||
|
import { logger, isVideoIdOrUUIDValid, checkVideoExists } from '../../helpers'
|
||||||
|
|
||||||
|
const videosBlacklistRemoveValidator = [
|
||||||
|
param('videoId').custom(isVideoIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'),
|
||||||
|
|
||||||
|
(req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||||
|
logger.debug('Checking blacklistRemove parameters.', { parameters: req.params })
|
||||||
|
|
||||||
|
checkErrors(req, res, () => {
|
||||||
|
checkVideoExists(req.params.videoId, res, () => {
|
||||||
|
checkVideoIsBlacklisted(req, res, next)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const videosBlacklistAddValidator = [
|
||||||
|
param('videoId').custom(isVideoIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'),
|
||||||
|
|
||||||
|
(req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||||
|
logger.debug('Checking videosBlacklist parameters', { parameters: req.params })
|
||||||
|
|
||||||
|
checkErrors(req, res, () => {
|
||||||
|
checkVideoExists(req.params.videoId, res, () => {
|
||||||
|
checkVideoIsBlacklistable(req, res, next)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export {
|
||||||
|
videosBlacklistAddValidator,
|
||||||
|
videosBlacklistRemoveValidator
|
||||||
|
}
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function checkVideoIsBlacklistable (req: express.Request, res: express.Response, callback: () => void) {
|
||||||
|
if (res.locals.video.isOwned() === true) {
|
||||||
|
return res.status(403)
|
||||||
|
.json({ error: 'Cannot blacklist a local video' })
|
||||||
|
.end()
|
||||||
|
}
|
||||||
|
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkVideoIsBlacklisted (req: express.Request, res: express.Response, callback: () => void) {
|
||||||
|
db.BlacklistedVideo.loadByVideoId(res.locals.video.id)
|
||||||
|
.then(blacklistedVideo => {
|
||||||
|
if (!blacklistedVideo) return res.status(404).send('Blacklisted video not found')
|
||||||
|
|
||||||
|
res.locals.blacklistedVideo = blacklistedVideo
|
||||||
|
|
||||||
|
callback()
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
logger.error('Error in blacklistRemove request validator', { error: err })
|
||||||
|
return res.sendStatus(500)
|
||||||
|
})
|
||||||
|
}
|
|
@ -1,7 +1,5 @@
|
||||||
import { body, param, query } from 'express-validator/check'
|
import { body, param, query } from 'express-validator/check'
|
||||||
import * as express from 'express'
|
import * as express from 'express'
|
||||||
import * as Promise from 'bluebird'
|
|
||||||
import * as validator from 'validator'
|
|
||||||
|
|
||||||
import { database as db } from '../../initializers/database'
|
import { database as db } from '../../initializers/database'
|
||||||
import { checkErrors } from './utils'
|
import { checkErrors } from './utils'
|
||||||
|
@ -20,9 +18,9 @@ import {
|
||||||
isVideoIdOrUUIDValid,
|
isVideoIdOrUUIDValid,
|
||||||
isVideoAbuseReasonValid,
|
isVideoAbuseReasonValid,
|
||||||
isVideoRatingTypeValid,
|
isVideoRatingTypeValid,
|
||||||
getDurationFromVideoFile
|
getDurationFromVideoFile,
|
||||||
|
checkVideoExists
|
||||||
} from '../../helpers'
|
} from '../../helpers'
|
||||||
import { VideoInstance } from '../../models'
|
|
||||||
|
|
||||||
const videosAddValidator = [
|
const videosAddValidator = [
|
||||||
body('videofile').custom((value, { req }) => isVideoFile(req.files)).withMessage('Should have a valid file'),
|
body('videofile').custom((value, { req }) => isVideoFile(req.files)).withMessage('Should have a valid file'),
|
||||||
|
@ -186,20 +184,6 @@ const videoRateValidator = [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
const videosBlacklistValidator = [
|
|
||||||
param('id').custom(isVideoIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'),
|
|
||||||
|
|
||||||
(req: express.Request, res: express.Response, next: express.NextFunction) => {
|
|
||||||
logger.debug('Checking videosBlacklist parameters', { parameters: req.params })
|
|
||||||
|
|
||||||
checkErrors(req, res, () => {
|
|
||||||
checkVideoExists(req.params.id, res, () => {
|
|
||||||
checkVideoIsBlacklistable(req, res, next)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
@ -211,37 +195,11 @@ export {
|
||||||
|
|
||||||
videoAbuseReportValidator,
|
videoAbuseReportValidator,
|
||||||
|
|
||||||
videoRateValidator,
|
videoRateValidator
|
||||||
|
|
||||||
videosBlacklistValidator
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function checkVideoExists (id: string, res: express.Response, callback: () => void) {
|
|
||||||
let promise: Promise<VideoInstance>
|
|
||||||
if (validator.isInt(id)) {
|
|
||||||
promise = db.Video.loadAndPopulateAuthorAndPodAndTags(+id)
|
|
||||||
} else { // UUID
|
|
||||||
promise = db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(id)
|
|
||||||
}
|
|
||||||
|
|
||||||
promise.then(video => {
|
|
||||||
if (!video) {
|
|
||||||
return res.status(404)
|
|
||||||
.json({ error: 'Video not found' })
|
|
||||||
.end()
|
|
||||||
}
|
|
||||||
|
|
||||||
res.locals.video = video
|
|
||||||
callback()
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
logger.error('Error in video request validator.', err)
|
|
||||||
return res.sendStatus(500)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkUserCanDeleteVideo (userId: number, res: express.Response, callback: () => void) {
|
function checkUserCanDeleteVideo (userId: number, res: express.Response, callback: () => void) {
|
||||||
// Retrieve the user who did the request
|
// Retrieve the user who did the request
|
||||||
db.User.loadById(userId)
|
db.User.loadById(userId)
|
||||||
|
@ -269,13 +227,3 @@ function checkUserCanDeleteVideo (userId: number, res: express.Response, callbac
|
||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkVideoIsBlacklistable (req: express.Request, res: express.Response, callback: () => void) {
|
|
||||||
if (res.locals.video.isOwned() === true) {
|
|
||||||
return res.status(403)
|
|
||||||
.json({ error: 'Cannot blacklist a local video' })
|
|
||||||
.end()
|
|
||||||
}
|
|
||||||
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
|
|
|
@ -81,10 +81,10 @@ describe('Test video blacklist API validators', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('When removing a video in blacklist', function () {
|
describe('When removing a video in blacklist', function () {
|
||||||
const basePath = '/api/v1/blacklist/'
|
const basePath = '/api/v1/videos/'
|
||||||
|
|
||||||
it('Should fail with a non authenticated user', async function () {
|
it('Should fail with a non authenticated user', async function () {
|
||||||
const path = basePath + server.video.id
|
const path = basePath + server.video.id + '/blacklist'
|
||||||
|
|
||||||
await request(server.url)
|
await request(server.url)
|
||||||
.delete(path)
|
.delete(path)
|
||||||
|
@ -94,7 +94,7 @@ describe('Test video blacklist API validators', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should fail with a non admin user', async function () {
|
it('Should fail with a non admin user', async function () {
|
||||||
const path = basePath + server.video.id
|
const path = basePath + server.video.id + '/blacklist'
|
||||||
|
|
||||||
await request(server.url)
|
await request(server.url)
|
||||||
.delete(path)
|
.delete(path)
|
||||||
|
@ -104,7 +104,7 @@ describe('Test video blacklist API validators', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should fail with an incorrect id', async function () {
|
it('Should fail with an incorrect id', async function () {
|
||||||
const path = basePath + 'foobar'
|
const path = basePath + 'foobar/blacklist'
|
||||||
|
|
||||||
await request(server.url)
|
await request(server.url)
|
||||||
.delete(path)
|
.delete(path)
|
||||||
|
@ -115,7 +115,7 @@ describe('Test video blacklist API validators', function () {
|
||||||
|
|
||||||
it('Should fail with a not blacklisted video', async function () {
|
it('Should fail with a not blacklisted video', async function () {
|
||||||
// The video was not added to the blacklist so it should fail
|
// The video was not added to the blacklist so it should fail
|
||||||
const path = basePath + server.video.id
|
const path = basePath + server.video.id + '/blacklist'
|
||||||
|
|
||||||
await request(server.url)
|
await request(server.url)
|
||||||
.delete(path)
|
.delete(path)
|
||||||
|
@ -126,7 +126,7 @@ describe('Test video blacklist API validators', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('When listing videos in blacklist', function () {
|
describe('When listing videos in blacklist', function () {
|
||||||
const basePath = '/api/v1/blacklist/'
|
const basePath = '/api/v1/videos/blacklist/'
|
||||||
|
|
||||||
it('Should fail with a non authenticated user', async function () {
|
it('Should fail with a non authenticated user', async function () {
|
||||||
const path = basePath
|
const path = basePath
|
||||||
|
|
|
@ -11,7 +11,7 @@ function addVideoToBlacklist (url: string, token: string, videoId: number, speci
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeVideoFromBlacklist (url: string, token: string, videoId: number, specialStatus = 204) {
|
function removeVideoFromBlacklist (url: string, token: string, videoId: number, specialStatus = 204) {
|
||||||
const path = '/api/v1/blacklist/' + videoId
|
const path = '/api/v1/videos/' + videoId + '/blacklist'
|
||||||
|
|
||||||
return request(url)
|
return request(url)
|
||||||
.delete(path)
|
.delete(path)
|
||||||
|
@ -21,7 +21,7 @@ function removeVideoFromBlacklist (url: string, token: string, videoId: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBlacklistedVideosList (url: string, token: string, specialStatus = 200) {
|
function getBlacklistedVideosList (url: string, token: string, specialStatus = 200) {
|
||||||
const path = '/api/v1/blacklist/'
|
const path = '/api/v1/videos/blacklist/'
|
||||||
|
|
||||||
return request(url)
|
return request(url)
|
||||||
.get(path)
|
.get(path)
|
||||||
|
@ -33,7 +33,7 @@ function getBlacklistedVideosList (url: string, token: string, specialStatus = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSortedBlacklistedVideosList (url: string, token: string, sort: string, specialStatus = 200) {
|
function getSortedBlacklistedVideosList (url: string, token: string, sort: string, specialStatus = 200) {
|
||||||
const path = '/api/v1/blacklist/'
|
const path = '/api/v1/videos/blacklist/'
|
||||||
|
|
||||||
return request(url)
|
return request(url)
|
||||||
.get(path)
|
.get(path)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user