diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-12 17:53:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-13 16:50:33 +0100 |
commit | 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch) | |
tree | e5ca358287fca6ecacce83defcf23af1e8e9f419 /server/helpers | |
parent | c893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff) | |
download | PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip |
Move models to typescript-sequelize
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/activitypub.ts | 10 | ||||
-rw-r--r-- | server/helpers/custom-validators/accounts.ts | 13 | ||||
-rw-r--r-- | server/helpers/custom-validators/activitypub/account.ts | 2 | ||||
-rw-r--r-- | server/helpers/custom-validators/activitypub/activity.ts | 4 | ||||
-rw-r--r-- | server/helpers/custom-validators/activitypub/misc.ts | 4 | ||||
-rw-r--r-- | server/helpers/custom-validators/index.ts | 9 | ||||
-rw-r--r-- | server/helpers/custom-validators/video-channels.ts | 10 | ||||
-rw-r--r-- | server/helpers/custom-validators/videos.ts | 19 | ||||
-rw-r--r-- | server/helpers/custom-validators/webfinger.ts | 8 | ||||
-rw-r--r-- | server/helpers/ffmpeg-utils.ts | 2 | ||||
-rw-r--r-- | server/helpers/index.ts | 1 | ||||
-rw-r--r-- | server/helpers/logger.ts | 2 | ||||
-rw-r--r-- | server/helpers/peertube-crypto.ts | 6 | ||||
-rw-r--r-- | server/helpers/utils.ts | 17 | ||||
-rw-r--r-- | server/helpers/webfinger.ts | 4 |
15 files changed, 51 insertions, 60 deletions
diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts index 1ea6422ca..43907b596 100644 --- a/server/helpers/activitypub.ts +++ b/server/helpers/activitypub.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import { Activity } from '../../shared/models/activitypub/activity' | 1 | import { ResultList } from '../../shared/models' |
2 | import { ResultList } from '../../shared/models/result-list.model' | 2 | import { Activity } from '../../shared/models/activitypub' |
3 | import { AccountInstance } from '../models/account/account-interface' | 3 | import { ACTIVITY_PUB } from '../initializers' |
4 | import { AccountModel } from '../models/account/account' | ||
4 | import { signObject } from './peertube-crypto' | 5 | import { signObject } from './peertube-crypto' |
5 | import { ACTIVITY_PUB } from '../initializers/constants' | ||
6 | 6 | ||
7 | function activityPubContextify <T> (data: T) { | 7 | function activityPubContextify <T> (data: T) { |
8 | return Object.assign(data,{ | 8 | return Object.assign(data,{ |
@@ -71,7 +71,7 @@ function activityPubCollectionPagination (url: string, page: any, result: Result | |||
71 | return orderedCollectionPagination | 71 | return orderedCollectionPagination |
72 | } | 72 | } |
73 | 73 | ||
74 | function buildSignedActivity (byAccount: AccountInstance, data: Object) { | 74 | function buildSignedActivity (byAccount: AccountModel, data: Object) { |
75 | const activity = activityPubContextify(data) | 75 | const activity = activityPubContextify(data) |
76 | 76 | ||
77 | return signObject(byAccount, activity) as Promise<Activity> | 77 | return signObject(byAccount, activity) as Promise<Activity> |
diff --git a/server/helpers/custom-validators/accounts.ts b/server/helpers/custom-validators/accounts.ts index e3c477414..8dc5d1f0d 100644 --- a/server/helpers/custom-validators/accounts.ts +++ b/server/helpers/custom-validators/accounts.ts | |||
@@ -2,8 +2,7 @@ import * as Bluebird from 'bluebird' | |||
2 | import { Response } from 'express' | 2 | import { Response } from 'express' |
3 | import 'express-validator' | 3 | import 'express-validator' |
4 | import * as validator from 'validator' | 4 | import * as validator from 'validator' |
5 | import { database as db } from '../../initializers' | 5 | import { AccountModel } from '../../models/account/account' |
6 | import { AccountInstance } from '../../models' | ||
7 | import { isUserUsernameValid } from './users' | 6 | import { isUserUsernameValid } from './users' |
8 | 7 | ||
9 | function isAccountNameValid (value: string) { | 8 | function isAccountNameValid (value: string) { |
@@ -11,24 +10,24 @@ function isAccountNameValid (value: string) { | |||
11 | } | 10 | } |
12 | 11 | ||
13 | function isAccountIdExist (id: number | string, res: Response) { | 12 | function isAccountIdExist (id: number | string, res: Response) { |
14 | let promise: Bluebird<AccountInstance> | 13 | let promise: Bluebird<AccountModel> |
15 | 14 | ||
16 | if (validator.isInt('' + id)) { | 15 | if (validator.isInt('' + id)) { |
17 | promise = db.Account.load(+id) | 16 | promise = AccountModel.load(+id) |
18 | } else { // UUID | 17 | } else { // UUID |
19 | promise = db.Account.loadByUUID('' + id) | 18 | promise = AccountModel.loadByUUID('' + id) |
20 | } | 19 | } |
21 | 20 | ||
22 | return isAccountExist(promise, res) | 21 | return isAccountExist(promise, res) |
23 | } | 22 | } |
24 | 23 | ||
25 | function isLocalAccountNameExist (name: string, res: Response) { | 24 | function isLocalAccountNameExist (name: string, res: Response) { |
26 | const promise = db.Account.loadLocalByName(name) | 25 | const promise = AccountModel.loadLocalByName(name) |
27 | 26 | ||
28 | return isAccountExist(promise, res) | 27 | return isAccountExist(promise, res) |
29 | } | 28 | } |
30 | 29 | ||
31 | async function isAccountExist (p: Bluebird<AccountInstance>, res: Response) { | 30 | async function isAccountExist (p: Bluebird<AccountModel>, res: Response) { |
32 | const account = await p | 31 | const account = await p |
33 | 32 | ||
34 | if (!account) { | 33 | if (!account) { |
diff --git a/server/helpers/custom-validators/activitypub/account.ts b/server/helpers/custom-validators/activitypub/account.ts index cab39a654..10bf81e8a 100644 --- a/server/helpers/custom-validators/activitypub/account.ts +++ b/server/helpers/custom-validators/activitypub/account.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as validator from 'validator' | 1 | import * as validator from 'validator' |
2 | import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' | 2 | import { CONSTRAINTS_FIELDS } from '../../../initializers' |
3 | import { isAccountNameValid } from '../accounts' | 3 | import { isAccountNameValid } from '../accounts' |
4 | import { exists, isUUIDValid } from '../misc' | 4 | import { exists, isUUIDValid } from '../misc' |
5 | import { isActivityPubUrlValid, isBaseActivityValid } from './misc' | 5 | import { isActivityPubUrlValid, isBaseActivityValid } from './misc' |
diff --git a/server/helpers/custom-validators/activitypub/activity.ts b/server/helpers/custom-validators/activitypub/activity.ts index 3a0e8197c..043e3c55e 100644 --- a/server/helpers/custom-validators/activitypub/activity.ts +++ b/server/helpers/custom-validators/activitypub/activity.ts | |||
@@ -1,8 +1,9 @@ | |||
1 | import * as validator from 'validator' | 1 | import * as validator from 'validator' |
2 | import { Activity, ActivityType } from '../../../../shared/models/activitypub/activity' | 2 | import { Activity, ActivityType } from '../../../../shared/models/activitypub' |
3 | import { isAccountAcceptActivityValid, isAccountDeleteActivityValid, isAccountFollowActivityValid } from './account' | 3 | import { isAccountAcceptActivityValid, isAccountDeleteActivityValid, isAccountFollowActivityValid } from './account' |
4 | import { isAnnounceActivityValid } from './announce' | 4 | import { isAnnounceActivityValid } from './announce' |
5 | import { isActivityPubUrlValid } from './misc' | 5 | import { isActivityPubUrlValid } from './misc' |
6 | import { isDislikeActivityValid, isLikeActivityValid } from './rate' | ||
6 | import { isUndoActivityValid } from './undo' | 7 | import { isUndoActivityValid } from './undo' |
7 | import { isVideoChannelCreateActivityValid, isVideoChannelDeleteActivityValid, isVideoChannelUpdateActivityValid } from './video-channels' | 8 | import { isVideoChannelCreateActivityValid, isVideoChannelDeleteActivityValid, isVideoChannelUpdateActivityValid } from './video-channels' |
8 | import { | 9 | import { |
@@ -12,7 +13,6 @@ import { | |||
12 | isVideoTorrentUpdateActivityValid | 13 | isVideoTorrentUpdateActivityValid |
13 | } from './videos' | 14 | } from './videos' |
14 | import { isViewActivityValid } from './view' | 15 | import { isViewActivityValid } from './view' |
15 | import { isDislikeActivityValid, isLikeActivityValid } from './rate' | ||
16 | 16 | ||
17 | function isRootActivityValid (activity: any) { | 17 | function isRootActivityValid (activity: any) { |
18 | return Array.isArray(activity['@context']) && | 18 | return Array.isArray(activity['@context']) && |
diff --git a/server/helpers/custom-validators/activitypub/misc.ts b/server/helpers/custom-validators/activitypub/misc.ts index 1bbfd0fc4..65f5ca809 100644 --- a/server/helpers/custom-validators/activitypub/misc.ts +++ b/server/helpers/custom-validators/activitypub/misc.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as validator from 'validator' | 1 | import * as validator from 'validator' |
2 | import { exists } from '../misc' | 2 | import { CONSTRAINTS_FIELDS } from '../../../initializers' |
3 | import { isTestInstance } from '../../core-utils' | 3 | import { isTestInstance } from '../../core-utils' |
4 | import { CONSTRAINTS_FIELDS } from '../../../initializers/constants' | 4 | import { exists } from '../misc' |
5 | 5 | ||
6 | function isActivityPubUrlValid (url: string) { | 6 | function isActivityPubUrlValid (url: string) { |
7 | const isURLOptions = { | 7 | const isURLOptions = { |
diff --git a/server/helpers/custom-validators/index.ts b/server/helpers/custom-validators/index.ts deleted file mode 100644 index d3b2f5393..000000000 --- a/server/helpers/custom-validators/index.ts +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | export * from './activitypub' | ||
2 | export * from './misc' | ||
3 | export * from './servers' | ||
4 | export * from './servers' | ||
5 | export * from './users' | ||
6 | export * from './accounts' | ||
7 | export * from './video-channels' | ||
8 | export * from './videos' | ||
9 | export * from './webfinger' | ||
diff --git a/server/helpers/custom-validators/video-channels.ts b/server/helpers/custom-validators/video-channels.ts index 3de9f041b..6bc96bf51 100644 --- a/server/helpers/custom-validators/video-channels.ts +++ b/server/helpers/custom-validators/video-channels.ts | |||
@@ -2,8 +2,8 @@ import * as express from 'express' | |||
2 | import 'express-validator' | 2 | import 'express-validator' |
3 | import 'multer' | 3 | import 'multer' |
4 | import * as validator from 'validator' | 4 | import * as validator from 'validator' |
5 | import { CONSTRAINTS_FIELDS, database as db } from '../../initializers' | 5 | import { CONSTRAINTS_FIELDS } from '../../initializers' |
6 | import { VideoChannelInstance } from '../../models' | 6 | import { VideoChannelModel } from '../../models/video/video-channel' |
7 | import { exists } from './misc' | 7 | import { exists } from './misc' |
8 | 8 | ||
9 | const VIDEO_CHANNELS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_CHANNELS | 9 | const VIDEO_CHANNELS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_CHANNELS |
@@ -17,11 +17,11 @@ function isVideoChannelNameValid (value: string) { | |||
17 | } | 17 | } |
18 | 18 | ||
19 | async function isVideoChannelExist (id: string, res: express.Response) { | 19 | async function isVideoChannelExist (id: string, res: express.Response) { |
20 | let videoChannel: VideoChannelInstance | 20 | let videoChannel: VideoChannelModel |
21 | if (validator.isInt(id)) { | 21 | if (validator.isInt(id)) { |
22 | videoChannel = await db.VideoChannel.loadAndPopulateAccount(+id) | 22 | videoChannel = await VideoChannelModel.loadAndPopulateAccount(+id) |
23 | } else { // UUID | 23 | } else { // UUID |
24 | videoChannel = await db.VideoChannel.loadByUUIDAndPopulateAccount(id) | 24 | videoChannel = await VideoChannelModel.loadByUUIDAndPopulateAccount(id) |
25 | } | 25 | } |
26 | 26 | ||
27 | if (!videoChannel) { | 27 | if (!videoChannel) { |
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 37fa8b08a..ee9d0ed19 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts | |||
@@ -4,10 +4,15 @@ import { values } from 'lodash' | |||
4 | import 'multer' | 4 | import 'multer' |
5 | import * as validator from 'validator' | 5 | import * as validator from 'validator' |
6 | import { VideoRateType } from '../../../shared' | 6 | import { VideoRateType } from '../../../shared' |
7 | import { CONSTRAINTS_FIELDS, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_RATE_TYPES } from '../../initializers' | 7 | import { |
8 | import { VIDEO_PRIVACIES } from '../../initializers/constants' | 8 | CONSTRAINTS_FIELDS, |
9 | import { database as db } from '../../initializers/database' | 9 | VIDEO_CATEGORIES, |
10 | import { VideoInstance } from '../../models/video/video-interface' | 10 | VIDEO_LANGUAGES, |
11 | VIDEO_LICENCES, | ||
12 | VIDEO_PRIVACIES, | ||
13 | VIDEO_RATE_TYPES | ||
14 | } from '../../initializers' | ||
15 | import { VideoModel } from '../../models/video/video' | ||
11 | import { exists, isArray } from './misc' | 16 | import { exists, isArray } from './misc' |
12 | 17 | ||
13 | const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS | 18 | const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS |
@@ -100,12 +105,12 @@ function isVideoFileSizeValid (value: string) { | |||
100 | } | 105 | } |
101 | 106 | ||
102 | async function isVideoExist (id: string, res: Response) { | 107 | async function isVideoExist (id: string, res: Response) { |
103 | let video: VideoInstance | 108 | let video: VideoModel |
104 | 109 | ||
105 | if (validator.isInt(id)) { | 110 | if (validator.isInt(id)) { |
106 | video = await db.Video.loadAndPopulateAccountAndServerAndTags(+id) | 111 | video = await VideoModel.loadAndPopulateAccountAndServerAndTags(+id) |
107 | } else { // UUID | 112 | } else { // UUID |
108 | video = await db.Video.loadByUUIDAndPopulateAccountAndServerAndTags(id) | 113 | video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(id) |
109 | } | 114 | } |
110 | 115 | ||
111 | if (!video) { | 116 | if (!video) { |
diff --git a/server/helpers/custom-validators/webfinger.ts b/server/helpers/custom-validators/webfinger.ts index e93115d81..38f6b938d 100644 --- a/server/helpers/custom-validators/webfinger.ts +++ b/server/helpers/custom-validators/webfinger.ts | |||
@@ -1,6 +1,4 @@ | |||
1 | import 'express-validator' | 1 | import { CONFIG } from '../../initializers' |
2 | import 'multer' | ||
3 | import { CONFIG } from '../../initializers/constants' | ||
4 | import { exists } from './misc' | 2 | import { exists } from './misc' |
5 | 3 | ||
6 | function isWebfingerResourceValid (value: string) { | 4 | function isWebfingerResourceValid (value: string) { |
@@ -13,9 +11,7 @@ function isWebfingerResourceValid (value: string) { | |||
13 | 11 | ||
14 | const host = accountParts[1] | 12 | const host = accountParts[1] |
15 | 13 | ||
16 | if (host !== CONFIG.WEBSERVER.HOST) return false | 14 | return host === CONFIG.WEBSERVER.HOST |
17 | |||
18 | return true | ||
19 | } | 15 | } |
20 | 16 | ||
21 | // --------------------------------------------------------------------------- | 17 | // --------------------------------------------------------------------------- |
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts index 8ad205961..c2581f460 100644 --- a/server/helpers/ffmpeg-utils.ts +++ b/server/helpers/ffmpeg-utils.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as ffmpeg from 'fluent-ffmpeg' | 1 | import * as ffmpeg from 'fluent-ffmpeg' |
2 | import { VideoResolution } from '../../shared/models/videos/video-resolution.enum' | 2 | import { VideoResolution } from '../../shared/models/videos' |
3 | import { CONFIG } from '../initializers' | 3 | import { CONFIG } from '../initializers' |
4 | 4 | ||
5 | function getVideoFileHeight (path: string) { | 5 | function getVideoFileHeight (path: string) { |
diff --git a/server/helpers/index.ts b/server/helpers/index.ts index 2c7ac3954..d96bc48e9 100644 --- a/server/helpers/index.ts +++ b/server/helpers/index.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | export * from './activitypub' | 1 | export * from './activitypub' |
2 | export * from './core-utils' | 2 | export * from './core-utils' |
3 | export * from './logger' | 3 | export * from './logger' |
4 | export * from './custom-validators' | ||
5 | export * from './ffmpeg-utils' | 4 | export * from './ffmpeg-utils' |
6 | export * from './database-utils' | 5 | export * from './database-utils' |
7 | export * from './peertube-crypto' | 6 | export * from './peertube-crypto' |
diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts index 8d809d16d..2676133db 100644 --- a/server/helpers/logger.ts +++ b/server/helpers/logger.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | import * as mkdirp from 'mkdirp' | 2 | import * as mkdirp from 'mkdirp' |
3 | import * as path from 'path' | 3 | import * as path from 'path' |
4 | import * as winston from 'winston' | 4 | import * as winston from 'winston' |
5 | import { CONFIG } from '../initializers/constants' | 5 | import { CONFIG } from '../initializers' |
6 | 6 | ||
7 | const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT | 7 | const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT |
8 | 8 | ||
diff --git a/server/helpers/peertube-crypto.ts b/server/helpers/peertube-crypto.ts index 74e4cc703..c4c735cb8 100644 --- a/server/helpers/peertube-crypto.ts +++ b/server/helpers/peertube-crypto.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { BCRYPT_SALT_SIZE, PRIVATE_RSA_KEY_SIZE } from '../initializers' | 1 | import { BCRYPT_SALT_SIZE, PRIVATE_RSA_KEY_SIZE } from '../initializers' |
2 | import { AccountInstance } from '../models/account/account-interface' | 2 | import { AccountModel } from '../models/account/account' |
3 | import { bcryptComparePromise, bcryptGenSaltPromise, bcryptHashPromise, createPrivateKey, getPublicKey } from './core-utils' | 3 | import { bcryptComparePromise, bcryptGenSaltPromise, bcryptHashPromise, createPrivateKey, getPublicKey } from './core-utils' |
4 | import { jsig } from './custom-jsonld-signature' | 4 | import { jsig } from './custom-jsonld-signature' |
5 | import { logger } from './logger' | 5 | import { logger } from './logger' |
@@ -13,7 +13,7 @@ async function createPrivateAndPublicKeys () { | |||
13 | return { privateKey: key, publicKey } | 13 | return { privateKey: key, publicKey } |
14 | } | 14 | } |
15 | 15 | ||
16 | function isSignatureVerified (fromAccount: AccountInstance, signedDocument: object) { | 16 | function isSignatureVerified (fromAccount: AccountModel, signedDocument: object) { |
17 | const publicKeyObject = { | 17 | const publicKeyObject = { |
18 | '@context': jsig.SECURITY_CONTEXT_URL, | 18 | '@context': jsig.SECURITY_CONTEXT_URL, |
19 | '@id': fromAccount.url, | 19 | '@id': fromAccount.url, |
@@ -40,7 +40,7 @@ function isSignatureVerified (fromAccount: AccountInstance, signedDocument: obje | |||
40 | }) | 40 | }) |
41 | } | 41 | } |
42 | 42 | ||
43 | function signObject (byAccount: AccountInstance, data: any) { | 43 | function signObject (byAccount: AccountModel, data: any) { |
44 | const options = { | 44 | const options = { |
45 | privateKeyPem: byAccount.privateKey, | 45 | privateKeyPem: byAccount.privateKey, |
46 | creator: byAccount.url | 46 | creator: byAccount.url |
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts index 3464341e6..cb5e536b8 100644 --- a/server/helpers/utils.ts +++ b/server/helpers/utils.ts | |||
@@ -1,9 +1,10 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import * as Sequelize from 'sequelize' | 2 | import { Model } from 'sequelize-typescript' |
3 | import { ResultList } from '../../shared' | 3 | import { ResultList } from '../../shared' |
4 | import { VideoResolution } from '../../shared/models/videos/video-resolution.enum' | 4 | import { VideoResolution } from '../../shared/models/videos' |
5 | import { CONFIG, database as db } from '../initializers' | 5 | import { CONFIG } from '../initializers' |
6 | import { AccountInstance } from '../models/account/account-interface' | 6 | import { AccountModel } from '../models/account/account' |
7 | import { UserModel } from '../models/account/user' | ||
7 | import { pseudoRandomBytesPromise } from './core-utils' | 8 | import { pseudoRandomBytesPromise } from './core-utils' |
8 | import { logger } from './logger' | 9 | import { logger } from './logger' |
9 | 10 | ||
@@ -46,7 +47,7 @@ async function isSignupAllowed () { | |||
46 | return true | 47 | return true |
47 | } | 48 | } |
48 | 49 | ||
49 | const totalUsers = await db.User.countTotal() | 50 | const totalUsers = await UserModel.countTotal() |
50 | 51 | ||
51 | return totalUsers < CONFIG.SIGNUP.LIMIT | 52 | return totalUsers < CONFIG.SIGNUP.LIMIT |
52 | } | 53 | } |
@@ -72,17 +73,17 @@ function computeResolutionsToTranscode (videoFileHeight: number) { | |||
72 | return resolutionsEnabled | 73 | return resolutionsEnabled |
73 | } | 74 | } |
74 | 75 | ||
75 | function resetSequelizeInstance (instance: Sequelize.Instance<any>, savedFields: object) { | 76 | function resetSequelizeInstance (instance: Model<any>, savedFields: object) { |
76 | Object.keys(savedFields).forEach(key => { | 77 | Object.keys(savedFields).forEach(key => { |
77 | const value = savedFields[key] | 78 | const value = savedFields[key] |
78 | instance.set(key, value) | 79 | instance.set(key, value) |
79 | }) | 80 | }) |
80 | } | 81 | } |
81 | 82 | ||
82 | let serverAccount: AccountInstance | 83 | let serverAccount: AccountModel |
83 | async function getServerAccount () { | 84 | async function getServerAccount () { |
84 | if (serverAccount === undefined) { | 85 | if (serverAccount === undefined) { |
85 | serverAccount = await db.Account.loadApplication() | 86 | serverAccount = await AccountModel.loadApplication() |
86 | } | 87 | } |
87 | 88 | ||
88 | if (!serverAccount) { | 89 | if (!serverAccount) { |
diff --git a/server/helpers/webfinger.ts b/server/helpers/webfinger.ts index ab2888981..d98068cd7 100644 --- a/server/helpers/webfinger.ts +++ b/server/helpers/webfinger.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import * as WebFinger from 'webfinger.js' | 1 | import * as WebFinger from 'webfinger.js' |
2 | import { WebFingerData } from '../../shared' | 2 | import { WebFingerData } from '../../shared' |
3 | import { fetchRemoteAccount } from '../lib/activitypub/account' | 3 | import { fetchRemoteAccount } from '../lib/activitypub' |
4 | import { isTestInstance } from './core-utils' | 4 | import { isTestInstance } from './core-utils' |
5 | import { isActivityPubUrlValid } from './custom-validators' | 5 | import { isActivityPubUrlValid } from './custom-validators/activitypub' |
6 | 6 | ||
7 | const webfinger = new WebFinger({ | 7 | const webfinger = new WebFinger({ |
8 | webfist_fallback: false, | 8 | webfist_fallback: false, |