From 41fb13c330de629df2d23379209e79c7af0f2e9a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 27 Aug 2021 14:32:44 +0200 Subject: esModuleInterop to true --- server/controllers/activitypub/client.ts | 4 ++-- server/controllers/activitypub/inbox.ts | 2 +- server/controllers/activitypub/index.ts | 2 +- server/controllers/activitypub/outbox.ts | 2 +- server/controllers/activitypub/utils.ts | 2 +- server/controllers/api/abuse.ts | 2 +- server/controllers/api/accounts.ts | 2 +- server/controllers/api/bulk.ts | 2 +- server/controllers/api/config.ts | 2 +- server/controllers/api/custom-page.ts | 2 +- server/controllers/api/index.ts | 6 +++--- server/controllers/api/jobs.ts | 2 +- server/controllers/api/oauth-clients.ts | 2 +- server/controllers/api/overviews.ts | 4 ++-- server/controllers/api/plugins.ts | 2 +- server/controllers/api/search/index.ts | 2 +- server/controllers/api/search/search-video-channels.ts | 2 +- server/controllers/api/search/search-video-playlists.ts | 2 +- server/controllers/api/search/search-videos.ts | 2 +- server/controllers/api/server/contact.ts | 2 +- server/controllers/api/server/debug.ts | 2 +- server/controllers/api/server/follows.ts | 2 +- server/controllers/api/server/index.ts | 2 +- server/controllers/api/server/logs.ts | 2 +- server/controllers/api/server/redundancy.ts | 2 +- server/controllers/api/server/server-blocklist.ts | 2 +- server/controllers/api/server/stats.ts | 2 +- server/controllers/api/users/index.ts | 4 ++-- server/controllers/api/users/me.ts | 2 +- server/controllers/api/users/my-abuses.ts | 2 +- server/controllers/api/users/my-blocklist.ts | 2 +- server/controllers/api/users/my-history.ts | 2 +- server/controllers/api/users/my-notifications.ts | 2 +- server/controllers/api/users/my-subscriptions.ts | 2 +- server/controllers/api/users/my-video-playlists.ts | 2 +- server/controllers/api/users/token.ts | 4 ++-- server/controllers/api/video-channel.ts | 2 +- server/controllers/api/video-playlist.ts | 2 +- server/controllers/api/videos/blacklist.ts | 2 +- server/controllers/api/videos/captions.ts | 2 +- server/controllers/api/videos/comment.ts | 2 +- server/controllers/api/videos/import.ts | 10 +++++----- server/controllers/api/videos/index.ts | 2 +- server/controllers/api/videos/live.ts | 2 +- server/controllers/api/videos/ownership.ts | 2 +- server/controllers/api/videos/rate.ts | 2 +- server/controllers/api/videos/update.ts | 2 +- server/controllers/api/videos/upload.ts | 2 +- server/controllers/api/videos/watching.ts | 2 +- server/controllers/bots.ts | 2 +- server/controllers/client.ts | 2 +- server/controllers/download.ts | 4 ++-- server/controllers/feeds.ts | 4 ++-- server/controllers/lazy-static.ts | 4 ++-- server/controllers/live.ts | 4 ++-- server/controllers/plugins.ts | 2 +- server/controllers/services.ts | 2 +- server/controllers/static.ts | 4 ++-- server/controllers/tracker.ts | 12 +++++------- server/controllers/webfinger.ts | 4 ++-- 60 files changed, 80 insertions(+), 82 deletions(-) (limited to 'server/controllers') diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index bef4bc068..c4e3cec6b 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts @@ -1,5 +1,5 @@ -import * as cors from 'cors' -import * as express from 'express' +import cors from 'cors' +import express from 'express' import { getServerActor } from '@server/models/application/application' import { MAccountId, MActorId, MChannelId, MVideoId } from '@server/types/models' import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos' diff --git a/server/controllers/activitypub/inbox.ts b/server/controllers/activitypub/inbox.ts index 30662990a..ece4edff0 100644 --- a/server/controllers/activitypub/inbox.ts +++ b/server/controllers/activitypub/inbox.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { InboxManager } from '@server/lib/activitypub/inbox-manager' import { Activity, ActivityPubCollection, ActivityPubOrderedCollection, RootActivity } from '../../../shared' import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' diff --git a/server/controllers/activitypub/index.ts b/server/controllers/activitypub/index.ts index 7e81902af..8c681820a 100644 --- a/server/controllers/activitypub/index.ts +++ b/server/controllers/activitypub/index.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { activityPubClientRouter } from './client' import { inboxRouter } from './inbox' import { outboxRouter } from './outbox' diff --git a/server/controllers/activitypub/outbox.ts b/server/controllers/activitypub/outbox.ts index 22328da7f..bdf9d138b 100644 --- a/server/controllers/activitypub/outbox.ts +++ b/server/controllers/activitypub/outbox.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { Activity } from '../../../shared/models/activitypub/activity' import { VideoPrivacy } from '../../../shared/models/videos' import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' diff --git a/server/controllers/activitypub/utils.ts b/server/controllers/activitypub/utils.ts index 19bdd58eb..f851ef652 100644 --- a/server/controllers/activitypub/utils.ts +++ b/server/controllers/activitypub/utils.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' function activityPubResponse (data: any, res: express.Response) { return res.type('application/activity+json; charset=utf-8') diff --git a/server/controllers/api/abuse.ts b/server/controllers/api/abuse.ts index e851365e9..72c418e74 100644 --- a/server/controllers/api/abuse.ts +++ b/server/controllers/api/abuse.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { logger } from '@server/helpers/logger' import { createAccountAbuse, createVideoAbuse, createVideoCommentAbuse } from '@server/lib/moderation' import { Notifier } from '@server/lib/notifier' diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts index 55e2aaf62..75679b0f4 100644 --- a/server/controllers/api/accounts.ts +++ b/server/controllers/api/accounts.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { pickCommonVideoQuery } from '@server/helpers/query' import { getServerActor } from '@server/models/application/application' import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' diff --git a/server/controllers/api/bulk.ts b/server/controllers/api/bulk.ts index 62121ece5..d27c3c73e 100644 --- a/server/controllers/api/bulk.ts +++ b/server/controllers/api/bulk.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { removeComment } from '@server/lib/video-comment' import { bulkRemoveCommentsOfValidator } from '@server/middlewares/validators/bulk' import { VideoCommentModel } from '@server/models/video/video-comment' diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index ee733a38c..d542f62aa 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { remove, writeJSON } from 'fs-extra' import { snakeCase } from 'lodash' import validator from 'validator' diff --git a/server/controllers/api/custom-page.ts b/server/controllers/api/custom-page.ts index 68d8c2ea4..d1c672f3f 100644 --- a/server/controllers/api/custom-page.ts +++ b/server/controllers/api/custom-page.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { ServerConfigManager } from '@server/lib/server-config-manager' import { ActorCustomPageModel } from '@server/models/account/actor-custom-page' import { HttpStatusCode, UserRight } from '@shared/models' diff --git a/server/controllers/api/index.ts b/server/controllers/api/index.ts index 93b14dadb..9949b378a 100644 --- a/server/controllers/api/index.ts +++ b/server/controllers/api/index.ts @@ -1,6 +1,6 @@ -import * as cors from 'cors' -import * as express from 'express' -import * as RateLimit from 'express-rate-limit' +import cors from 'cors' +import express from 'express' +import RateLimit from 'express-rate-limit' import { HttpStatusCode } from '../../../shared/models' import { badRequest } from '../../helpers/express-utils' import { CONFIG } from '../../initializers/config' diff --git a/server/controllers/api/jobs.ts b/server/controllers/api/jobs.ts index 9e333322b..7001674bb 100644 --- a/server/controllers/api/jobs.ts +++ b/server/controllers/api/jobs.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { ResultList } from '../../../shared' import { Job, JobState, JobType } from '../../../shared/models' import { UserRight } from '../../../shared/models/users' diff --git a/server/controllers/api/oauth-clients.ts b/server/controllers/api/oauth-clients.ts index f95f06864..4990fb0df 100644 --- a/server/controllers/api/oauth-clients.ts +++ b/server/controllers/api/oauth-clients.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { OAuthClientLocal } from '../../../shared' import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' import { logger } from '../../helpers/logger' diff --git a/server/controllers/api/overviews.ts b/server/controllers/api/overviews.ts index 2dfac15ef..5b16232e2 100644 --- a/server/controllers/api/overviews.ts +++ b/server/controllers/api/overviews.ts @@ -1,5 +1,5 @@ -import * as express from 'express' -import * as memoizee from 'memoizee' +import express from 'express' +import memoizee from 'memoizee' import { logger } from '@server/helpers/logger' import { Hooks } from '@server/lib/plugins/hooks' import { VideoModel } from '@server/models/video/video' diff --git a/server/controllers/api/plugins.ts b/server/controllers/api/plugins.ts index 3a9ef34e8..2de7fe41f 100644 --- a/server/controllers/api/plugins.ts +++ b/server/controllers/api/plugins.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { logger } from '@server/helpers/logger' import { getFormattedObjects } from '@server/helpers/utils' import { listAvailablePluginsFromIndex } from '@server/lib/plugins/plugin-index' diff --git a/server/controllers/api/search/index.ts b/server/controllers/api/search/index.ts index 67adbb307..39efc0b10 100644 --- a/server/controllers/api/search/index.ts +++ b/server/controllers/api/search/index.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { searchChannelsRouter } from './search-video-channels' import { searchPlaylistsRouter } from './search-video-playlists' import { searchVideosRouter } from './search-videos' diff --git a/server/controllers/api/search/search-video-channels.ts b/server/controllers/api/search/search-video-channels.ts index eef222506..25173ac20 100644 --- a/server/controllers/api/search/search-video-channels.ts +++ b/server/controllers/api/search/search-video-channels.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { sanitizeUrl } from '@server/helpers/core-utils' import { pickSearchChannelQuery } from '@server/helpers/query' import { doJSONRequest } from '@server/helpers/requests' diff --git a/server/controllers/api/search/search-video-playlists.ts b/server/controllers/api/search/search-video-playlists.ts index 0a56f19b7..b28f11c79 100644 --- a/server/controllers/api/search/search-video-playlists.ts +++ b/server/controllers/api/search/search-video-playlists.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { sanitizeUrl } from '@server/helpers/core-utils' import { isUserAbleToSearchRemoteURI } from '@server/helpers/express-utils' import { logger } from '@server/helpers/logger' diff --git a/server/controllers/api/search/search-videos.ts b/server/controllers/api/search/search-videos.ts index 4a6ce0de4..eb7ce0841 100644 --- a/server/controllers/api/search/search-videos.ts +++ b/server/controllers/api/search/search-videos.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { sanitizeUrl } from '@server/helpers/core-utils' import { pickSearchVideoQuery } from '@server/helpers/query' import { doJSONRequest } from '@server/helpers/requests' diff --git a/server/controllers/api/server/contact.ts b/server/controllers/api/server/contact.ts index b315e99cf..09ff50f69 100644 --- a/server/controllers/api/server/contact.ts +++ b/server/controllers/api/server/contact.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' import { ContactForm } from '../../../../shared/models/server' import { Emailer } from '../../../lib/emailer' diff --git a/server/controllers/api/server/debug.ts b/server/controllers/api/server/debug.ts index 0601b89ce..093e6a03c 100644 --- a/server/controllers/api/server/debug.ts +++ b/server/controllers/api/server/debug.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { InboxManager } from '@server/lib/activitypub/inbox-manager' import { RemoveDanglingResumableUploadsScheduler } from '@server/lib/schedulers/remove-dangling-resumable-uploads-scheduler' import { Debug, SendDebugCommand } from '@shared/models' diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts index cbe6b7e4f..2e0fd25eb 100644 --- a/server/controllers/api/server/follows.ts +++ b/server/controllers/api/server/follows.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { getServerActor } from '@server/models/application/application' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' import { UserRight } from '../../../../shared/models/users' diff --git a/server/controllers/api/server/index.ts b/server/controllers/api/server/index.ts index 32fefefc0..b20718d09 100644 --- a/server/controllers/api/server/index.ts +++ b/server/controllers/api/server/index.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { contactRouter } from './contact' import { debugRouter } from './debug' import { serverFollowsRouter } from './follows' diff --git a/server/controllers/api/server/logs.ts b/server/controllers/api/server/logs.ts index 39eceb654..dfd5491aa 100644 --- a/server/controllers/api/server/logs.ts +++ b/server/controllers/api/server/logs.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { readdir, readFile } from 'fs-extra' import { join } from 'path' import { logger, mtimeSortFilesDesc } from '@server/helpers/logger' diff --git a/server/controllers/api/server/redundancy.ts b/server/controllers/api/server/redundancy.ts index e36c8d2db..9f43d3e4e 100644 --- a/server/controllers/api/server/redundancy.ts +++ b/server/controllers/api/server/redundancy.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { JobQueue } from '@server/lib/job-queue' import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' diff --git a/server/controllers/api/server/server-blocklist.ts b/server/controllers/api/server/server-blocklist.ts index b3ee50d85..740f95da3 100644 --- a/server/controllers/api/server/server-blocklist.ts +++ b/server/controllers/api/server/server-blocklist.ts @@ -1,5 +1,5 @@ import 'multer' -import * as express from 'express' +import express from 'express' import { logger } from '@server/helpers/logger' import { getServerActor } from '@server/models/application/application' import { UserNotificationModel } from '@server/models/user/user-notification' diff --git a/server/controllers/api/server/stats.ts b/server/controllers/api/server/stats.ts index 397702548..d661144ca 100644 --- a/server/controllers/api/server/stats.ts +++ b/server/controllers/api/server/stats.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { StatsManager } from '@server/lib/stat-manager' import { ROUTE_CACHE_LIFETIME } from '../../../initializers/constants' import { asyncMiddleware } from '../../../middlewares' diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index be800e8b5..bc47e5fec 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts @@ -1,5 +1,5 @@ -import * as express from 'express' -import * as RateLimit from 'express-rate-limit' +import express from 'express' +import RateLimit from 'express-rate-limit' import { tokensRouter } from '@server/controllers/api/users/token' import { Hooks } from '@server/lib/plugins/hooks' import { OAuthTokenModel } from '@server/models/oauth/oauth-token' diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts index a98d79218..83b774d3c 100644 --- a/server/controllers/api/users/me.ts +++ b/server/controllers/api/users/me.ts @@ -1,5 +1,5 @@ import 'multer' -import * as express from 'express' +import express from 'express' import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger' import { Hooks } from '@server/lib/plugins/hooks' import { AttributesOnly } from '@shared/core-utils' diff --git a/server/controllers/api/users/my-abuses.ts b/server/controllers/api/users/my-abuses.ts index fcd0ce3fc..103c3d332 100644 --- a/server/controllers/api/users/my-abuses.ts +++ b/server/controllers/api/users/my-abuses.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { AbuseModel } from '@server/models/abuse/abuse' import { abuseListForUserValidator, diff --git a/server/controllers/api/users/my-blocklist.ts b/server/controllers/api/users/my-blocklist.ts index 24fff83e3..0b56645cf 100644 --- a/server/controllers/api/users/my-blocklist.ts +++ b/server/controllers/api/users/my-blocklist.ts @@ -1,5 +1,5 @@ import 'multer' -import * as express from 'express' +import express from 'express' import { logger } from '@server/helpers/logger' import { UserNotificationModel } from '@server/models/user/user-notification' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' diff --git a/server/controllers/api/users/my-history.ts b/server/controllers/api/users/my-history.ts index a6e723103..2fcb25acf 100644 --- a/server/controllers/api/users/my-history.ts +++ b/server/controllers/api/users/my-history.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' import { getFormattedObjects } from '../../../helpers/utils' import { sequelizeTypescript } from '../../../initializers/database' diff --git a/server/controllers/api/users/my-notifications.ts b/server/controllers/api/users/my-notifications.ts index 3beee07c0..d107a306e 100644 --- a/server/controllers/api/users/my-notifications.ts +++ b/server/controllers/api/users/my-notifications.ts @@ -1,5 +1,5 @@ import 'multer' -import * as express from 'express' +import express from 'express' import { UserNotificationModel } from '@server/models/user/user-notification' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' import { UserNotificationSetting } from '../../../../shared/models/users' diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts index 26a715704..e3c0cf089 100644 --- a/server/controllers/api/users/my-subscriptions.ts +++ b/server/controllers/api/users/my-subscriptions.ts @@ -1,5 +1,5 @@ import 'multer' -import * as express from 'express' +import express from 'express' import { pickCommonVideoQuery } from '@server/helpers/query' import { sendUndoFollow } from '@server/lib/activitypub/send' import { VideoChannelModel } from '@server/models/video/video-channel' diff --git a/server/controllers/api/users/my-video-playlists.ts b/server/controllers/api/users/my-video-playlists.ts index 76e741ba5..f55ea2ec4 100644 --- a/server/controllers/api/users/my-video-playlists.ts +++ b/server/controllers/api/users/my-video-playlists.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { VideosExistInPlaylists } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model' import { asyncMiddleware, authenticate } from '../../../middlewares' import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists' diff --git a/server/controllers/api/users/token.ts b/server/controllers/api/users/token.ts index b405ddbf4..d5dbe921c 100644 --- a/server/controllers/api/users/token.ts +++ b/server/controllers/api/users/token.ts @@ -1,5 +1,5 @@ -import * as express from 'express' -import * as RateLimit from 'express-rate-limit' +import express from 'express' +import RateLimit from 'express-rate-limit' import { logger } from '@server/helpers/logger' import { buildUUID } from '@server/helpers/uuid' import { CONFIG } from '@server/initializers/config' diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index a0c6601d9..b79dc5933 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { pickCommonVideoQuery } from '@server/helpers/query' import { Hooks } from '@server/lib/plugins/hooks' import { getServerActor } from '@server/models/application/application' diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts index 4971d0a77..2f81cf43c 100644 --- a/server/controllers/api/video-playlist.ts +++ b/server/controllers/api/video-playlist.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { join } from 'path' import { uuidToShort } from '@server/helpers/uuid' import { scheduleRefreshIfNeeded } from '@server/lib/activitypub/playlists' diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts index 6bc768471..de65c74f1 100644 --- a/server/controllers/api/videos/blacklist.ts +++ b/server/controllers/api/videos/blacklist.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist' import { UserRight, VideoBlacklistCreate } from '../../../../shared' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' diff --git a/server/controllers/api/videos/captions.ts b/server/controllers/api/videos/captions.ts index 4008de60f..2d2213327 100644 --- a/server/controllers/api/videos/captions.ts +++ b/server/controllers/api/videos/captions.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { MVideoCaption } from '@server/types/models' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils' diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts index cb696f652..23bba9089 100644 --- a/server/controllers/api/videos/comment.ts +++ b/server/controllers/api/videos/comment.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { ResultList, ThreadsResultList, UserRight, VideoCommentCreate } from '../../../../shared/models' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' import { VideoCommentThreads } from '../../../../shared/models/videos/comment/video-comment.model' diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index de9a5308a..39fc57788 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts @@ -1,7 +1,7 @@ -import * as express from 'express' +import express from 'express' import { move, readFile } from 'fs-extra' -import * as magnetUtil from 'magnet-uri' -import * as parseTorrent from 'parse-torrent' +import { decode } from 'magnet-uri' +import parseTorrent, { Instance } from 'parse-torrent' import { join } from 'path' import { ServerConfigManager } from '@server/lib/server-config-manager' import { setVideoTags } from '@server/lib/video' @@ -329,7 +329,7 @@ async function processTorrentOrAbortRequest (req: express.Request, res: express. torrentfile.path = newTorrentPath const buf = await readFile(torrentfile.path) - const parsedTorrent = parseTorrent(buf) as parseTorrent.Instance + const parsedTorrent = parseTorrent(buf) as Instance if (parsedTorrent.files.length !== 1) { cleanUpReqFiles(req) @@ -349,7 +349,7 @@ async function processTorrentOrAbortRequest (req: express.Request, res: express. function processMagnetURI (body: VideoImportCreate) { const magnetUri = body.magnetUri - const parsed = magnetUtil.decode(magnetUri) + const parsed = decode(magnetUri) return { name: extractNameFromArray(parsed.name), diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 10833d48b..c0c77f3f7 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import toInt from 'validator/lib/toInt' import { pickCommonVideoQuery } from '@server/helpers/query' import { doJSONRequest } from '@server/helpers/requests' diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.ts index 151ff354b..efafe64e9 100644 --- a/server/controllers/api/videos/live.ts +++ b/server/controllers/api/videos/live.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { createReqFiles } from '@server/helpers/express-utils' import { buildUUID, uuidToShort } from '@server/helpers/uuid' import { CONFIG } from '@server/initializers/config' diff --git a/server/controllers/api/videos/ownership.ts b/server/controllers/api/videos/ownership.ts index f48acbc68..043861ac3 100644 --- a/server/controllers/api/videos/ownership.ts +++ b/server/controllers/api/videos/ownership.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { MVideoFullLight } from '@server/types/models' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' import { VideoChangeOwnershipStatus, VideoState } from '../../../../shared/models/videos' diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts index 96f6cd886..c9cc16644 100644 --- a/server/controllers/api/videos/rate.ts +++ b/server/controllers/api/videos/rate.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { UserVideoRateUpdate } from '../../../../shared' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' import { logger } from '../../../helpers/logger' diff --git a/server/controllers/api/videos/update.ts b/server/controllers/api/videos/update.ts index 49639060b..a98a3e67c 100644 --- a/server/controllers/api/videos/update.ts +++ b/server/controllers/api/videos/update.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { Transaction } from 'sequelize/types' import { changeVideoChannelShare } from '@server/lib/activitypub/share' import { buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' diff --git a/server/controllers/api/videos/upload.ts b/server/controllers/api/videos/upload.ts index 5c740c041..7ffda749d 100644 --- a/server/controllers/api/videos/upload.ts +++ b/server/controllers/api/videos/upload.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { move } from 'fs-extra' import { basename } from 'path' import { getLowercaseExtension } from '@server/helpers/core-utils' diff --git a/server/controllers/api/videos/watching.ts b/server/controllers/api/videos/watching.ts index 05c75e543..e8c28b613 100644 --- a/server/controllers/api/videos/watching.ts +++ b/server/controllers/api/videos/watching.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { UserWatchingVideo } from '../../../../shared' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' import { diff --git a/server/controllers/bots.ts b/server/controllers/bots.ts index de0411608..63db345bf 100644 --- a/server/controllers/bots.ts +++ b/server/controllers/bots.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { truncate } from 'lodash' import { SitemapStream, streamToPromise } from 'sitemap' import { buildNSFWFilter } from '../helpers/express-utils' diff --git a/server/controllers/client.ts b/server/controllers/client.ts index ba3c54440..d81e35ec3 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { constants, promises as fs } from 'fs' import { readFile } from 'fs-extra' import { join } from 'path' diff --git a/server/controllers/download.ts b/server/controllers/download.ts index ffe40d57e..8da710669 100644 --- a/server/controllers/download.ts +++ b/server/controllers/download.ts @@ -1,5 +1,5 @@ -import * as cors from 'cors' -import * as express from 'express' +import cors from 'cors' +import express from 'express' import { logger } from '@server/helpers/logger' import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache' import { Hooks } from '@server/lib/plugins/hooks' diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts index 9fa70a7c8..5ac2e43a1 100644 --- a/server/controllers/feeds.ts +++ b/server/controllers/feeds.ts @@ -1,5 +1,5 @@ -import * as express from 'express' -import * as Feed from 'pfeed' +import express from 'express' +import Feed from 'pfeed' import { getCategoryLabel } from '@server/models/video/formatter/video-format-utils' import { VideoFilter } from '../../shared/models/videos/video-query.type' import { buildNSFWFilter } from '../helpers/express-utils' diff --git a/server/controllers/lazy-static.ts b/server/controllers/lazy-static.ts index 632e4dcd8..a4076ee56 100644 --- a/server/controllers/lazy-static.ts +++ b/server/controllers/lazy-static.ts @@ -1,5 +1,5 @@ -import * as cors from 'cors' -import * as express from 'express' +import cors from 'cors' +import express from 'express' import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache' import { HttpStatusCode } from '../../shared/models/http/http-error-codes' import { logger } from '../helpers/logger' diff --git a/server/controllers/live.ts b/server/controllers/live.ts index 95d5c0135..81008f120 100644 --- a/server/controllers/live.ts +++ b/server/controllers/live.ts @@ -1,5 +1,5 @@ -import * as cors from 'cors' -import * as express from 'express' +import cors from 'cors' +import express from 'express' import { mapToJSON } from '@server/helpers/core-utils' import { LiveSegmentShaStore } from '@server/lib/live' import { HttpStatusCode } from '@shared/models' diff --git a/server/controllers/plugins.ts b/server/controllers/plugins.ts index 11ab3f10a..28fffc9e1 100644 --- a/server/controllers/plugins.ts +++ b/server/controllers/plugins.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { join } from 'path' import { logger } from '@server/helpers/logger' import { optionalAuthenticate } from '@server/middlewares/auth' diff --git a/server/controllers/services.ts b/server/controllers/services.ts index 8c0af9ff7..8a8a95486 100644 --- a/server/controllers/services.ts +++ b/server/controllers/services.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { EMBED_SIZE, PREVIEWS_SIZE, WEBSERVER, THUMBNAILS_SIZE } from '../initializers/constants' import { asyncMiddleware, oembedValidator } from '../middlewares' import { accountNameWithHostGetValidator } from '../middlewares/validators' diff --git a/server/controllers/static.ts b/server/controllers/static.ts index 912d7e36c..1c04e4b11 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts @@ -1,5 +1,5 @@ -import * as cors from 'cors' -import * as express from 'express' +import cors from 'cors' +import express from 'express' import { join } from 'path' import { serveIndexHTML } from '@server/lib/client-html' import { ServerConfigManager } from '@server/lib/server-config-manager' diff --git a/server/controllers/tracker.ts b/server/controllers/tracker.ts index 37f8f12c9..da9c68c6c 100644 --- a/server/controllers/tracker.ts +++ b/server/controllers/tracker.ts @@ -1,7 +1,7 @@ -import * as bitTorrentTracker from 'bittorrent-tracker' -import * as express from 'express' -import * as http from 'http' -import * as proxyAddr from 'proxy-addr' +import { Server as TrackerServer } from 'bittorrent-tracker' +import express from 'express' +import { createServer } from 'http' +import proxyAddr from 'proxy-addr' import { Server as WebSocketServer } from 'ws' import { Redis } from '@server/lib/redis' import { logger } from '../helpers/logger' @@ -10,8 +10,6 @@ import { TRACKER_RATE_LIMITS } from '../initializers/constants' import { VideoFileModel } from '../models/video/video-file' import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' -const TrackerServer = bitTorrentTracker.Server - const trackerRouter = express.Router() let peersIps = {} @@ -86,7 +84,7 @@ trackerRouter.get('/tracker/announce', (req, res) => onHttpRequest(req, res, { a trackerRouter.get('/tracker/scrape', (req, res) => onHttpRequest(req, res, { action: 'scrape' })) function createWebsocketTrackerServer (app: express.Application) { - const server = http.createServer(app) + const server = createServer(app) const wss = new WebSocketServer({ noServer: true }) wss.on('connection', function (ws, req) { diff --git a/server/controllers/webfinger.ts b/server/controllers/webfinger.ts index 885e4498f..29ce01166 100644 --- a/server/controllers/webfinger.ts +++ b/server/controllers/webfinger.ts @@ -1,5 +1,5 @@ -import * as cors from 'cors' -import * as express from 'express' +import cors from 'cors' +import express from 'express' import { WEBSERVER } from '@server/initializers/constants' import { asyncMiddleware } from '../middlewares' import { webfingerValidator } from '../middlewares/validators' -- cgit v1.2.3