diff options
Diffstat (limited to 'server/helpers')
20 files changed, 20 insertions, 21 deletions
diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts index 97c809a0c..735f2d73a 100644 --- a/server/helpers/activitypub.ts +++ b/server/helpers/activitypub.ts | |||
@@ -1,9 +1,8 @@ | |||
1 | import * as Bluebird from 'bluebird' | 1 | import * as Bluebird from 'bluebird' |
2 | import * as validator from 'validator' | 2 | import validator from 'validator' |
3 | import { ResultList } from '../../shared/models' | 3 | import { ResultList } from '../../shared/models' |
4 | import { Activity } from '../../shared/models/activitypub' | 4 | import { Activity } from '../../shared/models/activitypub' |
5 | import { ACTIVITY_PUB } from '../initializers/constants' | 5 | import { ACTIVITY_PUB } from '../initializers/constants' |
6 | import { ActorModel } from '../models/activitypub/actor' | ||
7 | import { signJsonLDObject } from './peertube-crypto' | 6 | import { signJsonLDObject } from './peertube-crypto' |
8 | import { pageToStartAndCount } from './core-utils' | 7 | import { pageToStartAndCount } from './core-utils' |
9 | import { parse } from 'url' | 8 | import { parse } from 'url' |
diff --git a/server/helpers/custom-validators/activitypub/activity.ts b/server/helpers/custom-validators/activitypub/activity.ts index f68c76cdc..8b8c0685f 100644 --- a/server/helpers/custom-validators/activitypub/activity.ts +++ b/server/helpers/custom-validators/activitypub/activity.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as validator from 'validator' | 1 | import validator from 'validator' |
2 | import { Activity, ActivityType } from '../../../../shared/models/activitypub' | 2 | import { Activity, ActivityType } from '../../../../shared/models/activitypub' |
3 | import { sanitizeAndCheckActorObject } from './actor' | 3 | import { sanitizeAndCheckActorObject } from './actor' |
4 | import { isActivityPubUrlValid, isBaseActivityValid, isObjectValid } from './misc' | 4 | import { isActivityPubUrlValid, isBaseActivityValid, isObjectValid } from './misc' |
diff --git a/server/helpers/custom-validators/activitypub/actor.ts b/server/helpers/custom-validators/activitypub/actor.ts index ec4dd6f96..fa58e163f 100644 --- a/server/helpers/custom-validators/activitypub/actor.ts +++ b/server/helpers/custom-validators/activitypub/actor.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as validator from 'validator' | 1 | import validator from 'validator' |
2 | import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' | 2 | import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' |
3 | import { exists, isArray } from '../misc' | 3 | import { exists, isArray } from '../misc' |
4 | import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc' | 4 | import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc' |
diff --git a/server/helpers/custom-validators/activitypub/misc.ts b/server/helpers/custom-validators/activitypub/misc.ts index 5afcfbedc..4ee8e6fee 100644 --- a/server/helpers/custom-validators/activitypub/misc.ts +++ b/server/helpers/custom-validators/activitypub/misc.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as validator from 'validator' | 1 | import validator from 'validator' |
2 | import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' | 2 | import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' |
3 | import { isTestInstance } from '../../core-utils' | 3 | import { isTestInstance } from '../../core-utils' |
4 | import { exists } from '../misc' | 4 | import { exists } from '../misc' |
diff --git a/server/helpers/custom-validators/activitypub/playlist.ts b/server/helpers/custom-validators/activitypub/playlist.ts index 6c7bdb193..bd0d16a4a 100644 --- a/server/helpers/custom-validators/activitypub/playlist.ts +++ b/server/helpers/custom-validators/activitypub/playlist.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { exists, isDateValid } from '../misc' | 1 | import { exists, isDateValid } from '../misc' |
2 | import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' | 2 | import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' |
3 | import * as validator from 'validator' | 3 | import validator from 'validator' |
4 | import { PlaylistElementObject } from '../../../../shared/models/activitypub/objects/playlist-element-object' | 4 | import { PlaylistElementObject } from '../../../../shared/models/activitypub/objects/playlist-element-object' |
5 | import { isActivityPubUrlValid } from './misc' | 5 | import { isActivityPubUrlValid } from './misc' |
6 | 6 | ||
diff --git a/server/helpers/custom-validators/activitypub/video-comments.ts b/server/helpers/custom-validators/activitypub/video-comments.ts index ea780ca46..aa3c246b5 100644 --- a/server/helpers/custom-validators/activitypub/video-comments.ts +++ b/server/helpers/custom-validators/activitypub/video-comments.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as validator from 'validator' | 1 | import validator from 'validator' |
2 | import { ACTIVITY_PUB } from '../../../initializers/constants' | 2 | import { ACTIVITY_PUB } from '../../../initializers/constants' |
3 | import { exists, isArray, isDateValid } from '../misc' | 3 | import { exists, isArray, isDateValid } from '../misc' |
4 | import { isActivityPubUrlValid } from './misc' | 4 | import { isActivityPubUrlValid } from './misc' |
diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index a28bebf2d..fe94bd58a 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as validator from 'validator' | 1 | import validator from 'validator' |
2 | import { ACTIVITY_PUB, CONSTRAINTS_FIELDS } from '../../../initializers/constants' | 2 | import { ACTIVITY_PUB, CONSTRAINTS_FIELDS } from '../../../initializers/constants' |
3 | import { peertubeTruncate } from '../../core-utils' | 3 | import { peertubeTruncate } from '../../core-utils' |
4 | import { exists, isArray, isBooleanValid, isDateValid, isUUIDValid } from '../misc' | 4 | import { exists, isArray, isBooleanValid, isDateValid, isUUIDValid } from '../misc' |
diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.ts index 0c3df1cd0..89149b3e0 100644 --- a/server/helpers/custom-validators/misc.ts +++ b/server/helpers/custom-validators/misc.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import 'multer' | 1 | import 'multer' |
2 | import * as validator from 'validator' | 2 | import validator from 'validator' |
3 | import { sep } from 'path' | 3 | import { sep } from 'path' |
4 | 4 | ||
5 | function exists (value: any) { | 5 | function exists (value: any) { |
diff --git a/server/helpers/custom-validators/plugins.ts b/server/helpers/custom-validators/plugins.ts index 332418b49..3af72547b 100644 --- a/server/helpers/custom-validators/plugins.ts +++ b/server/helpers/custom-validators/plugins.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { exists, isArray, isSafePath } from './misc' | 1 | import { exists, isArray, isSafePath } from './misc' |
2 | import * as validator from 'validator' | 2 | import validator from 'validator' |
3 | import { PluginType } from '../../../shared/models/plugins/plugin.type' | 3 | import { PluginType } from '../../../shared/models/plugins/plugin.type' |
4 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' | 4 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' |
5 | import { PluginPackageJson } from '../../../shared/models/plugins/plugin-package-json.model' | 5 | import { PluginPackageJson } from '../../../shared/models/plugins/plugin-package-json.model' |
diff --git a/server/helpers/custom-validators/search.ts b/server/helpers/custom-validators/search.ts index ee732b15a..bb17134c3 100644 --- a/server/helpers/custom-validators/search.ts +++ b/server/helpers/custom-validators/search.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as validator from 'validator' | 1 | import validator from 'validator' |
2 | import { isArray } from './misc' | 2 | import { isArray } from './misc' |
3 | 3 | ||
4 | function isNumberArray (value: any) { | 4 | function isNumberArray (value: any) { |
diff --git a/server/helpers/custom-validators/servers.ts b/server/helpers/custom-validators/servers.ts index 7ced36fd3..adf1ea497 100644 --- a/server/helpers/custom-validators/servers.ts +++ b/server/helpers/custom-validators/servers.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as validator from 'validator' | 1 | import validator from 'validator' |
2 | import { exists, isArray } from './misc' | 2 | import { exists, isArray } from './misc' |
3 | import { isTestInstance } from '../core-utils' | 3 | import { isTestInstance } from '../core-utils' |
4 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' | 4 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' |
diff --git a/server/helpers/custom-validators/user-notifications.ts b/server/helpers/custom-validators/user-notifications.ts index 02ea3bbc2..5a4d10504 100644 --- a/server/helpers/custom-validators/user-notifications.ts +++ b/server/helpers/custom-validators/user-notifications.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { exists } from './misc' | 1 | import { exists } from './misc' |
2 | import * as validator from 'validator' | 2 | import validator from 'validator' |
3 | import { UserNotificationType } from '../../../shared/models/users' | 3 | import { UserNotificationType } from '../../../shared/models/users' |
4 | import { UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model' | 4 | import { UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model' |
5 | 5 | ||
diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts index 008916a04..b4d5751e7 100644 --- a/server/helpers/custom-validators/users.ts +++ b/server/helpers/custom-validators/users.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as validator from 'validator' | 1 | import validator from 'validator' |
2 | import { UserRole } from '../../../shared' | 2 | import { UserRole } from '../../../shared' |
3 | import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers/constants' | 3 | import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers/constants' |
4 | import { exists, isArray, isBooleanValid, isFileValid } from './misc' | 4 | import { exists, isArray, isBooleanValid, isFileValid } from './misc' |
diff --git a/server/helpers/custom-validators/video-abuses.ts b/server/helpers/custom-validators/video-abuses.ts index e43d12be8..a9478c76a 100644 --- a/server/helpers/custom-validators/video-abuses.ts +++ b/server/helpers/custom-validators/video-abuses.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Response } from 'express' | 1 | import { Response } from 'express' |
2 | import * as validator from 'validator' | 2 | import validator from 'validator' |
3 | import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants' | 3 | import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants' |
4 | import { exists } from './misc' | 4 | import { exists } from './misc' |
5 | import { VideoAbuseModel } from '../../models/video/video-abuse' | 5 | import { VideoAbuseModel } from '../../models/video/video-abuse' |
diff --git a/server/helpers/custom-validators/video-blacklist.ts b/server/helpers/custom-validators/video-blacklist.ts index 9a44332ef..17cb3b00b 100644 --- a/server/helpers/custom-validators/video-blacklist.ts +++ b/server/helpers/custom-validators/video-blacklist.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as validator from 'validator' | 1 | import validator from 'validator' |
2 | import { exists } from './misc' | 2 | import { exists } from './misc' |
3 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' | 3 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' |
4 | import { VideoBlacklistType } from '../../../shared/models/videos' | 4 | import { VideoBlacklistType } from '../../../shared/models/videos' |
diff --git a/server/helpers/custom-validators/video-channels.ts b/server/helpers/custom-validators/video-channels.ts index 6c52dc093..ded5d5171 100644 --- a/server/helpers/custom-validators/video-channels.ts +++ b/server/helpers/custom-validators/video-channels.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as validator from 'validator' | 1 | import validator from 'validator' |
2 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' | 2 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' |
3 | import { exists } from './misc' | 3 | import { exists } from './misc' |
4 | 4 | ||
diff --git a/server/helpers/custom-validators/video-comments.ts b/server/helpers/custom-validators/video-comments.ts index 8a7cd7105..846f28b17 100644 --- a/server/helpers/custom-validators/video-comments.ts +++ b/server/helpers/custom-validators/video-comments.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import 'multer' | 1 | import 'multer' |
2 | import * as validator from 'validator' | 2 | import validator from 'validator' |
3 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' | 3 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' |
4 | 4 | ||
5 | const VIDEO_COMMENTS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_COMMENTS | 5 | const VIDEO_COMMENTS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_COMMENTS |
diff --git a/server/helpers/custom-validators/video-imports.ts b/server/helpers/custom-validators/video-imports.ts index 8820c4c0a..ffad482b4 100644 --- a/server/helpers/custom-validators/video-imports.ts +++ b/server/helpers/custom-validators/video-imports.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import 'multer' | 1 | import 'multer' |
2 | import * as validator from 'validator' | 2 | import validator from 'validator' |
3 | import { CONSTRAINTS_FIELDS, MIMETYPES, VIDEO_IMPORT_STATES } from '../../initializers/constants' | 3 | import { CONSTRAINTS_FIELDS, MIMETYPES, VIDEO_IMPORT_STATES } from '../../initializers/constants' |
4 | import { exists, isFileValid } from './misc' | 4 | import { exists, isFileValid } from './misc' |
5 | import * as express from 'express' | 5 | import * as express from 'express' |
diff --git a/server/helpers/custom-validators/video-playlists.ts b/server/helpers/custom-validators/video-playlists.ts index 60125dcda..4bb8384ab 100644 --- a/server/helpers/custom-validators/video-playlists.ts +++ b/server/helpers/custom-validators/video-playlists.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { exists } from './misc' | 1 | import { exists } from './misc' |
2 | import * as validator from 'validator' | 2 | import validator from 'validator' |
3 | import { CONSTRAINTS_FIELDS, VIDEO_PLAYLIST_PRIVACIES, VIDEO_PLAYLIST_TYPES } from '../../initializers/constants' | 3 | import { CONSTRAINTS_FIELDS, VIDEO_PLAYLIST_PRIVACIES, VIDEO_PLAYLIST_TYPES } from '../../initializers/constants' |
4 | import * as express from 'express' | 4 | import * as express from 'express' |
5 | import { VideoPlaylistModel } from '../../models/video/video-playlist' | 5 | import { VideoPlaylistModel } from '../../models/video/video-playlist' |
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index ff93f2e99..a9e859e54 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { values } from 'lodash' | 1 | import { values } from 'lodash' |
2 | import * as validator from 'validator' | 2 | import validator from 'validator' |
3 | import { VideoFilter, VideoPrivacy, VideoRateType } from '../../../shared' | 3 | import { VideoFilter, VideoPrivacy, VideoRateType } from '../../../shared' |
4 | import { | 4 | import { |
5 | CONSTRAINTS_FIELDS, | 5 | CONSTRAINTS_FIELDS, |