diff options
author | Chocobozzz <me@florianbigard.com> | 2022-11-15 15:00:19 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-11-15 15:00:23 +0100 |
commit | 99b757488c077cee7d0ab89eeec181a7ee6290eb (patch) | |
tree | 307a3f39285f899e3ed616d92aae1bdd181178e0 /server/lib | |
parent | 4638cd713dcdd007cd7f49b9a95fa62ac7823e7c (diff) | |
download | PeerTube-99b757488c077cee7d0ab89eeec181a7ee6290eb.tar.gz PeerTube-99b757488c077cee7d0ab89eeec181a7ee6290eb.tar.zst PeerTube-99b757488c077cee7d0ab89eeec181a7ee6290eb.zip |
Fix server lint
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/share.ts | 2 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/activitypub-cleaner.ts | 2 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/video-import.ts | 2 | ||||
-rw-r--r-- | server/lib/moderation.ts | 2 | ||||
-rw-r--r-- | server/lib/schedulers/plugins-check-scheduler.ts | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/server/lib/activitypub/share.ts b/server/lib/activitypub/share.ts index 0fefcbbc5..af0dd510a 100644 --- a/server/lib/activitypub/share.ts +++ b/server/lib/activitypub/share.ts | |||
@@ -57,7 +57,7 @@ export { | |||
57 | 57 | ||
58 | async function addVideoShare (shareUrl: string, video: MVideoId) { | 58 | async function addVideoShare (shareUrl: string, video: MVideoId) { |
59 | const { body } = await doJSONRequest<any>(shareUrl, { activityPub: true }) | 59 | const { body } = await doJSONRequest<any>(shareUrl, { activityPub: true }) |
60 | if (!body || !body.actor) throw new Error('Body or body actor is invalid') | 60 | if (!body?.actor) throw new Error('Body or body actor is invalid') |
61 | 61 | ||
62 | const actorUrl = getAPId(body.actor) | 62 | const actorUrl = getAPId(body.actor) |
63 | if (checkUrlsSameHost(shareUrl, actorUrl) !== true) { | 63 | if (checkUrlsSameHost(shareUrl, actorUrl) !== true) { |
diff --git a/server/lib/job-queue/handlers/activitypub-cleaner.ts b/server/lib/job-queue/handlers/activitypub-cleaner.ts index 84c0a2de2..a25f00b0a 100644 --- a/server/lib/job-queue/handlers/activitypub-cleaner.ts +++ b/server/lib/job-queue/handlers/activitypub-cleaner.ts | |||
@@ -88,7 +88,7 @@ async function updateObjectIfNeeded <T> (options: { | |||
88 | const { body } = await doJSONRequest<any>(url, { activityPub: true }) | 88 | const { body } = await doJSONRequest<any>(url, { activityPub: true }) |
89 | 89 | ||
90 | // If not same id, check same host and update | 90 | // If not same id, check same host and update |
91 | if (!body || !body.id || !bodyValidator(body)) throw new Error(`Body or body id of ${url} is invalid`) | 91 | if (!body?.id || !bodyValidator(body)) throw new Error(`Body or body id of ${url} is invalid`) |
92 | 92 | ||
93 | if (body.type === 'Tombstone') { | 93 | if (body.type === 'Tombstone') { |
94 | return on404OrTombstone() | 94 | return on404OrTombstone() |
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index 83d582cb4..4d361c7b9 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts | |||
@@ -107,7 +107,7 @@ async function processYoutubeDLImport (job: Job, videoImport: MVideoImportDefaul | |||
107 | 107 | ||
108 | async function getVideoImportOrDie (payload: VideoImportPayload) { | 108 | async function getVideoImportOrDie (payload: VideoImportPayload) { |
109 | const videoImport = await VideoImportModel.loadAndPopulateVideo(payload.videoImportId) | 109 | const videoImport = await VideoImportModel.loadAndPopulateVideo(payload.videoImportId) |
110 | if (!videoImport || !videoImport.Video) { | 110 | if (!videoImport?.Video) { |
111 | throw new Error(`Cannot import video ${payload.videoImportId}: the video import or video linked to this import does not exist anymore.`) | 111 | throw new Error(`Cannot import video ${payload.videoImportId}: the video import or video linked to this import does not exist anymore.`) |
112 | } | 112 | } |
113 | 113 | ||
diff --git a/server/lib/moderation.ts b/server/lib/moderation.ts index 3cc92ca30..dc5d8c83c 100644 --- a/server/lib/moderation.ts +++ b/server/lib/moderation.ts | |||
@@ -220,7 +220,7 @@ async function createAbuse (options: { | |||
220 | base: FilteredModelAttributes<AbuseModel> | 220 | base: FilteredModelAttributes<AbuseModel> |
221 | reporterAccount: MAccountDefault | 221 | reporterAccount: MAccountDefault |
222 | flaggedAccount: MAccountLight | 222 | flaggedAccount: MAccountLight |
223 | associateFun: (abuseInstance: MAbuseFull) => Promise<{ isOwned: boolean} > | 223 | associateFun: (abuseInstance: MAbuseFull) => Promise<{ isOwned: boolean }> |
224 | skipNotification: boolean | 224 | skipNotification: boolean |
225 | transaction: Transaction | 225 | transaction: Transaction |
226 | }) { | 226 | }) { |
diff --git a/server/lib/schedulers/plugins-check-scheduler.ts b/server/lib/schedulers/plugins-check-scheduler.ts index 06450fa01..820c01693 100644 --- a/server/lib/schedulers/plugins-check-scheduler.ts +++ b/server/lib/schedulers/plugins-check-scheduler.ts | |||
@@ -33,7 +33,7 @@ export class PluginsCheckScheduler extends AbstractScheduler { | |||
33 | const chunks = chunk(plugins, 10) | 33 | const chunks = chunk(plugins, 10) |
34 | for (const chunk of chunks) { | 34 | for (const chunk of chunks) { |
35 | // Find plugins according to their npm name | 35 | // Find plugins according to their npm name |
36 | const pluginIndex: { [npmName: string]: PluginModel} = {} | 36 | const pluginIndex: { [npmName: string]: PluginModel } = {} |
37 | for (const plugin of chunk) { | 37 | for (const plugin of chunk) { |
38 | pluginIndex[PluginModel.buildNpmName(plugin.name, plugin.type)] = plugin | 38 | pluginIndex[PluginModel.buildNpmName(plugin.name, plugin.type)] = plugin |
39 | } | 39 | } |