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 | |
parent | 851675c5591dcab1070183f0ed1b1a788de07d2c (diff) | |
download | PeerTube-98ab5dc81048d47d08a231f17698128f959e59b2.tar.gz PeerTube-98ab5dc81048d47d08a231f17698128f959e59b2.tar.zst PeerTube-98ab5dc81048d47d08a231f17698128f959e59b2.zip |
Remove useless async
35 files changed, 49 insertions, 43 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index 042254c95..a49a9e71b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json | |||
@@ -89,6 +89,10 @@ | |||
89 | "@typescript-eslint/no-empty-interface": "off", | 89 | "@typescript-eslint/no-empty-interface": "off", |
90 | "@typescript-eslint/no-extraneous-class": "off", | 90 | "@typescript-eslint/no-extraneous-class": "off", |
91 | "@typescript-eslint/no-use-before-define": "off", | 91 | "@typescript-eslint/no-use-before-define": "off", |
92 | |||
93 | "require-await": "off", | ||
94 | "@typescript-eslint/require-await": "error", | ||
95 | |||
92 | // bugged but useful | 96 | // bugged but useful |
93 | "@typescript-eslint/restrict-plus-operands": "off" | 97 | "@typescript-eslint/restrict-plus-operands": "off" |
94 | }, | 98 | }, |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index be1a99289..f13fe4bf9 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -260,7 +260,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
260 | this.loadCategoriesAndLanguages() | 260 | this.loadCategoriesAndLanguages() |
261 | } | 261 | } |
262 | 262 | ||
263 | async formValidated () { | 263 | formValidated () { |
264 | const value: ComponentCustomConfig = this.form.getRawValue() | 264 | const value: ComponentCustomConfig = this.form.getRawValue() |
265 | 265 | ||
266 | forkJoin([ | 266 | forkJoin([ |
diff --git a/client/src/app/+admin/follows/following-list/follow-modal.component.ts b/client/src/app/+admin/follows/following-list/follow-modal.component.ts index c55fc8d81..c40b36e10 100644 --- a/client/src/app/+admin/follows/following-list/follow-modal.component.ts +++ b/client/src/app/+admin/follows/following-list/follow-modal.component.ts | |||
@@ -54,7 +54,7 @@ export class FollowModalComponent extends FormReactive implements OnInit { | |||
54 | return window.location.protocol === 'https:' | 54 | return window.location.protocol === 'https:' |
55 | } | 55 | } |
56 | 56 | ||
57 | private async addFollowing () { | 57 | private addFollowing () { |
58 | const hostsOrHandles = splitAndGetNotEmpty(this.form.value['hostsOrHandles']) | 58 | const hostsOrHandles = splitAndGetNotEmpty(this.form.value['hostsOrHandles']) |
59 | 59 | ||
60 | this.followService.follow(hostsOrHandles) | 60 | this.followService.follow(hostsOrHandles) |
diff --git a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts index 512ceffd9..c09ce7293 100644 --- a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts +++ b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts | |||
@@ -134,7 +134,7 @@ export class VideoCommentListComponent extends RestTable implements OnInit { | |||
134 | }) | 134 | }) |
135 | } | 135 | } |
136 | 136 | ||
137 | private async removeComments (comments: VideoCommentAdmin[]) { | 137 | private removeComments (comments: VideoCommentAdmin[]) { |
138 | const commentArgs = comments.map(c => ({ videoId: c.video.id, commentId: c.id })) | 138 | const commentArgs = comments.map(c => ({ videoId: c.video.id, commentId: c.id })) |
139 | 139 | ||
140 | this.videoCommentService.deleteVideoComments(commentArgs) | 140 | this.videoCommentService.deleteVideoComments(commentArgs) |
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 39caf5ed5..1030759df 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts | |||
@@ -206,7 +206,7 @@ export class UserListComponent extends RestTable implements OnInit { | |||
206 | }) | 206 | }) |
207 | } | 207 | } |
208 | 208 | ||
209 | async setEmailsAsVerified (users: User[]) { | 209 | setEmailsAsVerified (users: User[]) { |
210 | this.userService.updateUsers(users, { emailVerified: true }) | 210 | this.userService.updateUsers(users, { emailVerified: true }) |
211 | .subscribe({ | 211 | .subscribe({ |
212 | next: () => { | 212 | next: () => { |
diff --git a/client/src/app/+home/home.component.ts b/client/src/app/+home/home.component.ts index 6e0c96760..f966a2b02 100644 --- a/client/src/app/+home/home.component.ts +++ b/client/src/app/+home/home.component.ts | |||
@@ -15,7 +15,7 @@ export class HomeComponent implements OnInit { | |||
15 | private customPageService: CustomPageService | 15 | private customPageService: CustomPageService |
16 | ) { } | 16 | ) { } |
17 | 17 | ||
18 | async ngOnInit () { | 18 | ngOnInit () { |
19 | this.customPageService.getInstanceHomepage() | 19 | this.customPageService.getInstanceHomepage() |
20 | .subscribe(({ content }) => this.homepageContent = content) | 20 | .subscribe(({ content }) => this.homepageContent = content) |
21 | } | 21 | } |
diff --git a/client/src/app/+search/search.component.ts b/client/src/app/+search/search.component.ts index 81d1006f8..fcf6ebbec 100644 --- a/client/src/app/+search/search.component.ts +++ b/client/src/app/+search/search.component.ts | |||
@@ -75,7 +75,7 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
75 | 75 | ||
76 | this.subActivatedRoute = this.route.queryParams | 76 | this.subActivatedRoute = this.route.queryParams |
77 | .subscribe({ | 77 | .subscribe({ |
78 | next: async queryParams => { | 78 | next: queryParams => { |
79 | const querySearch = queryParams['search'] | 79 | const querySearch = queryParams['search'] |
80 | const searchTarget = queryParams['searchTarget'] | 80 | const searchTarget = queryParams['searchTarget'] |
81 | 81 | ||
diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts index 98d66ff00..5c4152884 100644 --- a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts | |||
@@ -71,7 +71,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni | |||
71 | return languageId && this.existingCaptions.includes(languageId) | 71 | return languageId && this.existingCaptions.includes(languageId) |
72 | } | 72 | } |
73 | 73 | ||
74 | async addCaption () { | 74 | addCaption () { |
75 | const languageId = this.form.value['language'] | 75 | const languageId = this.form.value['language'] |
76 | const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId) | 76 | const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId) |
77 | 77 | ||
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts index 366c93a79..bf7fdeeed 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts | |||
@@ -231,7 +231,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
231 | this.sortVideoCaptions() | 231 | this.sortVideoCaptions() |
232 | } | 232 | } |
233 | 233 | ||
234 | async deleteCaption (caption: VideoCaptionEdit) { | 234 | deleteCaption (caption: VideoCaptionEdit) { |
235 | // Caption recovers his former state | 235 | // Caption recovers his former state |
236 | if (caption.action && this.initialVideoCaptions.includes(caption.language.id)) { | 236 | if (caption.action && this.initialVideoCaptions.includes(caption.language.id)) { |
237 | caption.action = undefined | 237 | caption.action = undefined |
diff --git a/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts index ef5c8ed87..b1e8bf989 100644 --- a/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts +++ b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts | |||
@@ -21,8 +21,9 @@ export class PrivacyConcernsComponent implements OnInit { | |||
21 | private serverService: ServerService | 21 | private serverService: ServerService |
22 | ) { } | 22 | ) { } |
23 | 23 | ||
24 | async ngOnInit () { | 24 | ngOnInit () { |
25 | this.serverConfig = this.serverService.getHTMLConfig() | 25 | this.serverConfig = this.serverService.getHTMLConfig() |
26 | |||
26 | if ( | 27 | if ( |
27 | isWebRTCDisabled() || | 28 | isWebRTCDisabled() || |
28 | this.serverConfig.tracker.enabled === false || | 29 | this.serverConfig.tracker.enabled === false || |
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index 2007bdecb..acfd46a41 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -113,7 +113,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
113 | return this.userService.getAnonymousUser() | 113 | return this.userService.getAnonymousUser() |
114 | } | 114 | } |
115 | 115 | ||
116 | async ngOnInit () { | 116 | ngOnInit () { |
117 | this.serverConfig = this.serverService.getHTMLConfig() | 117 | this.serverConfig = this.serverService.getHTMLConfig() |
118 | 118 | ||
119 | PeertubePlayerManager.initState() | 119 | PeertubePlayerManager.initState() |
@@ -640,7 +640,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
640 | } | 640 | } |
641 | 641 | ||
642 | if (oldVideo && oldVideo.id !== newVideo.id) { | 642 | if (oldVideo && oldVideo.id !== newVideo.id) { |
643 | await this.peertubeSocket.unsubscribeLiveVideos(oldVideo.id) | 643 | this.peertubeSocket.unsubscribeLiveVideos(oldVideo.id) |
644 | } | 644 | } |
645 | 645 | ||
646 | if (!newVideo.isLive) return | 646 | if (!newVideo.isLive) return |
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 4d5a9f75f..ae6046cc1 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts | |||
@@ -220,7 +220,7 @@ export class AppComponent implements OnInit, AfterViewInit { | |||
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
223 | private async openModalsIfNeeded () { | 223 | private openModalsIfNeeded () { |
224 | this.authService.userInformationLoaded | 224 | this.authService.userInformationLoaded |
225 | .pipe( | 225 | .pipe( |
226 | map(() => this.authService.getUser()), | 226 | map(() => this.authService.getUser()), |
@@ -232,7 +232,7 @@ export class AppComponent implements OnInit, AfterViewInit { | |||
232 | ).subscribe(({ serverConfig, user }) => this._openAdminModalsIfNeeded(serverConfig, user)) | 232 | ).subscribe(({ serverConfig, user }) => this._openAdminModalsIfNeeded(serverConfig, user)) |
233 | } | 233 | } |
234 | 234 | ||
235 | private async _openAdminModalsIfNeeded (serverConfig: ServerConfig, user: User) { | 235 | private _openAdminModalsIfNeeded (serverConfig: ServerConfig, user: User) { |
236 | if (user.noWelcomeModal !== true) return this.welcomeModal.show() | 236 | if (user.noWelcomeModal !== true) return this.welcomeModal.show() |
237 | 237 | ||
238 | if (user.noInstanceConfigWarningModal === true || !serverConfig.signup.allowed) return | 238 | if (user.noInstanceConfigWarningModal === true || !serverConfig.signup.allowed) return |
diff --git a/client/src/app/core/notification/peertube-socket.service.ts b/client/src/app/core/notification/peertube-socket.service.ts index eab1c63f2..50d5df68f 100644 --- a/client/src/app/core/notification/peertube-socket.service.ts +++ b/client/src/app/core/notification/peertube-socket.service.ts | |||
@@ -38,7 +38,7 @@ export class PeerTubeSocket { | |||
38 | this.liveVideosSocket.emit('subscribe', { videoId }) | 38 | this.liveVideosSocket.emit('subscribe', { videoId }) |
39 | } | 39 | } |
40 | 40 | ||
41 | async unsubscribeLiveVideos (videoId: number) { | 41 | unsubscribeLiveVideos (videoId: number) { |
42 | if (!this.liveVideosSocket) return | 42 | if (!this.liveVideosSocket) return |
43 | 43 | ||
44 | this.liveVideosSocket.emit('unsubscribe', { videoId }) | 44 | this.liveVideosSocket.emit('unsubscribe', { videoId }) |
diff --git a/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts b/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts index ccb0c5262..2600da8da 100644 --- a/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts +++ b/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts | |||
@@ -49,7 +49,7 @@ export class ModerationCommentModalComponent extends FormReactive implements OnI | |||
49 | this.form.reset() | 49 | this.form.reset() |
50 | } | 50 | } |
51 | 51 | ||
52 | async banUser () { | 52 | banUser () { |
53 | const moderationComment: string = this.form.value['moderationComment'] | 53 | const moderationComment: string = this.form.value['moderationComment'] |
54 | 54 | ||
55 | this.abuseService.updateAbuse(this.abuseToComment, { moderationComment }) | 55 | this.abuseService.updateAbuse(this.abuseToComment, { moderationComment }) |
diff --git a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts index e7e34ce1e..a8cc9b593 100644 --- a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts +++ b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts | |||
@@ -84,8 +84,9 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy { | |||
84 | 84 | ||
85 | this.modalService.open(this.modal, { | 85 | this.modalService.open(this.modal, { |
86 | centered: true, | 86 | centered: true, |
87 | beforeDismiss: async () => { | 87 | beforeDismiss: () => { |
88 | this.onModalDismiss() | 88 | this.onModalDismiss() |
89 | |||
89 | return true | 90 | return true |
90 | } | 91 | } |
91 | }) | 92 | }) |
diff --git a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts index 0a2d5e93a..a03bd7286 100644 --- a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts +++ b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts | |||
@@ -43,7 +43,7 @@ export class UserBanModalComponent extends FormReactive implements OnInit { | |||
43 | this.openedModal.close() | 43 | this.openedModal.close() |
44 | } | 44 | } |
45 | 45 | ||
46 | async banUser () { | 46 | banUser () { |
47 | const reason = this.form.value['reason'] || undefined | 47 | const reason = this.form.value['reason'] || undefined |
48 | 48 | ||
49 | this.userService.banUsers(this.usersToBan, reason) | 49 | this.userService.banUsers(this.usersToBan, reason) |
diff --git a/client/src/assets/player/stats/stats-card.ts b/client/src/assets/player/stats/stats-card.ts index a32f6fb97..45fd30d55 100644 --- a/client/src/assets/player/stats/stats-card.ts +++ b/client/src/assets/player/stats/stats-card.ts | |||
@@ -86,7 +86,7 @@ class StatsCard extends Component { | |||
86 | this.updateInterval = setInterval(async () => { | 86 | this.updateInterval = setInterval(async () => { |
87 | try { | 87 | try { |
88 | const options = this.mode === 'p2p-media-loader' | 88 | const options = this.mode === 'p2p-media-loader' |
89 | ? await this.buildHLSOptions() | 89 | ? this.buildHLSOptions() |
90 | : await this.buildWebTorrentOptions() // Default | 90 | : await this.buildWebTorrentOptions() // Default |
91 | 91 | ||
92 | this.list.innerHTML = this.getListTemplate(options) | 92 | this.list.innerHTML = this.getListTemplate(options) |
@@ -102,7 +102,7 @@ class StatsCard extends Component { | |||
102 | this.container.style.display = 'none' | 102 | this.container.style.display = 'none' |
103 | } | 103 | } |
104 | 104 | ||
105 | private async buildHLSOptions () { | 105 | private buildHLSOptions () { |
106 | const p2pMediaLoader = this.player_.p2pMediaLoader() | 106 | const p2pMediaLoader = this.player_.p2pMediaLoader() |
107 | const level = p2pMediaLoader.getCurrentLevel() | 107 | const level = p2pMediaLoader.getCurrentLevel() |
108 | 108 | ||
diff --git a/client/src/assets/player/webtorrent/peertube-chunk-store.ts b/client/src/assets/player/webtorrent/peertube-chunk-store.ts index 93ca8e1d8..81378c277 100644 --- a/client/src/assets/player/webtorrent/peertube-chunk-store.ts +++ b/client/src/assets/player/webtorrent/peertube-chunk-store.ts | |||
@@ -184,7 +184,7 @@ export class PeertubeChunkStore extends EventEmitter { | |||
184 | private runCleaner () { | 184 | private runCleaner () { |
185 | this.checkExpiration() | 185 | this.checkExpiration() |
186 | 186 | ||
187 | this.cleanerInterval = setInterval(async () => { | 187 | this.cleanerInterval = setInterval(() => { |
188 | this.checkExpiration() | 188 | this.checkExpiration() |
189 | }, PeertubeChunkStore.CLEANER_INTERVAL_MS) | 189 | }, PeertubeChunkStore.CLEANER_INTERVAL_MS) |
190 | } | 190 | } |
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index f35f4a23a..36480922e 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts | |||
@@ -589,7 +589,7 @@ export class PeerTubeEmbed { | |||
589 | 589 | ||
590 | this.buildCSS() | 590 | this.buildCSS() |
591 | 591 | ||
592 | await this.buildDock(videoInfo) | 592 | this.buildDock(videoInfo) |
593 | 593 | ||
594 | this.initializeApi() | 594 | this.initializeApi() |
595 | 595 | ||
@@ -665,7 +665,7 @@ export class PeerTubeEmbed { | |||
665 | } | 665 | } |
666 | } | 666 | } |
667 | 667 | ||
668 | private async buildDock (videoInfo: VideoDetails) { | 668 | private buildDock (videoInfo: VideoDetails) { |
669 | if (!this.controls) return | 669 | if (!this.controls) return |
670 | 670 | ||
671 | // On webtorrent fallback, player may have been disposed | 671 | // On webtorrent fallback, player may have been disposed |
diff --git a/client/src/standalone/videos/test-embed.ts b/client/src/standalone/videos/test-embed.ts index a051f1f89..301c95d7b 100644 --- a/client/src/standalone/videos/test-embed.ts +++ b/client/src/standalone/videos/test-embed.ts | |||
@@ -47,7 +47,7 @@ window.addEventListener('load', async () => { | |||
47 | let playbackRates: number[] = [] | 47 | let playbackRates: number[] = [] |
48 | let currentRate = await player.getPlaybackRate() | 48 | let currentRate = await player.getPlaybackRate() |
49 | 49 | ||
50 | const updateRates = async () => { | 50 | const updateRates = () => { |
51 | const rateListEl = document.querySelector('#rate-list') | 51 | const rateListEl = document.querySelector('#rate-list') |
52 | rateListEl.innerHTML = '' | 52 | rateListEl.innerHTML = '' |
53 | 53 | ||
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) |