From 98ab5dc81048d47d08a231f17698128f959e59b2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 Aug 2021 16:14:11 +0200 Subject: Remove useless async --- server/controllers/api/video-channel.ts | 4 ++-- server/controllers/api/videos/index.ts | 4 ++-- server/controllers/api/videos/live.ts | 4 ++-- server/helpers/ffmpeg-utils.ts | 2 +- server/lib/auth/oauth.ts | 2 +- server/lib/live/shared/muxing-session.ts | 2 +- server/lib/moderation.ts | 4 ++-- server/lib/notifier/shared/follow/auto-follow-for-instance.ts | 2 +- server/lib/notifier/shared/follow/follow-for-instance.ts | 2 +- server/lib/notifier/shared/follow/follow-for-user.ts | 2 +- .../lib/notifier/shared/instance/new-peertube-version-for-admins.ts | 2 +- server/lib/notifier/shared/instance/new-plugin-version-for-admins.ts | 2 +- server/lib/notifier/shared/instance/registration-for-moderators.ts | 2 +- server/lib/transcoding/video-transcoding-profiles.ts | 4 ++-- server/tools/peertube-import-videos.ts | 2 +- 15 files changed, 20 insertions(+), 20 deletions(-) (limited to 'server') diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index 7bdb33737..a0c6601d9 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts @@ -108,7 +108,7 @@ videoChannelRouter.delete('/:nameWithHost', videoChannelRouter.get('/:nameWithHost', asyncMiddleware(videoChannelsNameWithHostValidator), - asyncMiddleware(getVideoChannel) + getVideoChannel ) videoChannelRouter.get('/:nameWithHost/video-playlists', @@ -281,7 +281,7 @@ async function removeVideoChannel (req: express.Request, res: express.Response) return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() } -async function getVideoChannel (req: express.Request, res: express.Response) { +function getVideoChannel (req: express.Request, res: express.Response) { const videoChannel = res.locals.videoChannel if (videoChannel.isOutdated()) { diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 49490f79b..10833d48b 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts @@ -102,7 +102,7 @@ videosRouter.get('/:id', optionalAuthenticate, asyncMiddleware(videosCustomGetValidator('for-api')), asyncMiddleware(checkVideoFollowConstraints), - asyncMiddleware(getVideo) + getVideo ) videosRouter.post('/:id/views', openapiOperationDoc({ operationId: 'addView' }), @@ -141,7 +141,7 @@ function listVideoPrivacies (_req: express.Request, res: express.Response) { res.json(VIDEO_PRIVACIES) } -async function getVideo (_req: express.Request, res: express.Response) { +function getVideo (_req: express.Request, res: express.Response) { const video = res.locals.videoAPI if (video.isOutdated()) { diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.ts index ed4da8f47..151ff354b 100644 --- a/server/controllers/api/videos/live.ts +++ b/server/controllers/api/videos/live.ts @@ -39,7 +39,7 @@ liveRouter.post('/live', liveRouter.get('/live/:videoId', authenticate, asyncMiddleware(videoLiveGetValidator), - asyncRetryTransactionMiddleware(getLiveVideo) + getLiveVideo ) liveRouter.put('/live/:videoId', @@ -57,7 +57,7 @@ export { // --------------------------------------------------------------------------- -async function getLiveVideo (req: express.Request, res: express.Response) { +function getLiveVideo (req: express.Request, res: express.Response) { const videoLive = res.locals.videoLive return res.json(videoLive.toFormattedJSON()) diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts index 830625cc6..a99c9ee7c 100644 --- a/server/helpers/ffmpeg-utils.ts +++ b/server/helpers/ffmpeg-utils.ts @@ -474,7 +474,7 @@ async function buildHLSVODCommand (command: ffmpeg.FfmpegCommand, options: HLSTr return command } -async function buildHLSVODFromTSCommand (command: ffmpeg.FfmpegCommand, options: HLSFromTSTranscodeOptions) { +function buildHLSVODFromTSCommand (command: ffmpeg.FfmpegCommand, options: HLSFromTSTranscodeOptions) { const videoPath = getHLSVideoPath(options) command.outputOption('-c copy') diff --git a/server/lib/auth/oauth.ts b/server/lib/auth/oauth.ts index 5b6130d56..a97681c86 100644 --- a/server/lib/auth/oauth.ts +++ b/server/lib/auth/oauth.ts @@ -81,7 +81,7 @@ async function handleOAuthToken (req: express.Request, options: { refreshTokenAu }) } -async function handleOAuthAuthenticate ( +function handleOAuthAuthenticate ( req: express.Request, res: express.Response, authenticateInQuery = false diff --git a/server/lib/live/shared/muxing-session.ts b/server/lib/live/shared/muxing-session.ts index 9b5b6c4fc..0c9fb0cb6 100644 --- a/server/lib/live/shared/muxing-session.ts +++ b/server/lib/live/shared/muxing-session.ts @@ -199,7 +199,7 @@ class MuxingSession extends EventEmitter { private watchMasterFile (outPath: string) { this.masterWatcher = chokidar.watch(outPath + '/' + this.streamingPlaylist.playlistFilename) - this.masterWatcher.on('add', async () => { + this.masterWatcher.on('add', () => { this.emit('master-playlist-created', { videoId: this.videoId }) this.masterWatcher.close() diff --git a/server/lib/moderation.ts b/server/lib/moderation.ts index a42ab5b7f..456b615b2 100644 --- a/server/lib/moderation.ts +++ b/server/lib/moderation.ts @@ -170,8 +170,8 @@ function createAccountAbuse (options: { }) { const { baseAbuse, accountInstance, transaction, reporterAccount } = options - const associateFun = async () => { - return { isOwned: accountInstance.isOwned() } + const associateFun = () => { + return Promise.resolve({ isOwned: accountInstance.isOwned() }) } return createAbuse({ diff --git a/server/lib/notifier/shared/follow/auto-follow-for-instance.ts b/server/lib/notifier/shared/follow/auto-follow-for-instance.ts index 16cc62984..01d2b3563 100644 --- a/server/lib/notifier/shared/follow/auto-follow-for-instance.ts +++ b/server/lib/notifier/shared/follow/auto-follow-for-instance.ts @@ -35,7 +35,7 @@ export class AutoFollowForInstance extends AbstractNotification { return notification } - async createEmail (to: string) { + createEmail (to: string) { const awaitingApproval = this.actorFollow.state === 'pending' ? ' awaiting manual approval.' : '' diff --git a/server/lib/notifier/shared/follow/follow-for-user.ts b/server/lib/notifier/shared/follow/follow-for-user.ts index 2d0f675a8..e579d4487 100644 --- a/server/lib/notifier/shared/follow/follow-for-user.ts +++ b/server/lib/notifier/shared/follow/follow-for-user.ts @@ -56,7 +56,7 @@ export class FollowForUser extends AbstractNotification { return notification } - async createEmail (to: string) { + createEmail (to: string) { const following = this.actorFollow.ActorFollowing const follower = this.actorFollow.ActorFollower diff --git a/server/lib/notifier/shared/instance/new-peertube-version-for-admins.ts b/server/lib/notifier/shared/instance/new-peertube-version-for-admins.ts index ab5bfb1ac..6b5ac808a 100644 --- a/server/lib/notifier/shared/instance/new-peertube-version-for-admins.ts +++ b/server/lib/notifier/shared/instance/new-peertube-version-for-admins.ts @@ -41,7 +41,7 @@ export class NewPeerTubeVersionForAdmins extends AbstractNotification { return notification } - async createEmail (to: string) { + createEmail (to: string) { const pluginUrl = WEBSERVER.URL + '/admin/plugins/list-installed?pluginType=' + this.plugin.type return { diff --git a/server/lib/notifier/shared/instance/registration-for-moderators.ts b/server/lib/notifier/shared/instance/registration-for-moderators.ts index 4deb5a2cc..2a48ef2fa 100644 --- a/server/lib/notifier/shared/instance/registration-for-moderators.ts +++ b/server/lib/notifier/shared/instance/registration-for-moderators.ts @@ -36,7 +36,7 @@ export class RegistrationForModerators extends AbstractNotification { +const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = (options: EncoderOptionsBuilderParams) => { const { fps, inputRatio, inputBitrate } = options if (!fps) return { outputOptions: [ ] } @@ -30,7 +30,7 @@ const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = async (options: Enco } } -const defaultX264LiveOptionsBuilder: EncoderOptionsBuilder = async (options: EncoderOptionsBuilderParams) => { +const defaultX264LiveOptionsBuilder: EncoderOptionsBuilder = (options: EncoderOptionsBuilderParams) => { const { streamNum, fps, inputBitrate, inputRatio } = options const targetBitrate = capBitrate(inputBitrate, getAverageBitrate({ ...options, fps, ratio: inputRatio })) diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index 52aae3d2c..488109b7a 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts @@ -407,7 +407,7 @@ function getYoutubeDLInfo (youtubeDL: any, url: string, args: string[]) { return new Promise((res, rej) => { const options = [ '-j', '--flat-playlist', '--playlist-reverse', ...args ] - youtubeDL.getInfo(url, options, processOptions, async (err, info) => { + youtubeDL.getInfo(url, options, processOptions, (err, info) => { if (err) return rej(err) return res(info) -- cgit v1.2.3