mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Remove deprecated abuse api
This commit is contained in:
@@ -85,13 +85,7 @@ abuseRouter.delete('/:id/messages/:messageId',
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
abuseRouter,
|
||||
|
||||
// FIXME: deprecated in 2.3. Remove these exports
|
||||
listAbusesForAdmins,
|
||||
updateAbuse,
|
||||
deleteAbuse,
|
||||
reportAbuse
|
||||
abuseRouter
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
import * as express from 'express'
|
||||
import { AbuseModel } from '@server/models/abuse/abuse'
|
||||
import { getServerActor } from '@server/models/application/application'
|
||||
import { AbuseCreate, UserRight, VideoAbuseCreate } from '../../../../shared'
|
||||
import {
|
||||
abusesSortValidator,
|
||||
asyncMiddleware,
|
||||
asyncRetryTransactionMiddleware,
|
||||
authenticate,
|
||||
ensureUserHasRight,
|
||||
paginationValidator,
|
||||
setDefaultPagination,
|
||||
setDefaultSort,
|
||||
videoAbuseGetValidator,
|
||||
videoAbuseListValidator,
|
||||
videoAbuseReportValidator,
|
||||
videoAbuseUpdateValidator
|
||||
} from '../../../middlewares'
|
||||
import { deleteAbuse, reportAbuse, updateAbuse } from '../abuse'
|
||||
|
||||
// FIXME: deprecated in 2.3. Remove this controller
|
||||
|
||||
const abuseVideoRouter = express.Router()
|
||||
|
||||
abuseVideoRouter.get('/abuse',
|
||||
authenticate,
|
||||
ensureUserHasRight(UserRight.MANAGE_ABUSES),
|
||||
paginationValidator,
|
||||
abusesSortValidator,
|
||||
setDefaultSort,
|
||||
setDefaultPagination,
|
||||
videoAbuseListValidator,
|
||||
asyncMiddleware(listVideoAbuses)
|
||||
)
|
||||
abuseVideoRouter.put('/:videoId/abuse/:id',
|
||||
authenticate,
|
||||
ensureUserHasRight(UserRight.MANAGE_ABUSES),
|
||||
asyncMiddleware(videoAbuseUpdateValidator),
|
||||
asyncRetryTransactionMiddleware(updateVideoAbuse)
|
||||
)
|
||||
abuseVideoRouter.post('/:videoId/abuse',
|
||||
authenticate,
|
||||
asyncMiddleware(videoAbuseReportValidator),
|
||||
asyncRetryTransactionMiddleware(reportVideoAbuse)
|
||||
)
|
||||
abuseVideoRouter.delete('/:videoId/abuse/:id',
|
||||
authenticate,
|
||||
ensureUserHasRight(UserRight.MANAGE_ABUSES),
|
||||
asyncMiddleware(videoAbuseGetValidator),
|
||||
asyncRetryTransactionMiddleware(deleteVideoAbuse)
|
||||
)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
abuseVideoRouter
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function listVideoAbuses (req: express.Request, res: express.Response) {
|
||||
const user = res.locals.oauth.token.user
|
||||
const serverActor = await getServerActor()
|
||||
|
||||
const resultList = await AbuseModel.listForAdminApi({
|
||||
start: req.query.start,
|
||||
count: req.query.count,
|
||||
sort: req.query.sort,
|
||||
id: req.query.id,
|
||||
filter: 'video',
|
||||
predefinedReason: req.query.predefinedReason,
|
||||
search: req.query.search,
|
||||
state: req.query.state,
|
||||
videoIs: req.query.videoIs,
|
||||
searchReporter: req.query.searchReporter,
|
||||
searchReportee: req.query.searchReportee,
|
||||
searchVideo: req.query.searchVideo,
|
||||
searchVideoChannel: req.query.searchVideoChannel,
|
||||
serverAccountId: serverActor.Account.id,
|
||||
user
|
||||
})
|
||||
|
||||
return res.json({
|
||||
total: resultList.total,
|
||||
data: resultList.data.map(d => d.toFormattedAdminJSON())
|
||||
})
|
||||
}
|
||||
|
||||
async function updateVideoAbuse (req: express.Request, res: express.Response) {
|
||||
return updateAbuse(req, res)
|
||||
}
|
||||
|
||||
async function deleteVideoAbuse (req: express.Request, res: express.Response) {
|
||||
return deleteAbuse(req, res)
|
||||
}
|
||||
|
||||
async function reportVideoAbuse (req: express.Request, res: express.Response) {
|
||||
const oldBody = req.body as VideoAbuseCreate
|
||||
|
||||
req.body = {
|
||||
accountId: res.locals.videoAll.VideoChannel.accountId,
|
||||
|
||||
reason: oldBody.reason,
|
||||
predefinedReasons: oldBody.predefinedReasons,
|
||||
|
||||
video: {
|
||||
id: res.locals.videoAll.id,
|
||||
startAt: oldBody.startAt,
|
||||
endAt: oldBody.endAt
|
||||
}
|
||||
} as AbuseCreate
|
||||
|
||||
return reportAbuse(req, res)
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import { addOptimizeOrMergeAudioJob } from '@server/helpers/video'
|
||||
import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
|
||||
import { changeVideoChannelShare } from '@server/lib/activitypub/share'
|
||||
import { getVideoActivityPubUrl } from '@server/lib/activitypub/url'
|
||||
import { LiveManager } from '@server/lib/live-manager'
|
||||
import { buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video'
|
||||
import { getVideoFilePath } from '@server/lib/video-paths'
|
||||
import { getServerActor } from '@server/models/application/application'
|
||||
@@ -57,7 +58,6 @@ import {
|
||||
import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'
|
||||
import { VideoModel } from '../../../models/video/video'
|
||||
import { VideoFileModel } from '../../../models/video/video-file'
|
||||
import { abuseVideoRouter } from './abuse'
|
||||
import { blacklistRouter } from './blacklist'
|
||||
import { videoCaptionsRouter } from './captions'
|
||||
import { videoCommentRouter } from './comment'
|
||||
@@ -66,7 +66,6 @@ import { liveRouter } from './live'
|
||||
import { ownershipVideoRouter } from './ownership'
|
||||
import { rateVideoRouter } from './rate'
|
||||
import { watchingRouter } from './watching'
|
||||
import { LiveManager } from '@server/lib/live-manager'
|
||||
|
||||
const auditLogger = auditLoggerFactory('videos')
|
||||
const videosRouter = express.Router()
|
||||
@@ -89,7 +88,6 @@ const reqVideoFileUpdate = createReqFiles(
|
||||
}
|
||||
)
|
||||
|
||||
videosRouter.use('/', abuseVideoRouter)
|
||||
videosRouter.use('/', blacklistRouter)
|
||||
videosRouter.use('/', rateVideoRouter)
|
||||
videosRouter.use('/', videoCommentRouter)
|
||||
|
||||
Reference in New Issue
Block a user