diff options
author | Chocobozzz <me@florianbigard.com> | 2022-02-09 17:48:15 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-02-09 17:48:15 +0100 |
commit | 9d8ef212ff46cc1b96dc407a85e7486f185c5179 (patch) | |
tree | 61fd2a1a03f84d5fefc6f257fc358b637c791a24 /server | |
parent | 57a9b61a4aeead74e8800bbfad82ef433313b204 (diff) | |
download | PeerTube-9d8ef212ff46cc1b96dc407a85e7486f185c5179.tar.gz PeerTube-9d8ef212ff46cc1b96dc407a85e7486f185c5179.tar.zst PeerTube-9d8ef212ff46cc1b96dc407a85e7486f185c5179.zip |
Fix broken dep
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/auth/oauth-model.ts | 3 | ||||
-rw-r--r-- | server/models/user/user.ts | 6 | ||||
-rw-r--r-- | server/models/utils.ts | 5 | ||||
-rw-r--r-- | server/models/video/video-file.ts | 5 |
4 files changed, 9 insertions, 10 deletions
diff --git a/server/lib/auth/oauth-model.ts b/server/lib/auth/oauth-model.ts index 81b6529d8..5d68f44e9 100644 --- a/server/lib/auth/oauth-model.ts +++ b/server/lib/auth/oauth-model.ts | |||
@@ -9,9 +9,9 @@ import { UserAdminFlag } from '@shared/models/users/user-flag.model' | |||
9 | import { UserRole } from '@shared/models/users/user-role' | 9 | import { UserRole } from '@shared/models/users/user-role' |
10 | import { logger } from '../../helpers/logger' | 10 | import { logger } from '../../helpers/logger' |
11 | import { CONFIG } from '../../initializers/config' | 11 | import { CONFIG } from '../../initializers/config' |
12 | import { UserModel } from '../../models/user/user' | ||
13 | import { OAuthClientModel } from '../../models/oauth/oauth-client' | 12 | import { OAuthClientModel } from '../../models/oauth/oauth-client' |
14 | import { OAuthTokenModel } from '../../models/oauth/oauth-token' | 13 | import { OAuthTokenModel } from '../../models/oauth/oauth-token' |
14 | import { UserModel } from '../../models/user/user' | ||
15 | import { createUserAccountAndChannelAndPlaylist } from '../user' | 15 | import { createUserAccountAndChannelAndPlaylist } from '../user' |
16 | import { TokensCache } from './tokens-cache' | 16 | import { TokensCache } from './tokens-cache' |
17 | 17 | ||
@@ -116,6 +116,7 @@ async function getUser (usernameOrEmail?: string, password?: string, bypassLogin | |||
116 | logger.debug('Getting User (username/email: ' + usernameOrEmail + ', password: ******).') | 116 | logger.debug('Getting User (username/email: ' + usernameOrEmail + ', password: ******).') |
117 | 117 | ||
118 | const user = await UserModel.loadByUsernameOrEmail(usernameOrEmail) | 118 | const user = await UserModel.loadByUsernameOrEmail(usernameOrEmail) |
119 | |||
119 | // If we don't find the user, or if the user belongs to a plugin | 120 | // If we don't find the user, or if the user belongs to a plugin |
120 | if (!user || user.pluginAuth !== null || !password) return null | 121 | if (!user || user.pluginAuth !== null || !password) return null |
121 | 122 | ||
diff --git a/server/models/user/user.ts b/server/models/user/user.ts index e7bf22806..ad8ce08cb 100644 --- a/server/models/user/user.ts +++ b/server/models/user/user.ts | |||
@@ -48,14 +48,14 @@ import { | |||
48 | isUserEmailVerifiedValid, | 48 | isUserEmailVerifiedValid, |
49 | isUserNoModal, | 49 | isUserNoModal, |
50 | isUserNSFWPolicyValid, | 50 | isUserNSFWPolicyValid, |
51 | isUserP2PEnabledValid, | ||
51 | isUserPasswordValid, | 52 | isUserPasswordValid, |
52 | isUserRoleValid, | 53 | isUserRoleValid, |
53 | isUserUsernameValid, | 54 | isUserUsernameValid, |
54 | isUserVideoLanguages, | 55 | isUserVideoLanguages, |
55 | isUserVideoQuotaDailyValid, | 56 | isUserVideoQuotaDailyValid, |
56 | isUserVideoQuotaValid, | 57 | isUserVideoQuotaValid, |
57 | isUserVideosHistoryEnabledValid, | 58 | isUserVideosHistoryEnabledValid |
58 | isUserP2PEnabledValid | ||
59 | } from '../../helpers/custom-validators/users' | 59 | } from '../../helpers/custom-validators/users' |
60 | import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto' | 60 | import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto' |
61 | import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants' | 61 | import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants' |
@@ -623,7 +623,7 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> { | |||
623 | const query = { | 623 | const query = { |
624 | where: { | 624 | where: { |
625 | [Op.or]: [ | 625 | [Op.or]: [ |
626 | where(fn('lower', col('username')), '=', fn('lower', username)), | 626 | where(fn('lower', col('username')), fn('lower', username) as any), |
627 | 627 | ||
628 | { email } | 628 | { email } |
629 | ] | 629 | ] |
diff --git a/server/models/utils.ts b/server/models/utils.ts index 0950f5f32..66b653e3d 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { literal, Op, OrderItem, Sequelize } from 'sequelize' | 1 | import { literal, Op, OrderItem, Sequelize } from 'sequelize' |
2 | import { Col } from 'sequelize/types/utils' | ||
3 | import validator from 'validator' | 2 | import validator from 'validator' |
4 | 3 | ||
5 | type SortType = { sortModel: string, sortValue: string } | 4 | type SortType = { sortModel: string, sortValue: string } |
@@ -8,7 +7,7 @@ type SortType = { sortModel: string, sortValue: string } | |||
8 | function getSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] { | 7 | function getSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] { |
9 | const { direction, field } = buildDirectionAndField(value) | 8 | const { direction, field } = buildDirectionAndField(value) |
10 | 9 | ||
11 | let finalField: string | Col | 10 | let finalField: string | ReturnType<typeof Sequelize.col> |
12 | 11 | ||
13 | if (field.toLowerCase() === 'match') { // Search | 12 | if (field.toLowerCase() === 'match') { // Search |
14 | finalField = Sequelize.col('similarity') | 13 | finalField = Sequelize.col('similarity') |
@@ -65,7 +64,7 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Or | |||
65 | ] | 64 | ] |
66 | } | 65 | } |
67 | 66 | ||
68 | let finalField: string | Col | 67 | let finalField: string | ReturnType<typeof Sequelize.col> |
69 | 68 | ||
70 | // Alias | 69 | // Alias |
71 | if (field.toLowerCase() === 'match') { // Search | 70 | if (field.toLowerCase() === 'match') { // Search |
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts index 1a9f4561a..fae76c6f2 100644 --- a/server/models/video/video-file.ts +++ b/server/models/video/video-file.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { remove } from 'fs-extra' | 1 | import { remove } from 'fs-extra' |
2 | import memoizee from 'memoizee' | 2 | import memoizee from 'memoizee' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { FindOptions, Op, Transaction } from 'sequelize' | 4 | import { FindOptions, Op, Transaction, WhereOptions } from 'sequelize' |
5 | import { | 5 | import { |
6 | AllowNull, | 6 | AllowNull, |
7 | BelongsTo, | 7 | BelongsTo, |
@@ -18,7 +18,6 @@ import { | |||
18 | Table, | 18 | Table, |
19 | UpdatedAt | 19 | UpdatedAt |
20 | } from 'sequelize-typescript' | 20 | } from 'sequelize-typescript' |
21 | import { Where } from 'sequelize/types/utils' | ||
22 | import validator from 'validator' | 21 | import validator from 'validator' |
23 | import { buildRemoteVideoBaseUrl } from '@server/helpers/activitypub' | 22 | import { buildRemoteVideoBaseUrl } from '@server/helpers/activitypub' |
24 | import { logger } from '@server/helpers/logger' | 23 | import { logger } from '@server/helpers/logger' |
@@ -70,7 +69,7 @@ export enum ScopeNames { | |||
70 | } | 69 | } |
71 | ] | 70 | ] |
72 | }, | 71 | }, |
73 | [ScopeNames.WITH_VIDEO_OR_PLAYLIST]: (options: { whereVideo?: Where } = {}) => { | 72 | [ScopeNames.WITH_VIDEO_OR_PLAYLIST]: (options: { whereVideo?: WhereOptions } = {}) => { |
74 | return { | 73 | return { |
75 | include: [ | 74 | include: [ |
76 | { | 75 | { |