ActivityPub-federated video streaming platform using P2P directly in your web browser
Remove useless async
Chocobozzz98ab5dc81048
diff --git a/.eslintrc.json b/.eslintrc.jsonindex 042254c95a..a49a9e71b4 100644--- a/.eslintrc.json+++ b/.eslintrc.json@@ -89,6 +89,10 @@"@typescript-eslint/no-empty-interface": "off","@typescript-eslint/no-extraneous-class": "off","@typescript-eslint/no-use-before-define": "off",++ "require-await": "off",+ "@typescript-eslint/require-await": "error",+// bugged but useful"@typescript-eslint/restrict-plus-operands": "off"},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.tsindex be1a992894..f13fe4bf94 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 {this.loadCategoriesAndLanguages()}- async formValidated () {+ formValidated () {const value: ComponentCustomConfig = this.form.getRawValue()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.tsindex c55fc8d81f..c40b36e101 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 {return window.location.protocol === 'https:'}- private async addFollowing () {+ private addFollowing () {const hostsOrHandles = splitAndGetNotEmpty(this.form.value['hostsOrHandles'])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.tsindex 512ceffd98..c09ce72930 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 {})}- private async removeComments (comments: VideoCommentAdmin[]) {+ private removeComments (comments: VideoCommentAdmin[]) {const commentArgs = comments.map(c => ({ videoId: c.video.id, commentId: c.id }))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.tsindex 39caf5ed51..1030759df5 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 {})}- async setEmailsAsVerified (users: User[]) {+ setEmailsAsVerified (users: User[]) {this.userService.updateUsers(users, { emailVerified: true }).subscribe({next: () => {diff --git a/client/src/app/+home/home.component.ts b/client/src/app/+home/home.component.tsindex 6e0c96760b..f966a2b024 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 {private customPageService: CustomPageService) { }- async ngOnInit () {+ ngOnInit () {this.customPageService.getInstanceHomepage().subscribe(({ content }) => this.homepageContent = content)}diff --git a/client/src/app/+search/search.component.ts b/client/src/app/+search/search.component.tsindex 81d1006f8e..fcf6ebbec7 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 {this.subActivatedRoute = this.route.queryParams.subscribe({- next: async queryParams => {+ next: queryParams => {const querySearch = queryParams['search']const searchTarget = queryParams['searchTarget']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.tsindex 98d66ff00d..5c4152884a 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 OnInireturn languageId && this.existingCaptions.includes(languageId)}- async addCaption () {+ addCaption () {const languageId = this.form.value['language']const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId)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.tsindex 366c93a793..bf7fdeeed4 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 {this.sortVideoCaptions()}- async deleteCaption (caption: VideoCaptionEdit) {+ deleteCaption (caption: VideoCaptionEdit) {// Caption recovers his former stateif (caption.action && this.initialVideoCaptions.includes(caption.language.id)) {caption.action = undefineddiff --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.tsindex ef5c8ed876..b1e8bf989e 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 {private serverService: ServerService) { }- async ngOnInit () {+ ngOnInit () {this.serverConfig = this.serverService.getHTMLConfig()+if (isWebRTCDisabled() ||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.tsindex 2007bdecbd..acfd46a41a 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 {return this.userService.getAnonymousUser()}- async ngOnInit () {+ ngOnInit () {this.serverConfig = this.serverService.getHTMLConfig()PeertubePlayerManager.initState()@@ -640,7 +640,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {}if (oldVideo && oldVideo.id !== newVideo.id) {- await this.peertubeSocket.unsubscribeLiveVideos(oldVideo.id)+ this.peertubeSocket.unsubscribeLiveVideos(oldVideo.id)}if (!newVideo.isLive) returndiff --git a/client/src/app/app.component.ts b/client/src/app/app.component.tsindex 4d5a9f75f0..ae6046cc1f 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 {}}- private async openModalsIfNeeded () {+ private openModalsIfNeeded () {this.authService.userInformationLoaded.pipe(map(() => this.authService.getUser()),@@ -232,7 +232,7 @@ export class AppComponent implements OnInit, AfterViewInit {).subscribe(({ serverConfig, user }) => this._openAdminModalsIfNeeded(serverConfig, user))}- private async _openAdminModalsIfNeeded (serverConfig: ServerConfig, user: User) {+ private _openAdminModalsIfNeeded (serverConfig: ServerConfig, user: User) {if (user.noWelcomeModal !== true) return this.welcomeModal.show()if (user.noInstanceConfigWarningModal === true || !serverConfig.signup.allowed) returndiff --git a/client/src/app/core/notification/peertube-socket.service.ts b/client/src/app/core/notification/peertube-socket.service.tsindex eab1c63f24..50d5df68f4 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 {this.liveVideosSocket.emit('subscribe', { videoId })}- async unsubscribeLiveVideos (videoId: number) {+ unsubscribeLiveVideos (videoId: number) {if (!this.liveVideosSocket) returnthis.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.tsindex ccb0c5262a..2600da8dad 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 OnIthis.form.reset()}- async banUser () {+ banUser () {const moderationComment: string = this.form.value['moderationComment']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.tsindex e7e34ce1ed..a8cc9b593f 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 {this.modalService.open(this.modal, {centered: true,- beforeDismiss: async () => {+ beforeDismiss: () => {this.onModalDismiss()+return true}})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.tsindex 0a2d5e93a4..a03bd72867 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 {this.openedModal.close()}- async banUser () {+ banUser () {const reason = this.form.value['reason'] || undefinedthis.userService.banUsers(this.usersToBan, reason)diff --git a/client/src/assets/player/stats/stats-card.ts b/client/src/assets/player/stats/stats-card.tsindex a32f6fb979..45fd30d552 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 {this.updateInterval = setInterval(async () => {try {const options = this.mode === 'p2p-media-loader'- ? await this.buildHLSOptions()+ ? this.buildHLSOptions(): await this.buildWebTorrentOptions() // Defaultthis.list.innerHTML = this.getListTemplate(options)@@ -102,7 +102,7 @@ class StatsCard extends Component {this.container.style.display = 'none'}- private async buildHLSOptions () {+ private buildHLSOptions () {const p2pMediaLoader = this.player_.p2pMediaLoader()const level = p2pMediaLoader.getCurrentLevel()diff --git a/client/src/assets/player/webtorrent/peertube-chunk-store.ts b/client/src/assets/player/webtorrent/peertube-chunk-store.tsindex 93ca8e1d84..81378c2777 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 {private runCleaner () {this.checkExpiration()- this.cleanerInterval = setInterval(async () => {+ this.cleanerInterval = setInterval(() => {this.checkExpiration()}, PeertubeChunkStore.CLEANER_INTERVAL_MS)}diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.tsindex f35f4a23ab..36480922ec 100644--- a/client/src/standalone/videos/embed.ts+++ b/client/src/standalone/videos/embed.ts@@ -589,7 +589,7 @@ export class PeerTubeEmbed {this.buildCSS()- await this.buildDock(videoInfo)+ this.buildDock(videoInfo)this.initializeApi()@@ -665,7 +665,7 @@ export class PeerTubeEmbed {}}- private async buildDock (videoInfo: VideoDetails) {+ private buildDock (videoInfo: VideoDetails) {if (!this.controls) return// On webtorrent fallback, player may have been disposeddiff --git a/client/src/standalone/videos/test-embed.ts b/client/src/standalone/videos/test-embed.tsindex a051f1f89d..301c95d7b5 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 () => {let playbackRates: number[] = []let currentRate = await player.getPlaybackRate()- const updateRates = async () => {+ const updateRates = () => {const rateListEl = document.querySelector('#rate-list')rateListEl.innerHTML = ''diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.tsindex 7bdb337370..a0c6601d94 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.videoChannelif (videoChannel.isOutdated()) {diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.tsindex 49490f79b1..10833d48bf 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.videoAPIif (video.isOutdated()) {diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.tsindex ed4da8f479..151ff354b7 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.videoLivereturn res.json(videoLive.toFormattedJSON())diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.tsindex 830625cc61..a99c9ee7c7 100644--- a/server/helpers/ffmpeg-utils.ts+++ b/server/helpers/ffmpeg-utils.ts@@ -474,7 +474,7 @@ async function buildHLSVODCommand (command: ffmpeg.FfmpegCommand, options: HLSTrreturn 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.tsindex 5b6130d567..a97681c86b 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 = falsediff --git a/server/lib/live/shared/muxing-session.ts b/server/lib/live/shared/muxing-session.tsindex 9b5b6c4fc9..0c9fb0cb63 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.tsindex a42ab5b7ff..456b615b22 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.tsindex 16cc62984d..01d2b35631 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 <MActorFollowFulreturn notification}- async createEmail (to: string) {+ createEmail (to: string) {const instanceUrl = this.actorFollow.ActorFollowing.urlreturn {diff --git a/server/lib/notifier/shared/follow/follow-for-instance.ts b/server/lib/notifier/shared/follow/follow-for-instance.tsindex 9ab269cf10..a4a2fbf537 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> {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.tsindex 2d0f675a82..e579d44877 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> {return notification}- async createEmail (to: string) {+ createEmail (to: string) {const following = this.actorFollow.ActorFollowingconst follower = this.actorFollow.ActorFollowerdiff --git a/server/lib/notifier/shared/instance/new-peertube-version-for-admins.ts b/server/lib/notifier/shared/instance/new-peertube-version-for-admins.tsindex ab5bfb1acb..6b5ac808a0 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 <NewPeerTureturn notification}- async createEmail (to: string) {+ createEmail (to: string) {return {to,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.tsindex e5e456a702..874b10a3de 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> {return notification}- async createEmail (to: string) {+ createEmail (to: string) {const pluginUrl = WEBSERVER.URL + '/admin/plugins/list-installed?pluginType=' + this.plugin.typereturn {diff --git a/server/lib/notifier/shared/instance/registration-for-moderators.ts b/server/lib/notifier/shared/instance/registration-for-moderators.tsindex 4deb5a2cce..2a48ef2fa5 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 <MUserDefaulreturn notification}- async createEmail (to: string) {+ createEmail (to: string) {return {template: 'user-registered',to,diff --git a/server/lib/transcoding/video-transcoding-profiles.ts b/server/lib/transcoding/video-transcoding-profiles.tsindex bca6dfccd0..a8176dca56 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* * https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate*/-const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = async (options: EncoderOptionsBuilderParams) => {+const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = (options: EncoderOptionsBuilderParams) => {const { fps, inputRatio, inputBitrate } = optionsif (!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 } = optionsconst targetBitrate = capBitrate(inputBitrate, getAverageBitrate({ ...options, fps, ratio: inputRatio }))diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.tsindex 52aae3d2c3..488109b7a7 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<any>((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)