diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-25 16:14:11 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-26 10:01:42 +0200 |
commit | 98ab5dc81048d47d08a231f17698128f959e59b2 (patch) | |
tree | 7f74f835dc35d9f72918c56857f7f28b70d7053f /server | |
parent | 851675c5591dcab1070183f0ed1b1a788de07d2c (diff) | |
download | PeerTube-98ab5dc81048d47d08a231f17698128f959e59b2.tar.gz PeerTube-98ab5dc81048d47d08a231f17698128f959e59b2.tar.zst PeerTube-98ab5dc81048d47d08a231f17698128f959e59b2.zip |
Remove useless async
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/api/video-channel.ts | 4 | ||||
-rw-r--r-- | server/controllers/api/videos/index.ts | 4 | ||||
-rw-r--r-- | server/controllers/api/videos/live.ts | 4 | ||||
-rw-r--r-- | server/helpers/ffmpeg-utils.ts | 2 | ||||
-rw-r--r-- | server/lib/auth/oauth.ts | 2 | ||||
-rw-r--r-- | server/lib/live/shared/muxing-session.ts | 2 | ||||
-rw-r--r-- | server/lib/moderation.ts | 4 | ||||
-rw-r--r-- | server/lib/notifier/shared/follow/auto-follow-for-instance.ts | 2 | ||||
-rw-r--r-- | server/lib/notifier/shared/follow/follow-for-instance.ts | 2 | ||||
-rw-r--r-- | server/lib/notifier/shared/follow/follow-for-user.ts | 2 | ||||
-rw-r--r-- | server/lib/notifier/shared/instance/new-peertube-version-for-admins.ts | 2 | ||||
-rw-r--r-- | server/lib/notifier/shared/instance/new-plugin-version-for-admins.ts | 2 | ||||
-rw-r--r-- | server/lib/notifier/shared/instance/registration-for-moderators.ts | 2 | ||||
-rw-r--r-- | server/lib/transcoding/video-transcoding-profiles.ts | 4 | ||||
-rw-r--r-- | server/tools/peertube-import-videos.ts | 2 |
15 files changed, 20 insertions, 20 deletions
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', | |||
108 | 108 | ||
109 | videoChannelRouter.get('/:nameWithHost', | 109 | videoChannelRouter.get('/:nameWithHost', |
110 | asyncMiddleware(videoChannelsNameWithHostValidator), | 110 | asyncMiddleware(videoChannelsNameWithHostValidator), |
111 | asyncMiddleware(getVideoChannel) | 111 | getVideoChannel |
112 | ) | 112 | ) |
113 | 113 | ||
114 | videoChannelRouter.get('/:nameWithHost/video-playlists', | 114 | videoChannelRouter.get('/:nameWithHost/video-playlists', |
@@ -281,7 +281,7 @@ async function removeVideoChannel (req: express.Request, res: express.Response) | |||
281 | return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() | 281 | return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() |
282 | } | 282 | } |
283 | 283 | ||
284 | async function getVideoChannel (req: express.Request, res: express.Response) { | 284 | function getVideoChannel (req: express.Request, res: express.Response) { |
285 | const videoChannel = res.locals.videoChannel | 285 | const videoChannel = res.locals.videoChannel |
286 | 286 | ||
287 | if (videoChannel.isOutdated()) { | 287 | 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', | |||
102 | optionalAuthenticate, | 102 | optionalAuthenticate, |
103 | asyncMiddleware(videosCustomGetValidator('for-api')), | 103 | asyncMiddleware(videosCustomGetValidator('for-api')), |
104 | asyncMiddleware(checkVideoFollowConstraints), | 104 | asyncMiddleware(checkVideoFollowConstraints), |
105 | asyncMiddleware(getVideo) | 105 | getVideo |
106 | ) | 106 | ) |
107 | videosRouter.post('/:id/views', | 107 | videosRouter.post('/:id/views', |
108 | openapiOperationDoc({ operationId: 'addView' }), | 108 | openapiOperationDoc({ operationId: 'addView' }), |
@@ -141,7 +141,7 @@ function listVideoPrivacies (_req: express.Request, res: express.Response) { | |||
141 | res.json(VIDEO_PRIVACIES) | 141 | res.json(VIDEO_PRIVACIES) |
142 | } | 142 | } |
143 | 143 | ||
144 | async function getVideo (_req: express.Request, res: express.Response) { | 144 | function getVideo (_req: express.Request, res: express.Response) { |
145 | const video = res.locals.videoAPI | 145 | const video = res.locals.videoAPI |
146 | 146 | ||
147 | if (video.isOutdated()) { | 147 | 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', | |||
39 | liveRouter.get('/live/:videoId', | 39 | liveRouter.get('/live/:videoId', |
40 | authenticate, | 40 | authenticate, |
41 | asyncMiddleware(videoLiveGetValidator), | 41 | asyncMiddleware(videoLiveGetValidator), |
42 | asyncRetryTransactionMiddleware(getLiveVideo) | 42 | getLiveVideo |
43 | ) | 43 | ) |
44 | 44 | ||
45 | liveRouter.put('/live/:videoId', | 45 | liveRouter.put('/live/:videoId', |
@@ -57,7 +57,7 @@ export { | |||
57 | 57 | ||
58 | // --------------------------------------------------------------------------- | 58 | // --------------------------------------------------------------------------- |
59 | 59 | ||
60 | async function getLiveVideo (req: express.Request, res: express.Response) { | 60 | function getLiveVideo (req: express.Request, res: express.Response) { |
61 | const videoLive = res.locals.videoLive | 61 | const videoLive = res.locals.videoLive |
62 | 62 | ||
63 | return res.json(videoLive.toFormattedJSON()) | 63 | 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 | |||
474 | return command | 474 | return command |
475 | } | 475 | } |
476 | 476 | ||
477 | async function buildHLSVODFromTSCommand (command: ffmpeg.FfmpegCommand, options: HLSFromTSTranscodeOptions) { | 477 | function buildHLSVODFromTSCommand (command: ffmpeg.FfmpegCommand, options: HLSFromTSTranscodeOptions) { |
478 | const videoPath = getHLSVideoPath(options) | 478 | const videoPath = getHLSVideoPath(options) |
479 | 479 | ||
480 | command.outputOption('-c copy') | 480 | 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 | |||
81 | }) | 81 | }) |
82 | } | 82 | } |
83 | 83 | ||
84 | async function handleOAuthAuthenticate ( | 84 | function handleOAuthAuthenticate ( |
85 | req: express.Request, | 85 | req: express.Request, |
86 | res: express.Response, | 86 | res: express.Response, |
87 | authenticateInQuery = false | 87 | 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 { | |||
199 | private watchMasterFile (outPath: string) { | 199 | private watchMasterFile (outPath: string) { |
200 | this.masterWatcher = chokidar.watch(outPath + '/' + this.streamingPlaylist.playlistFilename) | 200 | this.masterWatcher = chokidar.watch(outPath + '/' + this.streamingPlaylist.playlistFilename) |
201 | 201 | ||
202 | this.masterWatcher.on('add', async () => { | 202 | this.masterWatcher.on('add', () => { |
203 | this.emit('master-playlist-created', { videoId: this.videoId }) | 203 | this.emit('master-playlist-created', { videoId: this.videoId }) |
204 | 204 | ||
205 | this.masterWatcher.close() | 205 | 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: { | |||
170 | }) { | 170 | }) { |
171 | const { baseAbuse, accountInstance, transaction, reporterAccount } = options | 171 | const { baseAbuse, accountInstance, transaction, reporterAccount } = options |
172 | 172 | ||
173 | const associateFun = async () => { | 173 | const associateFun = () => { |
174 | return { isOwned: accountInstance.isOwned() } | 174 | return Promise.resolve({ isOwned: accountInstance.isOwned() }) |
175 | } | 175 | } |
176 | 176 | ||
177 | return createAbuse({ | 177 | 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 <MActorFollowFul | |||
35 | return notification | 35 | return notification |
36 | } | 36 | } |
37 | 37 | ||
38 | async createEmail (to: string) { | 38 | createEmail (to: string) { |
39 | const instanceUrl = this.actorFollow.ActorFollowing.url | 39 | const instanceUrl = this.actorFollow.ActorFollowing.url |
40 | 40 | ||
41 | return { | 41 | return { |
diff --git a/server/lib/notifier/shared/follow/follow-for-instance.ts b/server/lib/notifier/shared/follow/follow-for-instance.ts index 9ab269cf1..a4a2fbf53 100644 --- a/server/lib/notifier/shared/follow/follow-for-instance.ts +++ b/server/lib/notifier/shared/follow/follow-for-instance.ts | |||
@@ -43,7 +43,7 @@ export class FollowForInstance extends AbstractNotification <MActorFollowFull> { | |||
43 | return notification | 43 | return notification |
44 | } | 44 | } |
45 | 45 | ||
46 | async createEmail (to: string) { | 46 | createEmail (to: string) { |
47 | const awaitingApproval = this.actorFollow.state === 'pending' | 47 | const awaitingApproval = this.actorFollow.state === 'pending' |
48 | ? ' awaiting manual approval.' | 48 | ? ' awaiting manual approval.' |
49 | : '' | 49 | : '' |
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 <MActorFollowFull> { | |||
56 | return notification | 56 | return notification |
57 | } | 57 | } |
58 | 58 | ||
59 | async createEmail (to: string) { | 59 | createEmail (to: string) { |
60 | const following = this.actorFollow.ActorFollowing | 60 | const following = this.actorFollow.ActorFollowing |
61 | const follower = this.actorFollow.ActorFollower | 61 | const follower = this.actorFollow.ActorFollower |
62 | 62 | ||
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 <NewPeerTu | |||
41 | return notification | 41 | return notification |
42 | } | 42 | } |
43 | 43 | ||
44 | async createEmail (to: string) { | 44 | createEmail (to: string) { |
45 | return { | 45 | return { |
46 | to, | 46 | to, |
47 | template: 'peertube-version-new', | 47 | template: 'peertube-version-new', |
diff --git a/server/lib/notifier/shared/instance/new-plugin-version-for-admins.ts b/server/lib/notifier/shared/instance/new-plugin-version-for-admins.ts index e5e456a70..874b10a3d 100644 --- a/server/lib/notifier/shared/instance/new-plugin-version-for-admins.ts +++ b/server/lib/notifier/shared/instance/new-plugin-version-for-admins.ts | |||
@@ -37,7 +37,7 @@ export class NewPluginVersionForAdmins extends AbstractNotification <MPlugin> { | |||
37 | return notification | 37 | return notification |
38 | } | 38 | } |
39 | 39 | ||
40 | async createEmail (to: string) { | 40 | createEmail (to: string) { |
41 | const pluginUrl = WEBSERVER.URL + '/admin/plugins/list-installed?pluginType=' + this.plugin.type | 41 | const pluginUrl = WEBSERVER.URL + '/admin/plugins/list-installed?pluginType=' + this.plugin.type |
42 | 42 | ||
43 | return { | 43 | 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 <MUserDefaul | |||
36 | return notification | 36 | return notification |
37 | } | 37 | } |
38 | 38 | ||
39 | async createEmail (to: string) { | 39 | createEmail (to: string) { |
40 | return { | 40 | return { |
41 | template: 'user-registered', | 41 | template: 'user-registered', |
42 | to, | 42 | to, |
diff --git a/server/lib/transcoding/video-transcoding-profiles.ts b/server/lib/transcoding/video-transcoding-profiles.ts index bca6dfccd..a8176dca5 100644 --- a/server/lib/transcoding/video-transcoding-profiles.ts +++ b/server/lib/transcoding/video-transcoding-profiles.ts | |||
@@ -14,7 +14,7 @@ import { canDoQuickAudioTranscode, ffprobePromise, getAudioStream, getMaxAudioBi | |||
14 | * * https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate | 14 | * * https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate |
15 | */ | 15 | */ |
16 | 16 | ||
17 | const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = async (options: EncoderOptionsBuilderParams) => { | 17 | const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = (options: EncoderOptionsBuilderParams) => { |
18 | const { fps, inputRatio, inputBitrate } = options | 18 | const { fps, inputRatio, inputBitrate } = options |
19 | if (!fps) return { outputOptions: [ ] } | 19 | if (!fps) return { outputOptions: [ ] } |
20 | 20 | ||
@@ -30,7 +30,7 @@ const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = async (options: Enco | |||
30 | } | 30 | } |
31 | } | 31 | } |
32 | 32 | ||
33 | const defaultX264LiveOptionsBuilder: EncoderOptionsBuilder = async (options: EncoderOptionsBuilderParams) => { | 33 | const defaultX264LiveOptionsBuilder: EncoderOptionsBuilder = (options: EncoderOptionsBuilderParams) => { |
34 | const { streamNum, fps, inputBitrate, inputRatio } = options | 34 | const { streamNum, fps, inputBitrate, inputRatio } = options |
35 | 35 | ||
36 | const targetBitrate = capBitrate(inputBitrate, getAverageBitrate({ ...options, fps, ratio: inputRatio })) | 36 | 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[]) { | |||
407 | return new Promise<any>((res, rej) => { | 407 | return new Promise<any>((res, rej) => { |
408 | const options = [ '-j', '--flat-playlist', '--playlist-reverse', ...args ] | 408 | const options = [ '-j', '--flat-playlist', '--playlist-reverse', ...args ] |
409 | 409 | ||
410 | youtubeDL.getInfo(url, options, processOptions, async (err, info) => { | 410 | youtubeDL.getInfo(url, options, processOptions, (err, info) => { |
411 | if (err) return rej(err) | 411 | if (err) return rej(err) |
412 | 412 | ||
413 | return res(info) | 413 | return res(info) |