Cleanup express locals typings
This commit is contained in:
parent
e65c0c5b1f
commit
dae86118ed
45 changed files with 270 additions and 234 deletions
|
@ -169,27 +169,27 @@ export {
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
function accountController (req: express.Request, res: express.Response) {
|
||||
const account: AccountModel = res.locals.account
|
||||
const account = res.locals.account
|
||||
|
||||
return activityPubResponse(activityPubContextify(account.toActivityPubObject()), res)
|
||||
}
|
||||
|
||||
async function accountFollowersController (req: express.Request, res: express.Response) {
|
||||
const account: AccountModel = res.locals.account
|
||||
const account = res.locals.account
|
||||
const activityPubResult = await actorFollowers(req, account.Actor)
|
||||
|
||||
return activityPubResponse(activityPubContextify(activityPubResult), res)
|
||||
}
|
||||
|
||||
async function accountFollowingController (req: express.Request, res: express.Response) {
|
||||
const account: AccountModel = res.locals.account
|
||||
const account = res.locals.account
|
||||
const activityPubResult = await actorFollowing(req, account.Actor)
|
||||
|
||||
return activityPubResponse(activityPubContextify(activityPubResult), res)
|
||||
}
|
||||
|
||||
async function accountPlaylistsController (req: express.Request, res: express.Response) {
|
||||
const account: AccountModel = res.locals.account
|
||||
const account = res.locals.account
|
||||
const activityPubResult = await actorPlaylists(req, account)
|
||||
|
||||
return activityPubResponse(activityPubContextify(activityPubResult), res)
|
||||
|
@ -197,7 +197,7 @@ async function accountPlaylistsController (req: express.Request, res: express.Re
|
|||
|
||||
function getAccountVideoRate (rateType: VideoRateType) {
|
||||
return (req: express.Request, res: express.Response) => {
|
||||
const accountVideoRate: AccountVideoRateModel = res.locals.accountVideoRate
|
||||
const accountVideoRate = res.locals.accountVideoRate
|
||||
|
||||
const byActor = accountVideoRate.Account.Actor
|
||||
const url = getRateUrl(rateType, byActor, accountVideoRate.Video)
|
||||
|
@ -211,7 +211,7 @@ function getAccountVideoRate (rateType: VideoRateType) {
|
|||
|
||||
async function videoController (req: express.Request, res: express.Response) {
|
||||
// We need more attributes
|
||||
const video: VideoModel = await VideoModel.loadForGetAPI(res.locals.video.id)
|
||||
const video = await VideoModel.loadForGetAPI(res.locals.video.id)
|
||||
|
||||
if (video.url.startsWith(CONFIG.WEBSERVER.URL) === false) return res.redirect(video.url)
|
||||
|
||||
|
@ -230,7 +230,7 @@ async function videoController (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function videoAnnounceController (req: express.Request, res: express.Response) {
|
||||
const share = res.locals.videoShare as VideoShareModel
|
||||
const share = res.locals.videoShare
|
||||
|
||||
if (share.url.startsWith(CONFIG.WEBSERVER.URL) === false) return res.redirect(share.url)
|
||||
|
||||
|
@ -240,7 +240,7 @@ async function videoAnnounceController (req: express.Request, res: express.Respo
|
|||
}
|
||||
|
||||
async function videoAnnouncesController (req: express.Request, res: express.Response) {
|
||||
const video: VideoModel = res.locals.video
|
||||
const video = res.locals.video
|
||||
|
||||
const handler = async (start: number, count: number) => {
|
||||
const result = await VideoShareModel.listAndCountByVideoId(video.id, start, count)
|
||||
|
@ -255,21 +255,21 @@ async function videoAnnouncesController (req: express.Request, res: express.Resp
|
|||
}
|
||||
|
||||
async function videoLikesController (req: express.Request, res: express.Response) {
|
||||
const video: VideoModel = res.locals.video
|
||||
const video = res.locals.video
|
||||
const json = await videoRates(req, 'like', video, getVideoLikesActivityPubUrl(video))
|
||||
|
||||
return activityPubResponse(activityPubContextify(json), res)
|
||||
}
|
||||
|
||||
async function videoDislikesController (req: express.Request, res: express.Response) {
|
||||
const video: VideoModel = res.locals.video
|
||||
const video = res.locals.video
|
||||
const json = await videoRates(req, 'dislike', video, getVideoDislikesActivityPubUrl(video))
|
||||
|
||||
return activityPubResponse(activityPubContextify(json), res)
|
||||
}
|
||||
|
||||
async function videoCommentsController (req: express.Request, res: express.Response) {
|
||||
const video: VideoModel = res.locals.video
|
||||
const video = res.locals.video
|
||||
|
||||
const handler = async (start: number, count: number) => {
|
||||
const result = await VideoCommentModel.listAndCountByVideoId(video.id, start, count)
|
||||
|
@ -284,27 +284,27 @@ async function videoCommentsController (req: express.Request, res: express.Respo
|
|||
}
|
||||
|
||||
async function videoChannelController (req: express.Request, res: express.Response) {
|
||||
const videoChannel: VideoChannelModel = res.locals.videoChannel
|
||||
const videoChannel = res.locals.videoChannel
|
||||
|
||||
return activityPubResponse(activityPubContextify(videoChannel.toActivityPubObject()), res)
|
||||
}
|
||||
|
||||
async function videoChannelFollowersController (req: express.Request, res: express.Response) {
|
||||
const videoChannel: VideoChannelModel = res.locals.videoChannel
|
||||
const videoChannel = res.locals.videoChannel
|
||||
const activityPubResult = await actorFollowers(req, videoChannel.Actor)
|
||||
|
||||
return activityPubResponse(activityPubContextify(activityPubResult), res)
|
||||
}
|
||||
|
||||
async function videoChannelFollowingController (req: express.Request, res: express.Response) {
|
||||
const videoChannel: VideoChannelModel = res.locals.videoChannel
|
||||
const videoChannel = res.locals.videoChannel
|
||||
const activityPubResult = await actorFollowing(req, videoChannel.Actor)
|
||||
|
||||
return activityPubResponse(activityPubContextify(activityPubResult), res)
|
||||
}
|
||||
|
||||
async function videoCommentController (req: express.Request, res: express.Response) {
|
||||
const videoComment: VideoCommentModel = res.locals.videoComment
|
||||
const videoComment = res.locals.videoComment
|
||||
|
||||
if (videoComment.url.startsWith(CONFIG.WEBSERVER.URL) === false) return res.redirect(videoComment.url)
|
||||
|
||||
|
@ -323,7 +323,7 @@ async function videoCommentController (req: express.Request, res: express.Respon
|
|||
}
|
||||
|
||||
async function videoRedundancyController (req: express.Request, res: express.Response) {
|
||||
const videoRedundancy: VideoRedundancyModel = res.locals.videoRedundancy
|
||||
const videoRedundancy = res.locals.videoRedundancy
|
||||
if (videoRedundancy.url.startsWith(CONFIG.WEBSERVER.URL) === false) return res.redirect(videoRedundancy.url)
|
||||
|
||||
const serverActor = await getServerActor()
|
||||
|
@ -340,7 +340,7 @@ async function videoRedundancyController (req: express.Request, res: express.Res
|
|||
}
|
||||
|
||||
async function videoPlaylistController (req: express.Request, res: express.Response) {
|
||||
const playlist: VideoPlaylistModel = res.locals.videoPlaylist
|
||||
const playlist = res.locals.videoPlaylist
|
||||
|
||||
// We need more attributes
|
||||
playlist.OwnerAccount = await AccountModel.load(playlist.ownerAccountId)
|
||||
|
@ -353,7 +353,7 @@ async function videoPlaylistController (req: express.Request, res: express.Respo
|
|||
}
|
||||
|
||||
async function videoPlaylistElementController (req: express.Request, res: express.Response) {
|
||||
const videoPlaylistElement: VideoPlaylistElementModel = res.locals.videoPlaylistElement
|
||||
const videoPlaylistElement = res.locals.videoPlaylistElement
|
||||
|
||||
const json = videoPlaylistElement.toActivityPubObject()
|
||||
return activityPubResponse(activityPubContextify(json), res)
|
||||
|
|
|
@ -5,8 +5,6 @@ import { logger } from '../../helpers/logger'
|
|||
import { processActivities } from '../../lib/activitypub/process/process'
|
||||
import { asyncMiddleware, checkSignature, localAccountValidator, localVideoChannelValidator, signatureValidator } from '../../middlewares'
|
||||
import { activityPubValidator } from '../../middlewares/validators/activitypub/activity'
|
||||
import { VideoChannelModel } from '../../models/video/video-channel'
|
||||
import { AccountModel } from '../../models/account/account'
|
||||
import { queue } from 'async'
|
||||
import { ActorModel } from '../../models/activitypub/actor'
|
||||
|
||||
|
@ -66,12 +64,7 @@ function inboxController (req: express.Request, res: express.Response) {
|
|||
activities = activities.filter(a => isActivityValid(a))
|
||||
logger.debug('We keep %d activities.', activities.length, { activities })
|
||||
|
||||
let accountOrChannel: VideoChannelModel | AccountModel
|
||||
if (res.locals.account) {
|
||||
accountOrChannel = res.locals.account
|
||||
} else if (res.locals.videoChannel) {
|
||||
accountOrChannel = res.locals.videoChannel
|
||||
}
|
||||
const accountOrChannel = res.locals.account || res.locals.videoChannel
|
||||
|
||||
logger.info('Receiving inbox requests for %d activities by %s.', activities.length, res.locals.signature.actor.url)
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ export {
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function outboxController (req: express.Request, res: express.Response) {
|
||||
const accountOrVideoChannel: AccountModel | VideoChannelModel = res.locals.account || res.locals.videoChannel
|
||||
const accountOrVideoChannel = res.locals.account || res.locals.videoChannel
|
||||
const actor = accountOrVideoChannel.Actor
|
||||
const actorOutboxUrl = actor.url + '/outbox'
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import { VideoChannelModel } from '../../models/video/video-channel'
|
|||
import { JobQueue } from '../../lib/job-queue'
|
||||
import { logger } from '../../helpers/logger'
|
||||
import { VideoPlaylistModel } from '../../models/video/video-playlist'
|
||||
import { UserModel } from '../../models/account/user'
|
||||
import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists'
|
||||
|
||||
const accountsRouter = express.Router()
|
||||
|
@ -71,7 +70,7 @@ export {
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
function getAccount (req: express.Request, res: express.Response) {
|
||||
const account: AccountModel = res.locals.account
|
||||
const account = res.locals.account
|
||||
|
||||
if (account.isOutdated()) {
|
||||
JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'actor', url: account.Actor.url } })
|
||||
|
@ -98,7 +97,7 @@ async function listAccountPlaylists (req: express.Request, res: express.Response
|
|||
|
||||
// Allow users to see their private/unlisted video playlists
|
||||
let privateAndUnlisted = false
|
||||
if (res.locals.oauth && (res.locals.oauth.token.User as UserModel).Account.id === res.locals.account.id) {
|
||||
if (res.locals.oauth && res.locals.oauth.token.User.Account.id === res.locals.account.id) {
|
||||
privateAndUnlisted = true
|
||||
}
|
||||
|
||||
|
@ -116,7 +115,7 @@ async function listAccountPlaylists (req: express.Request, res: express.Response
|
|||
}
|
||||
|
||||
async function listAccountVideos (req: express.Request, res: express.Response) {
|
||||
const account: AccountModel = res.locals.account
|
||||
const account = res.locals.account
|
||||
const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined
|
||||
|
||||
const resultList = await VideoModel.listForApi({
|
||||
|
|
|
@ -41,6 +41,6 @@ export { apiRouter }
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function pong (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
function pong (req: express.Request, res: express.Response) {
|
||||
return res.send('pong').status(200).end()
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function listFollowing (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
async function listFollowing (req: express.Request, res: express.Response) {
|
||||
const serverActor = await getServerActor()
|
||||
const resultList = await ActorFollowModel.listFollowingForApi(
|
||||
serverActor.id,
|
||||
|
@ -72,7 +72,7 @@ async function listFollowing (req: express.Request, res: express.Response, next:
|
|||
return res.json(getFormattedObjects(resultList.data, resultList.total))
|
||||
}
|
||||
|
||||
async function listFollowers (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
async function listFollowers (req: express.Request, res: express.Response) {
|
||||
const serverActor = await getServerActor()
|
||||
const resultList = await ActorFollowModel.listFollowersForApi(
|
||||
serverActor.id,
|
||||
|
@ -85,7 +85,7 @@ async function listFollowers (req: express.Request, res: express.Response, next:
|
|||
return res.json(getFormattedObjects(resultList.data, resultList.total))
|
||||
}
|
||||
|
||||
async function followInstance (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
async function followInstance (req: express.Request, res: express.Response) {
|
||||
const hosts = req.body.hosts as string[]
|
||||
const follower = await getServerActor()
|
||||
|
||||
|
@ -103,8 +103,8 @@ async function followInstance (req: express.Request, res: express.Response, next
|
|||
return res.status(204).end()
|
||||
}
|
||||
|
||||
async function removeFollow (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const follow: ActorFollowModel = res.locals.follow
|
||||
async function removeFollow (req: express.Request, res: express.Response) {
|
||||
const follow = res.locals.follow
|
||||
|
||||
await sequelizeTypescript.transaction(async t => {
|
||||
if (follow.state === 'accepted') await sendUndoFollow(follow, t)
|
||||
|
|
|
@ -2,7 +2,6 @@ import * as express from 'express'
|
|||
import { UserRight } from '../../../../shared/models/users'
|
||||
import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares'
|
||||
import { updateServerRedundancyValidator } from '../../../middlewares/validators/redundancy'
|
||||
import { ServerModel } from '../../../models/server/server'
|
||||
import { removeRedundancyOf } from '../../../lib/redundancy'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
|
||||
|
@ -23,8 +22,8 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function updateRedundancy (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const server = res.locals.server as ServerModel
|
||||
async function updateRedundancy (req: express.Request, res: express.Response) {
|
||||
const server = res.locals.server
|
||||
|
||||
server.redundancyAllowed = req.body.redundancyAllowed
|
||||
|
||||
|
|
|
@ -18,11 +18,9 @@ import {
|
|||
unblockAccountByServerValidator,
|
||||
unblockServerByServerValidator
|
||||
} from '../../../middlewares/validators'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
|
||||
import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'
|
||||
import { ServerBlocklistModel } from '../../../models/server/server-blocklist'
|
||||
import { ServerModel } from '../../../models/server/server'
|
||||
import { UserRight } from '../../../../shared/models/users'
|
||||
|
||||
const serverBlocklistRouter = express.Router()
|
||||
|
@ -91,7 +89,7 @@ async function listBlockedAccounts (req: express.Request, res: express.Response)
|
|||
|
||||
async function blockAccount (req: express.Request, res: express.Response) {
|
||||
const serverActor = await getServerActor()
|
||||
const accountToBlock: AccountModel = res.locals.account
|
||||
const accountToBlock = res.locals.account
|
||||
|
||||
await addAccountInBlocklist(serverActor.Account.id, accountToBlock.id)
|
||||
|
||||
|
@ -99,7 +97,7 @@ async function blockAccount (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function unblockAccount (req: express.Request, res: express.Response) {
|
||||
const accountBlock: AccountBlocklistModel = res.locals.accountBlock
|
||||
const accountBlock = res.locals.accountBlock
|
||||
|
||||
await removeAccountFromBlocklist(accountBlock)
|
||||
|
||||
|
@ -116,7 +114,7 @@ async function listBlockedServers (req: express.Request, res: express.Response)
|
|||
|
||||
async function blockServer (req: express.Request, res: express.Response) {
|
||||
const serverActor = await getServerActor()
|
||||
const serverToBlock: ServerModel = res.locals.server
|
||||
const serverToBlock = res.locals.server
|
||||
|
||||
await addServerInBlocklist(serverActor.Account.id, serverToBlock.id)
|
||||
|
||||
|
@ -124,7 +122,7 @@ async function blockServer (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function unblockServer (req: express.Request, res: express.Response) {
|
||||
const serverBlock: ServerBlocklistModel = res.locals.serverBlock
|
||||
const serverBlock = res.locals.serverBlock
|
||||
|
||||
await removeServerFromBlocklist(serverBlock)
|
||||
|
||||
|
|
|
@ -221,8 +221,8 @@ async function registerUser (req: express.Request, res: express.Response) {
|
|||
return res.type('json').status(204).end()
|
||||
}
|
||||
|
||||
async function unblockUser (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const user: UserModel = res.locals.user
|
||||
async function unblockUser (req: express.Request, res: express.Response) {
|
||||
const user = res.locals.user
|
||||
|
||||
await changeUserBlock(res, user, false)
|
||||
|
||||
|
@ -230,7 +230,7 @@ async function unblockUser (req: express.Request, res: express.Response, next: e
|
|||
}
|
||||
|
||||
async function blockUser (req: express.Request, res: express.Response) {
|
||||
const user: UserModel = res.locals.user
|
||||
const user = res.locals.user
|
||||
const reason = req.body.reason
|
||||
|
||||
await changeUserBlock(res, user, true, reason)
|
||||
|
@ -239,7 +239,7 @@ async function blockUser (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
function getUser (req: express.Request, res: express.Response) {
|
||||
return res.json((res.locals.user as UserModel).toFormattedJSON())
|
||||
return res.json(res.locals.user.toFormattedJSON())
|
||||
}
|
||||
|
||||
async function autocompleteUsers (req: express.Request, res: express.Response) {
|
||||
|
@ -255,7 +255,7 @@ async function listUsers (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function removeUser (req: express.Request, res: express.Response) {
|
||||
const user: UserModel = res.locals.user
|
||||
const user = res.locals.user
|
||||
|
||||
await user.destroy()
|
||||
|
||||
|
@ -266,7 +266,7 @@ async function removeUser (req: express.Request, res: express.Response) {
|
|||
|
||||
async function updateUser (req: express.Request, res: express.Response) {
|
||||
const body: UserUpdate = req.body
|
||||
const userToUpdate = res.locals.user as UserModel
|
||||
const userToUpdate = res.locals.user
|
||||
const oldUserAuditView = new UserAuditView(userToUpdate.toFormattedJSON())
|
||||
const roleChanged = body.role !== undefined && body.role !== userToUpdate.role
|
||||
|
||||
|
@ -289,8 +289,8 @@ async function updateUser (req: express.Request, res: express.Response) {
|
|||
return res.sendStatus(204)
|
||||
}
|
||||
|
||||
async function askResetUserPassword (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const user = res.locals.user as UserModel
|
||||
async function askResetUserPassword (req: express.Request, res: express.Response) {
|
||||
const user = res.locals.user
|
||||
|
||||
const verificationString = await Redis.Instance.setResetPasswordVerificationString(user.id)
|
||||
const url = CONFIG.WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString
|
||||
|
@ -299,8 +299,8 @@ async function askResetUserPassword (req: express.Request, res: express.Response
|
|||
return res.status(204).end()
|
||||
}
|
||||
|
||||
async function resetUserPassword (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const user = res.locals.user as UserModel
|
||||
async function resetUserPassword (req: express.Request, res: express.Response) {
|
||||
const user = res.locals.user
|
||||
user.password = req.body.password
|
||||
|
||||
await user.save()
|
||||
|
@ -315,16 +315,16 @@ async function sendVerifyUserEmail (user: UserModel) {
|
|||
return
|
||||
}
|
||||
|
||||
async function askSendVerifyUserEmail (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const user = res.locals.user as UserModel
|
||||
async function askSendVerifyUserEmail (req: express.Request, res: express.Response) {
|
||||
const user = res.locals.user
|
||||
|
||||
await sendVerifyUserEmail(user)
|
||||
|
||||
return res.status(204).end()
|
||||
}
|
||||
|
||||
async function verifyUserEmail (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const user = res.locals.user as UserModel
|
||||
async function verifyUserEmail (req: express.Request, res: express.Response) {
|
||||
const user = res.locals.user
|
||||
user.emailVerified = true
|
||||
|
||||
await user.save()
|
||||
|
@ -332,7 +332,7 @@ async function verifyUserEmail (req: express.Request, res: express.Response, nex
|
|||
return res.status(204).end()
|
||||
}
|
||||
|
||||
function success (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
function success (req: express.Request, res: express.Response) {
|
||||
res.end()
|
||||
}
|
||||
|
||||
|
|
|
@ -93,8 +93,8 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function getUserVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const user = res.locals.oauth.token.User as UserModel
|
||||
async function getUserVideos (req: express.Request, res: express.Response) {
|
||||
const user = res.locals.oauth.token.User
|
||||
const resultList = await VideoModel.listUserVideosForApi(
|
||||
user.Account.id,
|
||||
req.query.start as number,
|
||||
|
@ -111,8 +111,8 @@ async function getUserVideos (req: express.Request, res: express.Response, next:
|
|||
return res.json(getFormattedObjects(resultList.data, resultList.total, { additionalAttributes }))
|
||||
}
|
||||
|
||||
async function getUserVideoImports (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const user = res.locals.oauth.token.User as UserModel
|
||||
async function getUserVideoImports (req: express.Request, res: express.Response) {
|
||||
const user = res.locals.oauth.token.User
|
||||
const resultList = await VideoImportModel.listUserVideoImportsForApi(
|
||||
user.id,
|
||||
req.query.start as number,
|
||||
|
@ -123,14 +123,14 @@ async function getUserVideoImports (req: express.Request, res: express.Response,
|
|||
return res.json(getFormattedObjects(resultList.data, resultList.total))
|
||||
}
|
||||
|
||||
async function getUserInformation (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
async function getUserInformation (req: express.Request, res: express.Response) {
|
||||
// We did not load channels in res.locals.user
|
||||
const user = await UserModel.loadByUsernameAndPopulateChannels(res.locals.oauth.token.user.username)
|
||||
|
||||
return res.json(user.toFormattedJSON())
|
||||
}
|
||||
|
||||
async function getUserVideoQuotaUsed (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
async function getUserVideoQuotaUsed (req: express.Request, res: express.Response) {
|
||||
// We did not load channels in res.locals.user
|
||||
const user = await UserModel.loadByUsernameAndPopulateChannels(res.locals.oauth.token.user.username)
|
||||
const videoQuotaUsed = await UserModel.getOriginalVideoFileTotalFromUser(user)
|
||||
|
@ -143,7 +143,7 @@ async function getUserVideoQuotaUsed (req: express.Request, res: express.Respons
|
|||
return res.json(data)
|
||||
}
|
||||
|
||||
async function getUserVideoRating (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
async function getUserVideoRating (req: express.Request, res: express.Response) {
|
||||
const videoId = res.locals.video.id
|
||||
const accountId = +res.locals.oauth.token.User.Account.id
|
||||
|
||||
|
@ -158,7 +158,7 @@ async function getUserVideoRating (req: express.Request, res: express.Response,
|
|||
}
|
||||
|
||||
async function deleteMe (req: express.Request, res: express.Response) {
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const user = res.locals.oauth.token.User
|
||||
|
||||
await user.destroy()
|
||||
|
||||
|
@ -170,7 +170,7 @@ async function deleteMe (req: express.Request, res: express.Response) {
|
|||
async function updateMe (req: express.Request, res: express.Response) {
|
||||
const body: UserUpdateMe = req.body
|
||||
|
||||
const user: UserModel = res.locals.oauth.token.user
|
||||
const user = res.locals.oauth.token.user
|
||||
const oldUserAuditView = new UserAuditView(user.toFormattedJSON())
|
||||
|
||||
if (body.password !== undefined) user.password = body.password
|
||||
|
@ -199,7 +199,7 @@ async function updateMe (req: express.Request, res: express.Response) {
|
|||
|
||||
async function updateMyAvatar (req: express.Request, res: express.Response) {
|
||||
const avatarPhysicalFile = req.files[ 'avatarfile' ][ 0 ]
|
||||
const user: UserModel = res.locals.oauth.token.user
|
||||
const user = res.locals.oauth.token.user
|
||||
const oldUserAuditView = new UserAuditView(user.toFormattedJSON())
|
||||
|
||||
const userAccount = await AccountModel.load(user.Account.id)
|
||||
|
|
|
@ -17,7 +17,6 @@ import {
|
|||
serversBlocklistSortValidator,
|
||||
unblockServerByAccountValidator
|
||||
} from '../../../middlewares/validators'
|
||||
import { UserModel } from '../../../models/account/user'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
|
||||
import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'
|
||||
|
@ -75,7 +74,7 @@ export {
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function listBlockedAccounts (req: express.Request, res: express.Response) {
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const user = res.locals.oauth.token.User
|
||||
|
||||
const resultList = await AccountBlocklistModel.listForApi(user.Account.id, req.query.start, req.query.count, req.query.sort)
|
||||
|
||||
|
@ -83,8 +82,8 @@ async function listBlockedAccounts (req: express.Request, res: express.Response)
|
|||
}
|
||||
|
||||
async function blockAccount (req: express.Request, res: express.Response) {
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const accountToBlock: AccountModel = res.locals.account
|
||||
const user = res.locals.oauth.token.User
|
||||
const accountToBlock = res.locals.account
|
||||
|
||||
await addAccountInBlocklist(user.Account.id, accountToBlock.id)
|
||||
|
||||
|
@ -92,7 +91,7 @@ async function blockAccount (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function unblockAccount (req: express.Request, res: express.Response) {
|
||||
const accountBlock: AccountBlocklistModel = res.locals.accountBlock
|
||||
const accountBlock = res.locals.accountBlock
|
||||
|
||||
await removeAccountFromBlocklist(accountBlock)
|
||||
|
||||
|
@ -100,7 +99,7 @@ async function unblockAccount (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function listBlockedServers (req: express.Request, res: express.Response) {
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const user = res.locals.oauth.token.User
|
||||
|
||||
const resultList = await ServerBlocklistModel.listForApi(user.Account.id, req.query.start, req.query.count, req.query.sort)
|
||||
|
||||
|
@ -108,8 +107,8 @@ async function listBlockedServers (req: express.Request, res: express.Response)
|
|||
}
|
||||
|
||||
async function blockServer (req: express.Request, res: express.Response) {
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const serverToBlock: ServerModel = res.locals.server
|
||||
const user = res.locals.oauth.token.User
|
||||
const serverToBlock = res.locals.server
|
||||
|
||||
await addServerInBlocklist(user.Account.id, serverToBlock.id)
|
||||
|
||||
|
@ -117,7 +116,7 @@ async function blockServer (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function unblockServer (req: express.Request, res: express.Response) {
|
||||
const serverBlock: ServerBlocklistModel = res.locals.serverBlock
|
||||
const serverBlock = res.locals.serverBlock
|
||||
|
||||
await removeServerFromBlocklist(serverBlock)
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ export {
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function listMyVideosHistory (req: express.Request, res: express.Response) {
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const user = res.locals.oauth.token.User
|
||||
|
||||
const resultList = await UserVideoHistoryModel.listForApi(user, req.query.start, req.query.count)
|
||||
|
||||
|
@ -44,7 +44,7 @@ async function listMyVideosHistory (req: express.Request, res: express.Response)
|
|||
}
|
||||
|
||||
async function removeUserHistory (req: express.Request, res: express.Response) {
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const user = res.locals.oauth.token.User
|
||||
const beforeDate = req.body.beforeDate || null
|
||||
|
||||
await sequelizeTypescript.transaction(t => {
|
||||
|
|
|
@ -9,7 +9,6 @@ import {
|
|||
setDefaultSort,
|
||||
userNotificationsSortValidator
|
||||
} from '../../../middlewares'
|
||||
import { UserModel } from '../../../models/account/user'
|
||||
import { getFormattedObjects } from '../../../helpers/utils'
|
||||
import { UserNotificationModel } from '../../../models/account/user-notification'
|
||||
import { meRouter } from './me'
|
||||
|
@ -57,8 +56,8 @@ export {
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function updateNotificationSettings (req: express.Request, res: express.Response) {
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const body = req.body
|
||||
const user = res.locals.oauth.token.User
|
||||
const body = req.body as UserNotificationSetting
|
||||
|
||||
const query = {
|
||||
where: {
|
||||
|
@ -84,7 +83,7 @@ async function updateNotificationSettings (req: express.Request, res: express.Re
|
|||
}
|
||||
|
||||
async function listUserNotifications (req: express.Request, res: express.Response) {
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const user = res.locals.oauth.token.User
|
||||
|
||||
const resultList = await UserNotificationModel.listForApi(user.id, req.query.start, req.query.count, req.query.sort, req.query.unread)
|
||||
|
||||
|
@ -92,7 +91,7 @@ async function listUserNotifications (req: express.Request, res: express.Respons
|
|||
}
|
||||
|
||||
async function markAsReadUserNotifications (req: express.Request, res: express.Response) {
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const user = res.locals.oauth.token.User
|
||||
|
||||
await UserNotificationModel.markAsRead(user.id, req.body.ids)
|
||||
|
||||
|
@ -100,7 +99,7 @@ async function markAsReadUserNotifications (req: express.Request, res: express.R
|
|||
}
|
||||
|
||||
async function markAsReadAllUserNotifications (req: express.Request, res: express.Response) {
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const user = res.locals.oauth.token.User
|
||||
|
||||
await UserNotificationModel.markAllAsRead(user.id)
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import {
|
|||
userSubscriptionGetValidator
|
||||
} from '../../../middlewares'
|
||||
import { areSubscriptionsExistValidator, userSubscriptionsSortValidator, videosSortValidator } from '../../../middlewares/validators'
|
||||
import { UserModel } from '../../../models/account/user'
|
||||
import { VideoModel } from '../../../models/video/video'
|
||||
import { buildNSFWFilter } from '../../../helpers/express-utils'
|
||||
import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
|
||||
|
@ -77,7 +76,7 @@ export {
|
|||
|
||||
async function areSubscriptionsExist (req: express.Request, res: express.Response) {
|
||||
const uris = req.query.uris as string[]
|
||||
const user = res.locals.oauth.token.User as UserModel
|
||||
const user = res.locals.oauth.token.User
|
||||
|
||||
const handles = uris.map(u => {
|
||||
let [ name, host ] = u.split('@')
|
||||
|
@ -107,7 +106,7 @@ async function areSubscriptionsExist (req: express.Request, res: express.Respons
|
|||
}
|
||||
|
||||
async function addUserSubscription (req: express.Request, res: express.Response) {
|
||||
const user = res.locals.oauth.token.User as UserModel
|
||||
const user = res.locals.oauth.token.User
|
||||
const [ name, host ] = req.body.uri.split('@')
|
||||
|
||||
const payload = {
|
||||
|
@ -123,13 +122,13 @@ async function addUserSubscription (req: express.Request, res: express.Response)
|
|||
}
|
||||
|
||||
function getUserSubscription (req: express.Request, res: express.Response) {
|
||||
const subscription: ActorFollowModel = res.locals.subscription
|
||||
const subscription = res.locals.subscription
|
||||
|
||||
return res.json(subscription.ActorFollowing.VideoChannel.toFormattedJSON())
|
||||
}
|
||||
|
||||
async function deleteUserSubscription (req: express.Request, res: express.Response) {
|
||||
const subscription: ActorFollowModel = res.locals.subscription
|
||||
const subscription = res.locals.subscription
|
||||
|
||||
await sequelizeTypescript.transaction(async t => {
|
||||
return subscription.destroy({ transaction: t })
|
||||
|
@ -139,7 +138,7 @@ async function deleteUserSubscription (req: express.Request, res: express.Respon
|
|||
}
|
||||
|
||||
async function getUserSubscriptions (req: express.Request, res: express.Response) {
|
||||
const user = res.locals.oauth.token.User as UserModel
|
||||
const user = res.locals.oauth.token.User
|
||||
const actorId = user.Account.Actor.id
|
||||
|
||||
const resultList = await ActorFollowModel.listSubscriptionsForApi(actorId, req.query.start, req.query.count, req.query.sort)
|
||||
|
@ -147,8 +146,8 @@ async function getUserSubscriptions (req: express.Request, res: express.Response
|
|||
return res.json(getFormattedObjects(resultList.data, resultList.total))
|
||||
}
|
||||
|
||||
async function getUserSubscriptionVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const user = res.locals.oauth.token.User as UserModel
|
||||
async function getUserSubscriptionVideos (req: express.Request, res: express.Response) {
|
||||
const user = res.locals.oauth.token.User
|
||||
const resultList = await VideoModel.listForApi({
|
||||
start: req.query.start,
|
||||
count: req.query.count,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import * as express from 'express'
|
||||
import { asyncMiddleware, authenticate } from '../../../middlewares'
|
||||
import { UserModel } from '../../../models/account/user'
|
||||
import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists'
|
||||
import { VideoPlaylistModel } from '../../../models/video/video-playlist'
|
||||
import { VideoExistInPlaylist } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
|
||||
|
@ -23,7 +22,7 @@ export {
|
|||
|
||||
async function doVideosInPlaylistExist (req: express.Request, res: express.Response) {
|
||||
const videoIds = req.query.videoIds.map(i => parseInt(i + '', 10))
|
||||
const user = res.locals.oauth.token.User as UserModel
|
||||
const user = res.locals.oauth.token.User
|
||||
|
||||
const results = await VideoPlaylistModel.listPlaylistIdsOf(user.Account.id, videoIds)
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ import { updateAvatarValidator } from '../../middlewares/validators/avatar'
|
|||
import { updateActorAvatarFile } from '../../lib/avatar'
|
||||
import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger'
|
||||
import { resetSequelizeInstance } from '../../helpers/database-utils'
|
||||
import { UserModel } from '../../models/account/user'
|
||||
import { JobQueue } from '../../lib/job-queue'
|
||||
import { VideoPlaylistModel } from '../../models/video/video-playlist'
|
||||
import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists'
|
||||
|
@ -109,16 +108,16 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function listVideoChannels (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
async function listVideoChannels (req: express.Request, res: express.Response) {
|
||||
const serverActor = await getServerActor()
|
||||
const resultList = await VideoChannelModel.listForApi(serverActor.id, req.query.start, req.query.count, req.query.sort)
|
||||
|
||||
return res.json(getFormattedObjects(resultList.data, resultList.total))
|
||||
}
|
||||
|
||||
async function updateVideoChannelAvatar (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
async function updateVideoChannelAvatar (req: express.Request, res: express.Response) {
|
||||
const avatarPhysicalFile = req.files[ 'avatarfile' ][ 0 ]
|
||||
const videoChannel = res.locals.videoChannel as VideoChannelModel
|
||||
const videoChannel = res.locals.videoChannel
|
||||
const oldVideoChannelAuditKeys = new VideoChannelAuditView(videoChannel.toFormattedJSON())
|
||||
|
||||
const avatar = await updateActorAvatarFile(avatarPhysicalFile, videoChannel)
|
||||
|
@ -136,7 +135,7 @@ async function addVideoChannel (req: express.Request, res: express.Response) {
|
|||
const videoChannelInfo: VideoChannelCreate = req.body
|
||||
|
||||
const videoChannelCreated: VideoChannelModel = await sequelizeTypescript.transaction(async t => {
|
||||
const account = await AccountModel.load((res.locals.oauth.token.User as UserModel).Account.id, t)
|
||||
const account = await AccountModel.load(res.locals.oauth.token.User.Account.id, t)
|
||||
|
||||
return createVideoChannel(videoChannelInfo, account, t)
|
||||
})
|
||||
|
@ -156,7 +155,7 @@ async function addVideoChannel (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function updateVideoChannel (req: express.Request, res: express.Response) {
|
||||
const videoChannelInstance = res.locals.videoChannel as VideoChannelModel
|
||||
const videoChannelInstance = res.locals.videoChannel
|
||||
const videoChannelFieldsSave = videoChannelInstance.toJSON()
|
||||
const oldVideoChannelAuditKeys = new VideoChannelAuditView(videoChannelInstance.toFormattedJSON())
|
||||
const videoChannelInfoToUpdate = req.body as VideoChannelUpdate
|
||||
|
@ -196,7 +195,7 @@ async function updateVideoChannel (req: express.Request, res: express.Response)
|
|||
}
|
||||
|
||||
async function removeVideoChannel (req: express.Request, res: express.Response) {
|
||||
const videoChannelInstance: VideoChannelModel = res.locals.videoChannel
|
||||
const videoChannelInstance = res.locals.videoChannel
|
||||
|
||||
await sequelizeTypescript.transaction(async t => {
|
||||
await VideoPlaylistModel.resetPlaylistsOfChannel(videoChannelInstance.id, t)
|
||||
|
@ -210,7 +209,7 @@ async function removeVideoChannel (req: express.Request, res: express.Response)
|
|||
return res.type('json').status(204).end()
|
||||
}
|
||||
|
||||
async function getVideoChannel (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
async function getVideoChannel (req: express.Request, res: express.Response) {
|
||||
const videoChannelWithVideos = await VideoChannelModel.loadAndPopulateAccountAndVideos(res.locals.videoChannel.id)
|
||||
|
||||
if (videoChannelWithVideos.isOutdated()) {
|
||||
|
@ -236,8 +235,8 @@ async function listVideoChannelPlaylists (req: express.Request, res: express.Res
|
|||
return res.json(getFormattedObjects(resultList.data, resultList.total))
|
||||
}
|
||||
|
||||
async function listVideoChannelVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const videoChannelInstance: VideoChannelModel = res.locals.videoChannel
|
||||
async function listVideoChannelVideos (req: express.Request, res: express.Response) {
|
||||
const videoChannelInstance = res.locals.videoChannel
|
||||
const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined
|
||||
|
||||
const resultList = await VideoModel.listForApi({
|
||||
|
|
|
@ -10,7 +10,6 @@ import {
|
|||
setDefaultPagination,
|
||||
setDefaultSort
|
||||
} from '../../middlewares'
|
||||
import { VideoChannelModel } from '../../models/video/video-channel'
|
||||
import { videoPlaylistsSortValidator } from '../../middlewares/validators'
|
||||
import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
|
||||
import { CONFIG, MIMETYPES, sequelizeTypescript, THUMBNAILS_SIZE, VIDEO_PLAYLIST_PRIVACIES } from '../../initializers'
|
||||
|
@ -31,7 +30,6 @@ import { VideoPlaylistCreate } from '../../../shared/models/videos/playlist/vide
|
|||
import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'
|
||||
import { processImage } from '../../helpers/image-utils'
|
||||
import { join } from 'path'
|
||||
import { UserModel } from '../../models/account/user'
|
||||
import { sendCreateVideoPlaylist, sendDeleteVideoPlaylist, sendUpdateVideoPlaylist } from '../../lib/activitypub/send'
|
||||
import { getVideoPlaylistActivityPubUrl, getVideoPlaylistElementActivityPubUrl } from '../../lib/activitypub/url'
|
||||
import { VideoPlaylistUpdate } from '../../../shared/models/videos/playlist/video-playlist-update.model'
|
||||
|
@ -142,14 +140,14 @@ async function listVideoPlaylists (req: express.Request, res: express.Response)
|
|||
}
|
||||
|
||||
function getVideoPlaylist (req: express.Request, res: express.Response) {
|
||||
const videoPlaylist = res.locals.videoPlaylist as VideoPlaylistModel
|
||||
const videoPlaylist = res.locals.videoPlaylist
|
||||
|
||||
return res.json(videoPlaylist.toFormattedJSON())
|
||||
}
|
||||
|
||||
async function addVideoPlaylist (req: express.Request, res: express.Response) {
|
||||
const videoPlaylistInfo: VideoPlaylistCreate = req.body
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const user = res.locals.oauth.token.User
|
||||
|
||||
const videoPlaylist = new VideoPlaylistModel({
|
||||
name: videoPlaylistInfo.displayName,
|
||||
|
@ -161,7 +159,7 @@ async function addVideoPlaylist (req: express.Request, res: express.Response) {
|
|||
videoPlaylist.url = getVideoPlaylistActivityPubUrl(videoPlaylist) // We use the UUID, so set the URL after building the object
|
||||
|
||||
if (videoPlaylistInfo.videoChannelId) {
|
||||
const videoChannel = res.locals.videoChannel as VideoChannelModel
|
||||
const videoChannel = res.locals.videoChannel
|
||||
|
||||
videoPlaylist.videoChannelId = videoChannel.id
|
||||
videoPlaylist.VideoChannel = videoChannel
|
||||
|
@ -194,7 +192,7 @@ async function addVideoPlaylist (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function updateVideoPlaylist (req: express.Request, res: express.Response) {
|
||||
const videoPlaylistInstance = res.locals.videoPlaylist as VideoPlaylistModel
|
||||
const videoPlaylistInstance = res.locals.videoPlaylist
|
||||
const videoPlaylistFieldsSave = videoPlaylistInstance.toJSON()
|
||||
const videoPlaylistInfoToUpdate = req.body as VideoPlaylistUpdate
|
||||
const wasPrivatePlaylist = videoPlaylistInstance.privacy === VideoPlaylistPrivacy.PRIVATE
|
||||
|
@ -219,7 +217,7 @@ async function updateVideoPlaylist (req: express.Request, res: express.Response)
|
|||
if (videoPlaylistInfoToUpdate.videoChannelId === null) {
|
||||
videoPlaylistInstance.videoChannelId = null
|
||||
} else {
|
||||
const videoChannel = res.locals.videoChannel as VideoChannelModel
|
||||
const videoChannel = res.locals.videoChannel
|
||||
|
||||
videoPlaylistInstance.videoChannelId = videoChannel.id
|
||||
videoPlaylistInstance.VideoChannel = videoChannel
|
||||
|
@ -262,7 +260,7 @@ async function updateVideoPlaylist (req: express.Request, res: express.Response)
|
|||
}
|
||||
|
||||
async function removeVideoPlaylist (req: express.Request, res: express.Response) {
|
||||
const videoPlaylistInstance: VideoPlaylistModel = res.locals.videoPlaylist
|
||||
const videoPlaylistInstance = res.locals.videoPlaylist
|
||||
|
||||
await sequelizeTypescript.transaction(async t => {
|
||||
await videoPlaylistInstance.destroy({ transaction: t })
|
||||
|
@ -277,8 +275,8 @@ async function removeVideoPlaylist (req: express.Request, res: express.Response)
|
|||
|
||||
async function addVideoInPlaylist (req: express.Request, res: express.Response) {
|
||||
const body: VideoPlaylistElementCreate = req.body
|
||||
const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist
|
||||
const video: VideoModel = res.locals.video
|
||||
const videoPlaylist = res.locals.videoPlaylist
|
||||
const video = res.locals.video
|
||||
|
||||
const playlistElement: VideoPlaylistElementModel = await sequelizeTypescript.transaction(async t => {
|
||||
const position = await VideoPlaylistElementModel.getNextPositionOf(videoPlaylist.id, t)
|
||||
|
@ -323,8 +321,8 @@ async function addVideoInPlaylist (req: express.Request, res: express.Response)
|
|||
|
||||
async function updateVideoPlaylistElement (req: express.Request, res: express.Response) {
|
||||
const body: VideoPlaylistElementUpdate = req.body
|
||||
const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist
|
||||
const videoPlaylistElement: VideoPlaylistElementModel = res.locals.videoPlaylistElement
|
||||
const videoPlaylist = res.locals.videoPlaylist
|
||||
const videoPlaylistElement = res.locals.videoPlaylistElement
|
||||
|
||||
const playlistElement: VideoPlaylistElementModel = await sequelizeTypescript.transaction(async t => {
|
||||
if (body.startTimestamp !== undefined) videoPlaylistElement.startTimestamp = body.startTimestamp
|
||||
|
@ -346,8 +344,8 @@ async function updateVideoPlaylistElement (req: express.Request, res: express.Re
|
|||
}
|
||||
|
||||
async function removeVideoFromPlaylist (req: express.Request, res: express.Response) {
|
||||
const videoPlaylistElement: VideoPlaylistElementModel = res.locals.videoPlaylistElement
|
||||
const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist
|
||||
const videoPlaylistElement = res.locals.videoPlaylistElement
|
||||
const videoPlaylist = res.locals.videoPlaylist
|
||||
const positionToDelete = videoPlaylistElement.position
|
||||
|
||||
await sequelizeTypescript.transaction(async t => {
|
||||
|
@ -368,7 +366,7 @@ async function removeVideoFromPlaylist (req: express.Request, res: express.Respo
|
|||
}
|
||||
|
||||
async function reorderVideosPlaylist (req: express.Request, res: express.Response) {
|
||||
const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist
|
||||
const videoPlaylist = res.locals.videoPlaylist
|
||||
const body: VideoPlaylistReorder = req.body
|
||||
|
||||
const start: number = body.startPosition
|
||||
|
@ -416,7 +414,7 @@ async function reorderVideosPlaylist (req: express.Request, res: express.Respons
|
|||
}
|
||||
|
||||
async function getVideoPlaylistVideos (req: express.Request, res: express.Response) {
|
||||
const videoPlaylistInstance: VideoPlaylistModel = res.locals.videoPlaylist
|
||||
const videoPlaylistInstance = res.locals.videoPlaylist
|
||||
const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined
|
||||
|
||||
const resultList = await VideoModel.listForApi({
|
||||
|
|
|
@ -17,10 +17,8 @@ import {
|
|||
videoAbuseUpdateValidator
|
||||
} from '../../../middlewares'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
import { VideoModel } from '../../../models/video/video'
|
||||
import { VideoAbuseModel } from '../../../models/video/video-abuse'
|
||||
import { auditLoggerFactory, VideoAbuseAuditView } from '../../../helpers/audit-logger'
|
||||
import { UserModel } from '../../../models/account/user'
|
||||
import { Notifier } from '../../../lib/notifier'
|
||||
import { sendVideoAbuse } from '../../../lib/activitypub/send/send-flag'
|
||||
|
||||
|
@ -69,7 +67,7 @@ async function listVideoAbuses (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function updateVideoAbuse (req: express.Request, res: express.Response) {
|
||||
const videoAbuse: VideoAbuseModel = res.locals.videoAbuse
|
||||
const videoAbuse = res.locals.videoAbuse
|
||||
|
||||
if (req.body.moderationComment !== undefined) videoAbuse.moderationComment = req.body.moderationComment
|
||||
if (req.body.state !== undefined) videoAbuse.state = req.body.state
|
||||
|
@ -84,7 +82,7 @@ async function updateVideoAbuse (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function deleteVideoAbuse (req: express.Request, res: express.Response) {
|
||||
const videoAbuse: VideoAbuseModel = res.locals.videoAbuse
|
||||
const videoAbuse = res.locals.videoAbuse
|
||||
|
||||
await sequelizeTypescript.transaction(t => {
|
||||
return videoAbuse.destroy({ transaction: t })
|
||||
|
@ -96,11 +94,11 @@ async function deleteVideoAbuse (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function reportVideoAbuse (req: express.Request, res: express.Response) {
|
||||
const videoInstance = res.locals.video as VideoModel
|
||||
const videoInstance = res.locals.video
|
||||
const body: VideoAbuseCreate = req.body
|
||||
|
||||
const videoAbuse: VideoAbuseModel = await sequelizeTypescript.transaction(async t => {
|
||||
const reporterAccount = await AccountModel.load((res.locals.oauth.token.User as UserModel).Account.id, t)
|
||||
const reporterAccount = await AccountModel.load(res.locals.oauth.token.User.Account.id, t)
|
||||
|
||||
const abuseToCreate = {
|
||||
reporterAccountId: reporterAccount.id,
|
||||
|
|
|
@ -17,7 +17,6 @@ import {
|
|||
import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
|
||||
import { sequelizeTypescript } from '../../../initializers'
|
||||
import { Notifier } from '../../../lib/notifier'
|
||||
import { VideoModel } from '../../../models/video/video'
|
||||
import { sendDeleteVideo } from '../../../lib/activitypub/send'
|
||||
import { federateVideoIfNeeded } from '../../../lib/activitypub'
|
||||
|
||||
|
@ -87,7 +86,7 @@ async function addVideoToBlacklist (req: express.Request, res: express.Response)
|
|||
}
|
||||
|
||||
async function updateVideoBlacklistController (req: express.Request, res: express.Response) {
|
||||
const videoBlacklist = res.locals.videoBlacklist as VideoBlacklistModel
|
||||
const videoBlacklist = res.locals.videoBlacklist
|
||||
|
||||
if (req.body.reason !== undefined) videoBlacklist.reason = req.body.reason
|
||||
|
||||
|
@ -105,8 +104,8 @@ async function listBlacklist (req: express.Request, res: express.Response, next:
|
|||
}
|
||||
|
||||
async function removeVideoFromBlacklistController (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const videoBlacklist = res.locals.videoBlacklist as VideoBlacklistModel
|
||||
const video: VideoModel = res.locals.video
|
||||
const videoBlacklist = res.locals.videoBlacklist
|
||||
const video = res.locals.video
|
||||
|
||||
await sequelizeTypescript.transaction(async t => {
|
||||
const unfederated = videoBlacklist.unfederated
|
||||
|
|
|
@ -5,7 +5,6 @@ import { createReqFiles } from '../../../helpers/express-utils'
|
|||
import { CONFIG, MIMETYPES, sequelizeTypescript } from '../../../initializers'
|
||||
import { getFormattedObjects } from '../../../helpers/utils'
|
||||
import { VideoCaptionModel } from '../../../models/video/video-caption'
|
||||
import { VideoModel } from '../../../models/video/video'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
import { federateVideoIfNeeded } from '../../../lib/activitypub'
|
||||
import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils'
|
||||
|
@ -52,7 +51,7 @@ async function listVideoCaptions (req: express.Request, res: express.Response) {
|
|||
|
||||
async function addVideoCaption (req: express.Request, res: express.Response) {
|
||||
const videoCaptionPhysicalFile = req.files['captionfile'][0]
|
||||
const video = res.locals.video as VideoModel
|
||||
const video = res.locals.video
|
||||
|
||||
const videoCaption = new VideoCaptionModel({
|
||||
videoId: video.id,
|
||||
|
@ -74,8 +73,8 @@ async function addVideoCaption (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function deleteVideoCaption (req: express.Request, res: express.Response) {
|
||||
const video = res.locals.video as VideoModel
|
||||
const videoCaption = res.locals.videoCaption as VideoCaptionModel
|
||||
const video = res.locals.video
|
||||
const videoCaption = res.locals.videoCaption
|
||||
|
||||
await sequelizeTypescript.transaction(async t => {
|
||||
await videoCaption.destroy({ transaction: t })
|
||||
|
|
|
@ -8,7 +8,8 @@ import { buildFormattedCommentTree, createVideoComment } from '../../../lib/vide
|
|||
import {
|
||||
asyncMiddleware,
|
||||
asyncRetryTransactionMiddleware,
|
||||
authenticate, optionalAuthenticate,
|
||||
authenticate,
|
||||
optionalAuthenticate,
|
||||
paginationValidator,
|
||||
setDefaultPagination,
|
||||
setDefaultSort
|
||||
|
@ -21,11 +22,9 @@ import {
|
|||
removeVideoCommentValidator,
|
||||
videoCommentThreadsSortValidator
|
||||
} from '../../../middlewares/validators'
|
||||
import { VideoModel } from '../../../models/video/video'
|
||||
import { VideoCommentModel } from '../../../models/video/video-comment'
|
||||
import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
import { UserModel } from '../../../models/account/user'
|
||||
import { Notifier } from '../../../lib/notifier'
|
||||
|
||||
const auditLogger = auditLoggerFactory('comments')
|
||||
|
@ -70,9 +69,9 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function listVideoThreads (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const video = res.locals.video as VideoModel
|
||||
const user: UserModel = res.locals.oauth ? res.locals.oauth.token.User : undefined
|
||||
async function listVideoThreads (req: express.Request, res: express.Response) {
|
||||
const video = res.locals.video
|
||||
const user = res.locals.oauth ? res.locals.oauth.token.User : undefined
|
||||
|
||||
let resultList: ResultList<VideoCommentModel>
|
||||
|
||||
|
@ -88,9 +87,9 @@ async function listVideoThreads (req: express.Request, res: express.Response, ne
|
|||
return res.json(getFormattedObjects(resultList.data, resultList.total))
|
||||
}
|
||||
|
||||
async function listVideoThreadComments (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const video = res.locals.video as VideoModel
|
||||
const user: UserModel = res.locals.oauth ? res.locals.oauth.token.User : undefined
|
||||
async function listVideoThreadComments (req: express.Request, res: express.Response) {
|
||||
const video = res.locals.video
|
||||
const user = res.locals.oauth ? res.locals.oauth.token.User : undefined
|
||||
|
||||
let resultList: ResultList<VideoCommentModel>
|
||||
|
||||
|
@ -110,7 +109,7 @@ async function addVideoCommentThread (req: express.Request, res: express.Respons
|
|||
const videoCommentInfo: VideoCommentCreate = req.body
|
||||
|
||||
const comment = await sequelizeTypescript.transaction(async t => {
|
||||
const account = await AccountModel.load((res.locals.oauth.token.User as UserModel).Account.id, t)
|
||||
const account = await AccountModel.load(res.locals.oauth.token.User.Account.id, t)
|
||||
|
||||
return createVideoComment({
|
||||
text: videoCommentInfo.text,
|
||||
|
@ -132,7 +131,7 @@ async function addVideoCommentReply (req: express.Request, res: express.Response
|
|||
const videoCommentInfo: VideoCommentCreate = req.body
|
||||
|
||||
const comment = await sequelizeTypescript.transaction(async t => {
|
||||
const account = await AccountModel.load((res.locals.oauth.token.User as UserModel).Account.id, t)
|
||||
const account = await AccountModel.load(res.locals.oauth.token.User.Account.id, t)
|
||||
|
||||
return createVideoComment({
|
||||
text: videoCommentInfo.text,
|
||||
|
@ -149,7 +148,7 @@ async function addVideoCommentReply (req: express.Request, res: express.Response
|
|||
}
|
||||
|
||||
async function removeVideoComment (req: express.Request, res: express.Response) {
|
||||
const videoCommentInstance: VideoCommentModel = res.locals.videoComment
|
||||
const videoCommentInstance = res.locals.videoComment
|
||||
|
||||
await sequelizeTypescript.transaction(async t => {
|
||||
await videoCommentInstance.destroy({ transaction: t })
|
||||
|
|
|
@ -97,7 +97,7 @@ async function addTorrentImport (req: express.Request, res: express.Response, to
|
|||
state: VideoImportState.PENDING,
|
||||
userId: user.id
|
||||
}
|
||||
const videoImport: VideoImportModel = await insertIntoDB(video, res.locals.videoChannel, tags, videoImportAttributes)
|
||||
const videoImport = await insertIntoDB(video, res.locals.videoChannel, tags, videoImportAttributes)
|
||||
|
||||
// Create job to import the video
|
||||
const payload = {
|
||||
|
@ -139,7 +139,7 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
|
|||
state: VideoImportState.PENDING,
|
||||
userId: user.id
|
||||
}
|
||||
const videoImport: VideoImportModel = await insertIntoDB(video, res.locals.videoChannel, tags, videoImportAttributes)
|
||||
const videoImport = await insertIntoDB(video, res.locals.videoChannel, tags, videoImportAttributes)
|
||||
|
||||
// Create job to import the video
|
||||
const payload = {
|
||||
|
|
|
@ -295,7 +295,7 @@ async function addVideo (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function updateVideo (req: express.Request, res: express.Response) {
|
||||
const videoInstance: VideoModel = res.locals.video
|
||||
const videoInstance = res.locals.video
|
||||
const videoFieldsSave = videoInstance.toJSON()
|
||||
const oldVideoAuditView = new VideoAuditView(videoInstance.toFormattedDetailsJSON())
|
||||
const videoInfoToUpdate: VideoUpdate = req.body
|
||||
|
@ -407,7 +407,7 @@ async function updateVideo (req: express.Request, res: express.Response) {
|
|||
async function getVideo (req: express.Request, res: express.Response) {
|
||||
// We need more attributes
|
||||
const userId: number = res.locals.oauth ? res.locals.oauth.token.User.id : null
|
||||
const video: VideoModel = await VideoModel.loadForGetAPI(res.locals.video.id, undefined, userId)
|
||||
const video = await VideoModel.loadForGetAPI(res.locals.video.id, undefined, userId)
|
||||
|
||||
if (video.isOutdated()) {
|
||||
JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'video', url: video.url } })
|
||||
|
@ -472,7 +472,7 @@ async function listVideos (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
async function removeVideo (req: express.Request, res: express.Response) {
|
||||
const videoInstance: VideoModel = res.locals.video
|
||||
const videoInstance = res.locals.video
|
||||
|
||||
await sequelizeTypescript.transaction(async t => {
|
||||
await videoInstance.destroy({ transaction: t })
|
||||
|
|
|
@ -11,8 +11,6 @@ import {
|
|||
videosChangeOwnershipValidator,
|
||||
videosTerminateChangeOwnershipValidator
|
||||
} from '../../../middlewares'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
import { VideoModel } from '../../../models/video/video'
|
||||
import { VideoChangeOwnershipModel } from '../../../models/video/video-change-ownership'
|
||||
import { VideoChangeOwnershipStatus, VideoPrivacy, VideoState } from '../../../../shared/models/videos'
|
||||
import { VideoChannelModel } from '../../../models/video/video-channel'
|
||||
|
@ -58,9 +56,9 @@ export {
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function giveVideoOwnership (req: express.Request, res: express.Response) {
|
||||
const videoInstance = res.locals.video as VideoModel
|
||||
const initiatorAccountId = (res.locals.oauth.token.User as UserModel).Account.id
|
||||
const nextOwner = res.locals.nextOwner as AccountModel
|
||||
const videoInstance = res.locals.video
|
||||
const initiatorAccountId = res.locals.oauth.token.User.Account.id
|
||||
const nextOwner = res.locals.nextOwner
|
||||
|
||||
await sequelizeTypescript.transaction(t => {
|
||||
return VideoChangeOwnershipModel.findOrCreate({
|
||||
|
@ -85,7 +83,7 @@ async function giveVideoOwnership (req: express.Request, res: express.Response)
|
|||
}
|
||||
|
||||
async function listVideoOwnership (req: express.Request, res: express.Response) {
|
||||
const currentAccountId = (res.locals.oauth.token.User as UserModel).Account.id
|
||||
const currentAccountId = res.locals.oauth.token.User.Account.id
|
||||
|
||||
const resultList = await VideoChangeOwnershipModel.listForApi(
|
||||
currentAccountId,
|
||||
|
@ -99,9 +97,9 @@ async function listVideoOwnership (req: express.Request, res: express.Response)
|
|||
|
||||
async function acceptOwnership (req: express.Request, res: express.Response) {
|
||||
return sequelizeTypescript.transaction(async t => {
|
||||
const videoChangeOwnership = res.locals.videoChangeOwnership as VideoChangeOwnershipModel
|
||||
const videoChangeOwnership = res.locals.videoChangeOwnership
|
||||
const targetVideo = videoChangeOwnership.Video
|
||||
const channel = res.locals.videoChannel as VideoChannelModel
|
||||
const channel = res.locals.videoChannel
|
||||
|
||||
const oldVideoChannel = await VideoChannelModel.loadByIdAndPopulateAccount(targetVideo.channelId)
|
||||
|
||||
|
@ -123,7 +121,7 @@ async function acceptOwnership (req: express.Request, res: express.Response) {
|
|||
|
||||
async function refuseOwnership (req: express.Request, res: express.Response) {
|
||||
return sequelizeTypescript.transaction(async t => {
|
||||
const videoChangeOwnership = res.locals.videoChangeOwnership as VideoChangeOwnershipModel
|
||||
const videoChangeOwnership = res.locals.videoChangeOwnership
|
||||
|
||||
videoChangeOwnership.set('status', VideoChangeOwnershipStatus.REFUSED)
|
||||
await videoChangeOwnership.save({ transaction: t })
|
||||
|
|
|
@ -6,7 +6,6 @@ import { getRateUrl, sendVideoRateChange } from '../../../lib/activitypub'
|
|||
import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUpdateRateValidator } from '../../../middlewares'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
|
||||
import { VideoModel } from '../../../models/video/video'
|
||||
|
||||
const rateVideoRouter = express.Router()
|
||||
|
||||
|
@ -27,8 +26,8 @@ export {
|
|||
async function rateVideo (req: express.Request, res: express.Response) {
|
||||
const body: UserVideoRateUpdate = req.body
|
||||
const rateType = body.rating
|
||||
const videoInstance: VideoModel = res.locals.video
|
||||
const userAccount: AccountModel = res.locals.oauth.token.User.Account
|
||||
const videoInstance = res.locals.video
|
||||
const userAccount = res.locals.oauth.token.User.Account
|
||||
|
||||
await sequelizeTypescript.transaction(async t => {
|
||||
const sequelizeOptions = { transaction: t }
|
||||
|
|
|
@ -21,7 +21,7 @@ export {
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function userWatchVideo (req: express.Request, res: express.Response) {
|
||||
const user = res.locals.oauth.token.User as UserModel
|
||||
const user = res.locals.oauth.token.User
|
||||
|
||||
const body: UserWatchingVideo = req.body
|
||||
const { id: videoId } = res.locals.video as { id: number }
|
||||
|
|
|
@ -11,9 +11,7 @@ import {
|
|||
} from '../middlewares'
|
||||
import { VideoModel } from '../models/video/video'
|
||||
import * as Feed from 'pfeed'
|
||||
import { AccountModel } from '../models/account/account'
|
||||
import { cacheRoute } from '../middlewares/cache'
|
||||
import { VideoChannelModel } from '../models/video/video-channel'
|
||||
import { VideoCommentModel } from '../models/video/video-comment'
|
||||
import { buildNSFWFilter } from '../helpers/express-utils'
|
||||
|
||||
|
@ -42,10 +40,10 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function generateVideoCommentsFeed (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
async function generateVideoCommentsFeed (req: express.Request, res: express.Response) {
|
||||
const start = 0
|
||||
|
||||
const video = res.locals.video as VideoModel
|
||||
const video = res.locals.video
|
||||
const videoId: number = video ? video.id : undefined
|
||||
|
||||
const comments = await VideoCommentModel.listForFeed(start, FEEDS.COUNT, videoId)
|
||||
|
@ -77,11 +75,11 @@ async function generateVideoCommentsFeed (req: express.Request, res: express.Res
|
|||
return sendFeed(feed, req, res)
|
||||
}
|
||||
|
||||
async function generateVideoFeed (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
async function generateVideoFeed (req: express.Request, res: express.Response) {
|
||||
const start = 0
|
||||
|
||||
const account: AccountModel = res.locals.account
|
||||
const videoChannel: VideoChannelModel = res.locals.videoChannel
|
||||
const account = res.locals.account
|
||||
const videoChannel = res.locals.videoChannel
|
||||
const nsfw = buildNSFWFilter(res, req.query.nsfw)
|
||||
|
||||
let name: string
|
||||
|
|
|
@ -23,8 +23,8 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function generateOEmbed (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const video = res.locals.video as VideoModel
|
||||
function generateOEmbed (req: express.Request, res: express.Response) {
|
||||
const video = res.locals.video
|
||||
const webserverUrl = CONFIG.WEBSERVER.URL
|
||||
const maxHeight = parseInt(req.query.maxheight, 10)
|
||||
const maxWidth = parseInt(req.query.maxwidth, 10)
|
||||
|
|
|
@ -245,7 +245,7 @@ async function downloadVideoFile (req: express.Request, res: express.Response, n
|
|||
|
||||
function getVideoAndFile (req: express.Request, res: express.Response) {
|
||||
const resolution = parseInt(req.params.resolution, 10)
|
||||
const video: VideoModel = res.locals.video
|
||||
const video = res.locals.video
|
||||
|
||||
const videoFile = video.VideoFiles.find(f => f.resolution === resolution)
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import * as express from 'express'
|
||||
import { asyncMiddleware } from '../middlewares'
|
||||
import { webfingerValidator } from '../middlewares/validators'
|
||||
import { ActorModel } from '../models/activitypub/actor'
|
||||
|
||||
const webfingerRouter = express.Router()
|
||||
|
||||
|
@ -18,8 +17,8 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function webfingerController (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const actor = res.locals.actor as ActorModel
|
||||
function webfingerController (req: express.Request, res: express.Response) {
|
||||
const actor = res.locals.actor
|
||||
|
||||
const json = {
|
||||
subject: req.query.resource,
|
||||
|
|
|
@ -5,7 +5,6 @@ import { logger } from './logger'
|
|||
import { deleteFileAsync, generateRandomString } from './utils'
|
||||
import { extname } from 'path'
|
||||
import { isArray } from './custom-validators/misc'
|
||||
import { UserModel } from '../models/account/user'
|
||||
|
||||
function buildNSFWFilter (res?: express.Response, paramNSFW?: string) {
|
||||
if (paramNSFW === 'true') return true
|
||||
|
@ -13,7 +12,7 @@ function buildNSFWFilter (res?: express.Response, paramNSFW?: string) {
|
|||
if (paramNSFW === 'both') return undefined
|
||||
|
||||
if (res && res.locals.oauth) {
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const user = res.locals.oauth.token.User
|
||||
|
||||
// User does not want NSFW videos
|
||||
if (user.nsfwPolicy === 'do_not_list') return false
|
||||
|
@ -100,7 +99,7 @@ function createReqFiles (
|
|||
}
|
||||
|
||||
function isUserAbleToSearchRemoteURI (res: express.Response) {
|
||||
const user: UserModel = res.locals.oauth ? res.locals.oauth.token.User : undefined
|
||||
const user = res.locals.oauth ? res.locals.oauth.token.User : undefined
|
||||
|
||||
return CONFIG.SEARCH.REMOTE_URI.ANONYMOUS === true ||
|
||||
(CONFIG.SEARCH.REMOTE_URI.USERS === true && user !== undefined)
|
||||
|
|
|
@ -4,7 +4,6 @@ import { logger } from '../helpers/logger'
|
|||
import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto'
|
||||
import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers'
|
||||
import { getOrCreateActorAndServerAndModel } from '../lib/activitypub'
|
||||
import { ActorModel } from '../models/activitypub/actor'
|
||||
import { loadActorUrlOrGetFromWebfinger } from '../helpers/webfinger'
|
||||
|
||||
async function checkSignature (req: Request, res: Response, next: NextFunction) {
|
||||
|
@ -12,7 +11,7 @@ async function checkSignature (req: Request, res: Response, next: NextFunction)
|
|||
const httpSignatureChecked = await checkHttpSignature(req, res)
|
||||
if (httpSignatureChecked !== true) return
|
||||
|
||||
const actor: ActorModel = res.locals.signature.actor
|
||||
const actor = res.locals.signature.actor
|
||||
|
||||
// Forwarded activity
|
||||
const bodyActor = req.body.actor
|
||||
|
|
|
@ -2,11 +2,10 @@ import * as express from 'express'
|
|||
import 'express-validator'
|
||||
import { UserRight } from '../../shared'
|
||||
import { logger } from '../helpers/logger'
|
||||
import { UserModel } from '../models/account/user'
|
||||
|
||||
function ensureUserHasRight (userRight: UserRight) {
|
||||
return function (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const user = res.locals.oauth.token.user as UserModel
|
||||
const user = res.locals.oauth.token.user
|
||||
if (user.hasRight(userRight) === false) {
|
||||
const message = `User ${user.username} does not have right ${UserRight[userRight]} to access to ${req.path}.`
|
||||
logger.info(message)
|
||||
|
|
|
@ -2,7 +2,6 @@ import * as express from 'express'
|
|||
import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
import { getServerActor } from '../../../helpers/utils'
|
||||
import { ActorModel } from '../../../models/activitypub/actor'
|
||||
|
||||
async function activityPubValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
logger.debug('Checking activity pub parameters')
|
||||
|
@ -13,7 +12,7 @@ async function activityPubValidator (req: express.Request, res: express.Response
|
|||
}
|
||||
|
||||
const serverActor = await getServerActor()
|
||||
const remoteActor = res.locals.signature.actor as ActorModel
|
||||
const remoteActor = res.locals.signature.actor
|
||||
if (serverActor.id === remoteActor.id) {
|
||||
logger.error('Receiving request in INBOX by ourselves!', req.body)
|
||||
return res.status(409).end()
|
||||
|
|
|
@ -20,7 +20,7 @@ const blockAccountValidator = [
|
|||
if (areValidationErrors(req, res)) return
|
||||
if (!await doesAccountNameWithHostExist(req.body.accountName, res)) return
|
||||
|
||||
const user = res.locals.oauth.token.User as UserModel
|
||||
const user = res.locals.oauth.token.User
|
||||
const accountToBlock = res.locals.account
|
||||
|
||||
if (user.Account.id === accountToBlock.id) {
|
||||
|
@ -44,7 +44,7 @@ const unblockAccountByAccountValidator = [
|
|||
if (areValidationErrors(req, res)) return
|
||||
if (!await doesAccountNameWithHostExist(req.params.accountName, res)) return
|
||||
|
||||
const user = res.locals.oauth.token.User as UserModel
|
||||
const user = res.locals.oauth.token.User
|
||||
const targetAccount = res.locals.account
|
||||
if (!await doesUnblockAccountExist(user.Account.id, targetAccount.id, res)) return
|
||||
|
||||
|
@ -106,7 +106,7 @@ const unblockServerByAccountValidator = [
|
|||
|
||||
if (areValidationErrors(req, res)) return
|
||||
|
||||
const user = res.locals.oauth.token.User as UserModel
|
||||
const user = res.locals.oauth.token.User
|
||||
if (!await doesUnblockServerExist(user.Account.id, req.params.host, res)) return
|
||||
|
||||
return next()
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
import * as express from 'express'
|
||||
import 'express-validator'
|
||||
import { param, body } from 'express-validator/check'
|
||||
import { body, param } from 'express-validator/check'
|
||||
import { exists, isBooleanValid, isIdOrUUIDValid, toIntOrNull } from '../../helpers/custom-validators/misc'
|
||||
import { doesVideoExist } from '../../helpers/custom-validators/videos'
|
||||
import { logger } from '../../helpers/logger'
|
||||
import { areValidationErrors } from './utils'
|
||||
import { VideoModel } from '../../models/video/video'
|
||||
import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
|
||||
import { isHostValid } from '../../helpers/custom-validators/servers'
|
||||
import { getServerActor } from '../../helpers/utils'
|
||||
import { ActorFollowModel } from '../../models/activitypub/actor-follow'
|
||||
import { SERVER_ACTOR_NAME } from '../../initializers'
|
||||
import { ServerModel } from '../../models/server/server'
|
||||
|
||||
const videoFileRedundancyGetValidator = [
|
||||
|
@ -29,7 +25,7 @@ const videoFileRedundancyGetValidator = [
|
|||
if (areValidationErrors(req, res)) return
|
||||
if (!await doesVideoExist(req.params.videoId, res)) return
|
||||
|
||||
const video: VideoModel = res.locals.video
|
||||
const video = res.locals.video
|
||||
const videoFile = video.VideoFiles.find(f => {
|
||||
return f.resolution === req.params.resolution && (!req.params.fps || f.fps === req.params.fps)
|
||||
})
|
||||
|
@ -55,7 +51,7 @@ const videoPlaylistRedundancyGetValidator = [
|
|||
if (areValidationErrors(req, res)) return
|
||||
if (!await doesVideoExist(req.params.videoId, res)) return
|
||||
|
||||
const video: VideoModel = res.locals.video
|
||||
const video = res.locals.video
|
||||
const videoStreamingPlaylist = video.VideoStreamingPlaylists.find(p => p === req.params.streamingPlaylistType)
|
||||
|
||||
if (!videoStreamingPlaylist) return res.status(404).json({ error: 'Video playlist not found.' })
|
||||
|
|
|
@ -5,7 +5,6 @@ import { logger } from '../../helpers/logger'
|
|||
import { areValidationErrors } from './utils'
|
||||
import { ActorFollowModel } from '../../models/activitypub/actor-follow'
|
||||
import { areValidActorHandles, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor'
|
||||
import { UserModel } from '../../models/account/user'
|
||||
import { CONFIG } from '../../initializers'
|
||||
import { toArray } from '../../helpers/custom-validators/misc'
|
||||
|
||||
|
@ -46,7 +45,7 @@ const userSubscriptionGetValidator = [
|
|||
let [ name, host ] = req.params.uri.split('@')
|
||||
if (host === CONFIG.WEBSERVER.HOST) host = null
|
||||
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const user = res.locals.oauth.token.User
|
||||
const subscription = await ActorFollowModel.loadByActorAndTargetNameAndHostForAPI(user.Account.Actor.id, name, host)
|
||||
|
||||
if (!subscription || !subscription.ActorFollowing.VideoChannel) {
|
||||
|
|
|
@ -14,7 +14,8 @@ import {
|
|||
isUserRoleValid,
|
||||
isUserUsernameValid,
|
||||
isUserVideoQuotaDailyValid,
|
||||
isUserVideoQuotaValid, isUserVideosHistoryEnabledValid
|
||||
isUserVideoQuotaValid,
|
||||
isUserVideosHistoryEnabledValid
|
||||
} from '../../helpers/custom-validators/users'
|
||||
import { doesVideoExist } from '../../helpers/custom-validators/videos'
|
||||
import { logger } from '../../helpers/logger'
|
||||
|
@ -100,7 +101,7 @@ const usersBlockingValidator = [
|
|||
|
||||
const deleteMeValidator = [
|
||||
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
const user = res.locals.oauth.token.User
|
||||
if (user.username === 'root') {
|
||||
return res.status(400)
|
||||
.send({ error: 'You cannot delete your root account.' })
|
||||
|
@ -159,8 +160,7 @@ const usersUpdateMeValidator = [
|
|||
.end()
|
||||
}
|
||||
|
||||
const user: UserModel = res.locals.oauth.token.User
|
||||
|
||||
const user= res.locals.oauth.token.User
|
||||
if (await user.isPasswordMatch(req.body.currentPassword) !== true) {
|
||||
return res.status(401)
|
||||
.send({ error: 'currentPassword is invalid.' })
|
||||
|
@ -257,7 +257,7 @@ const usersResetPasswordValidator = [
|
|||
if (areValidationErrors(req, res)) return
|
||||
if (!await checkUserIdExist(req.params.id, res)) return
|
||||
|
||||
const user = res.locals.user as UserModel
|
||||
const user = res.locals.user
|
||||
const redisVerificationString = await Redis.Instance.getResetPasswordLink(user.id)
|
||||
|
||||
if (redisVerificationString !== req.body.verificationString) {
|
||||
|
@ -299,7 +299,7 @@ const usersVerifyEmailValidator = [
|
|||
if (areValidationErrors(req, res)) return
|
||||
if (!await checkUserIdExist(req.params.id, res)) return
|
||||
|
||||
const user = res.locals.user as UserModel
|
||||
const user = res.locals.user
|
||||
const redisVerificationString = await Redis.Instance.getVerifyEmailLink(user.id)
|
||||
|
||||
if (redisVerificationString !== req.body.verificationString) {
|
||||
|
|
|
@ -5,7 +5,6 @@ import { doesVideoExist } from '../../../helpers/custom-validators/videos'
|
|||
import { logger } from '../../../helpers/logger'
|
||||
import { areValidationErrors } from '../utils'
|
||||
import { doesVideoBlacklistExist, isVideoBlacklistReasonValid } from '../../../helpers/custom-validators/video-blacklist'
|
||||
import { VideoModel } from '../../../models/video/video'
|
||||
|
||||
const videosBlacklistRemoveValidator = [
|
||||
param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'),
|
||||
|
@ -37,7 +36,7 @@ const videosBlacklistAddValidator = [
|
|||
if (areValidationErrors(req, res)) return
|
||||
if (!await doesVideoExist(req.params.videoId, res)) return
|
||||
|
||||
const video: VideoModel = res.locals.video
|
||||
const video = res.locals.video
|
||||
if (req.body.unfederate === true && video.remote === true) {
|
||||
return res
|
||||
.status(409)
|
||||
|
|
|
@ -103,7 +103,7 @@ const videoPlaylistsDeleteValidator = [
|
|||
|
||||
if (!await doesVideoPlaylistExist(req.params.playlistId, res)) return
|
||||
|
||||
const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist
|
||||
const videoPlaylist = res.locals.videoPlaylist
|
||||
if (videoPlaylist.type === VideoPlaylistType.WATCH_LATER) {
|
||||
return res.status(400)
|
||||
.json({ error: 'Cannot delete a watch later playlist.' })
|
||||
|
@ -128,7 +128,7 @@ const videoPlaylistsGetValidator = [
|
|||
|
||||
if (!await doesVideoPlaylistExist(req.params.playlistId, res)) return
|
||||
|
||||
const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist
|
||||
const videoPlaylist = res.locals.videoPlaylist
|
||||
|
||||
// Video is unlisted, check we used the uuid to fetch it
|
||||
if (videoPlaylist.privacy === VideoPlaylistPrivacy.UNLISTED) {
|
||||
|
@ -140,8 +140,7 @@ const videoPlaylistsGetValidator = [
|
|||
if (videoPlaylist.privacy === VideoPlaylistPrivacy.PRIVATE) {
|
||||
await authenticatePromiseIfNeeded(req, res)
|
||||
|
||||
const user: UserModel = res.locals.oauth ? res.locals.oauth.token.User : null
|
||||
|
||||
const user = res.locals.oauth ? res.locals.oauth.token.User : null
|
||||
if (
|
||||
!user ||
|
||||
(videoPlaylist.OwnerAccount.userId !== user.id && !user.hasRight(UserRight.UPDATE_ANY_VIDEO_PLAYLIST))
|
||||
|
@ -177,8 +176,8 @@ const videoPlaylistsAddVideoValidator = [
|
|||
if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return
|
||||
if (!await doesVideoExist(req.body.videoId, res, 'only-video')) return
|
||||
|
||||
const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist
|
||||
const video: VideoModel = res.locals.video
|
||||
const videoPlaylist = res.locals.videoPlaylist
|
||||
const video = res.locals.video
|
||||
|
||||
const videoPlaylistElement = await VideoPlaylistElementModel.loadByPlaylistAndVideo(videoPlaylist.id, video.id)
|
||||
if (videoPlaylistElement) {
|
||||
|
@ -217,8 +216,8 @@ const videoPlaylistsUpdateOrRemoveVideoValidator = [
|
|||
if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return
|
||||
if (!await doesVideoExist(req.params.videoId, res, 'id')) return
|
||||
|
||||
const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist
|
||||
const video: VideoModel = res.locals.video
|
||||
const videoPlaylist = res.locals.videoPlaylist
|
||||
const video = res.locals.video
|
||||
|
||||
const videoPlaylistElement = await VideoPlaylistElementModel.loadByPlaylistAndVideo(videoPlaylist.id, video.id)
|
||||
if (!videoPlaylistElement) {
|
||||
|
@ -284,7 +283,7 @@ const videoPlaylistsReorderVideosValidator = [
|
|||
|
||||
if (!await doesVideoPlaylistExist(req.params.playlistId, res, 'all')) return
|
||||
|
||||
const videoPlaylist: VideoPlaylistModel = res.locals.videoPlaylist
|
||||
const videoPlaylist = res.locals.videoPlaylist
|
||||
if (!checkUserCanManageVideoPlaylist(res.locals.oauth.token.User, videoPlaylist, UserRight.UPDATE_ANY_VIDEO_PLAYLIST, res)) return
|
||||
|
||||
const nextPosition = await VideoPlaylistElementModel.getNextPositionOf(videoPlaylist.id)
|
||||
|
|
|
@ -6,7 +6,6 @@ import { doesVideoExist } from '../../../helpers/custom-validators/videos'
|
|||
import { logger } from '../../../helpers/logger'
|
||||
import { VideoShareModel } from '../../../models/video/video-share'
|
||||
import { areValidationErrors } from '../utils'
|
||||
import { VideoModel } from '../../../models/video/video'
|
||||
|
||||
const videosShareValidator = [
|
||||
param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'),
|
||||
|
@ -18,7 +17,7 @@ const videosShareValidator = [
|
|||
if (areValidationErrors(req, res)) return
|
||||
if (!await doesVideoExist(req.params.id, res)) return
|
||||
|
||||
const video: VideoModel = res.locals.video
|
||||
const video = res.locals.video
|
||||
|
||||
const share = await VideoShareModel.load(req.params.actorId, video.id)
|
||||
if (!share) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import { isIdOrUUIDValid } from '../../../helpers/custom-validators/misc'
|
|||
import { doesVideoExist } from '../../../helpers/custom-validators/videos'
|
||||
import { areValidationErrors } from '../utils'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
import { UserModel } from '../../../models/account/user'
|
||||
|
||||
const videoWatchingValidator = [
|
||||
param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'),
|
||||
|
@ -18,7 +17,7 @@ const videoWatchingValidator = [
|
|||
if (areValidationErrors(req, res)) return
|
||||
if (!await doesVideoExist(req.params.videoId, res, 'id')) return
|
||||
|
||||
const user = res.locals.oauth.token.User as UserModel
|
||||
const user = res.locals.oauth.token.User
|
||||
if (user.videosHistoryEnabled === false) {
|
||||
logger.warn('Cannot set videos to watch by user %d: videos history is disabled.', user.id)
|
||||
return res.status(409).end()
|
||||
|
|
|
@ -130,7 +130,7 @@ const videosUpdateValidator = getCommonVideoEditAttributes().concat([
|
|||
])
|
||||
|
||||
async function checkVideoFollowConstraints (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const video: VideoModel = res.locals.video
|
||||
const video = res.locals.video
|
||||
|
||||
// Anybody can watch local videos
|
||||
if (video.isOwned() === true) return next()
|
||||
|
@ -164,13 +164,13 @@ const videosCustomGetValidator = (fetchType: VideoFetchType) => {
|
|||
if (areValidationErrors(req, res)) return
|
||||
if (!await doesVideoExist(req.params.id, res, fetchType)) return
|
||||
|
||||
const video: VideoModel = res.locals.video
|
||||
const video = res.locals.video
|
||||
|
||||
// Video private or blacklisted
|
||||
if (video.privacy === VideoPrivacy.PRIVATE || video.VideoBlacklist) {
|
||||
await authenticatePromiseIfNeeded(req, res)
|
||||
|
||||
const user: UserModel = res.locals.oauth ? res.locals.oauth.token.User : null
|
||||
const user = res.locals.oauth ? res.locals.oauth.token.User : null
|
||||
|
||||
// Only the owner or a user that have blacklist rights can see the video
|
||||
if (
|
||||
|
@ -256,7 +256,7 @@ const videosTerminateChangeOwnershipValidator = [
|
|||
return next()
|
||||
},
|
||||
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
const videoChangeOwnership = res.locals.videoChangeOwnership as VideoChangeOwnershipModel
|
||||
const videoChangeOwnership = res.locals.videoChangeOwnership
|
||||
|
||||
if (videoChangeOwnership.status === VideoChangeOwnershipStatus.WAITING) {
|
||||
return next()
|
||||
|
@ -275,7 +275,7 @@ const videosAcceptChangeOwnershipValidator = [
|
|||
if (!await doesVideoChannelOfAccountExist(body.channelId, res.locals.oauth.token.User, res)) return
|
||||
|
||||
const user = res.locals.oauth.token.User
|
||||
const videoChangeOwnership = res.locals.videoChangeOwnership as VideoChangeOwnershipModel
|
||||
const videoChangeOwnership = res.locals.videoChangeOwnership
|
||||
const isAble = await user.isAbleToUploadVideo(videoChangeOwnership.Video.getOriginalFile())
|
||||
if (isAble === false) {
|
||||
res.status(403)
|
||||
|
@ -395,7 +395,7 @@ const commonVideosFiltersValidator = [
|
|||
|
||||
if (areValidationErrors(req, res)) return
|
||||
|
||||
const user: UserModel = res.locals.oauth ? res.locals.oauth.token.User : undefined
|
||||
const user = res.locals.oauth ? res.locals.oauth.token.User : undefined
|
||||
if (req.query.filter === 'all-local' && (!user || user.hasRight(UserRight.SEE_ALL_VIDEOS) === false)) {
|
||||
res.status(401)
|
||||
.json({ error: 'You are not allowed to see all local videos.' })
|
||||
|
|
82
server/typings/express.ts
Normal file
82
server/typings/express.ts
Normal file
|
@ -0,0 +1,82 @@
|
|||
import { VideoChannelModel } from '../models/video/video-channel'
|
||||
import { VideoPlaylistModel } from '../models/video/video-playlist'
|
||||
import { VideoPlaylistElementModel } from '../models/video/video-playlist-element'
|
||||
import { UserModel } from '../models/account/user'
|
||||
import { VideoModel } from '../models/video/video'
|
||||
import { AccountModel } from '../models/account/account'
|
||||
import { VideoChangeOwnershipModel } from '../models/video/video-change-ownership'
|
||||
import { ActorModel } from '../models/activitypub/actor'
|
||||
import { VideoCommentModel } from '../models/video/video-comment'
|
||||
import { VideoShareModel } from '../models/video/video-share'
|
||||
import { AccountVideoRateModel } from '../models/account/account-video-rate'
|
||||
import { ActorFollowModel } from '../models/activitypub/actor-follow'
|
||||
import { ServerModel } from '../models/server/server'
|
||||
import { VideoFileModel } from '../models/video/video-file'
|
||||
import { VideoRedundancyModel } from '../models/redundancy/video-redundancy'
|
||||
import { ServerBlocklistModel } from '../models/server/server-blocklist'
|
||||
import { AccountBlocklistModel } from '../models/account/account-blocklist'
|
||||
import { VideoImportModel } from '../models/video/video-import'
|
||||
import { VideoAbuseModel } from '../models/video/video-abuse'
|
||||
import { VideoBlacklistModel } from '../models/video/video-blacklist'
|
||||
import { VideoCaptionModel } from '../models/video/video-caption'
|
||||
import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist'
|
||||
|
||||
declare module 'express' {
|
||||
|
||||
interface Response {
|
||||
locals: {
|
||||
video?: VideoModel
|
||||
videoShare?: VideoShareModel
|
||||
videoFile?: VideoFileModel
|
||||
|
||||
videoImport?: VideoImportModel
|
||||
|
||||
videoBlacklist?: VideoBlacklistModel
|
||||
|
||||
videoCaption?: VideoCaptionModel
|
||||
|
||||
videoAbuse?: VideoAbuseModel
|
||||
|
||||
videoStreamingPlaylist?: VideoStreamingPlaylistModel
|
||||
|
||||
videoChannel?: VideoChannelModel
|
||||
|
||||
videoPlaylist?: VideoPlaylistModel
|
||||
videoPlaylistElement?: VideoPlaylistElementModel
|
||||
|
||||
accountVideoRate?: AccountVideoRateModel
|
||||
|
||||
videoComment?: VideoCommentModel
|
||||
videoCommentThread?: VideoCommentModel
|
||||
|
||||
follow?: ActorFollowModel
|
||||
subscription?: ActorFollowModel
|
||||
|
||||
nextOwner?: AccountModel
|
||||
videoChangeOwnership?: VideoChangeOwnershipModel
|
||||
account?: AccountModel
|
||||
actor?: ActorModel
|
||||
user?: UserModel
|
||||
|
||||
server?: ServerModel
|
||||
|
||||
videoRedundancy?: VideoRedundancyModel
|
||||
|
||||
accountBlock?: AccountBlocklistModel
|
||||
serverBlock?: ServerBlocklistModel
|
||||
|
||||
oauth?: {
|
||||
token: {
|
||||
User: UserModel
|
||||
user: UserModel
|
||||
}
|
||||
}
|
||||
|
||||
signature?: {
|
||||
actor: ActorModel
|
||||
}
|
||||
|
||||
authenticated?: boolean
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,11 +14,7 @@
|
|||
"es2016",
|
||||
"es2017"
|
||||
],
|
||||
"types": [
|
||||
"node",
|
||||
"chai-xml",
|
||||
"chai-json-schema"
|
||||
]
|
||||
"typeRoots": [ "node_modules/@types", "server/typings" ]
|
||||
},
|
||||
"exclude": [
|
||||
"client/node_modules",
|
||||
|
|
Loading…
Reference in a new issue