diff options
-rw-r--r-- | package.json | 4 | ||||
-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 | ||||
-rw-r--r-- | yarn.lock | 15 |
6 files changed, 16 insertions, 22 deletions
diff --git a/package.json b/package.json index 352f393bb..c6e2ce56a 100644 --- a/package.json +++ b/package.json | |||
@@ -117,7 +117,7 @@ | |||
117 | "js-yaml": "^4.0.0", | 117 | "js-yaml": "^4.0.0", |
118 | "jsonld": "~5.2.0", | 118 | "jsonld": "~5.2.0", |
119 | "lodash": "^4.17.10", | 119 | "lodash": "^4.17.10", |
120 | "lru-cache": "^7.3.0", | 120 | "lru-cache": "6", |
121 | "magnet-uri": "^6.1.0", | 121 | "magnet-uri": "^6.1.0", |
122 | "markdown-it": "^12.0.4", | 122 | "markdown-it": "^12.0.4", |
123 | "markdown-it-emoji": "^2.0.0", | 123 | "markdown-it-emoji": "^2.0.0", |
@@ -137,7 +137,7 @@ | |||
137 | "redis": "^4.0.1", | 137 | "redis": "^4.0.1", |
138 | "reflect-metadata": "^0.1.12", | 138 | "reflect-metadata": "^0.1.12", |
139 | "sanitize-html": "2.x", | 139 | "sanitize-html": "2.x", |
140 | "sequelize": "6.16.1", | 140 | "sequelize": "6.15.1", |
141 | "sequelize-typescript": "^2.0.0-beta.1", | 141 | "sequelize-typescript": "^2.0.0-beta.1", |
142 | "short-uuid": "^4.2.0", | 142 | "short-uuid": "^4.2.0", |
143 | "sitemap": "^7.0.0", | 143 | "sitemap": "^7.0.0", |
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 | { |
@@ -5639,18 +5639,13 @@ lru-cache@4.1.x: | |||
5639 | pseudomap "^1.0.2" | 5639 | pseudomap "^1.0.2" |
5640 | yallist "^2.1.2" | 5640 | yallist "^2.1.2" |
5641 | 5641 | ||
5642 | lru-cache@^6.0.0: | 5642 | lru-cache@6, lru-cache@^6.0.0: |
5643 | version "6.0.0" | 5643 | version "6.0.0" |
5644 | resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" | 5644 | resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" |
5645 | integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== | 5645 | integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== |
5646 | dependencies: | 5646 | dependencies: |
5647 | yallist "^4.0.0" | 5647 | yallist "^4.0.0" |
5648 | 5648 | ||
5649 | lru-cache@^7.3.0: | ||
5650 | version "7.3.0" | ||
5651 | resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.3.0.tgz#475ed4a39610204d8d23b243e902ed074dd8052d" | ||
5652 | integrity sha512-itGqsGM9i3Jt0ZbEkYRKQ3K/Q61vOLNuUkmK0jyjt1VH76gfcvjHmPC6e9uvjSrKOP2aN3T9L1vN0nxQSkrAjA== | ||
5653 | |||
5654 | lru-queue@^0.1.0: | 5649 | lru-queue@^0.1.0: |
5655 | version "0.1.0" | 5650 | version "0.1.0" |
5656 | resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" | 5651 | resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" |
@@ -7506,10 +7501,10 @@ sequelize-typescript@^2.0.0-beta.1: | |||
7506 | dependencies: | 7501 | dependencies: |
7507 | glob "7.2.0" | 7502 | glob "7.2.0" |
7508 | 7503 | ||
7509 | sequelize@6.16.1: | 7504 | sequelize@6.15.1: |
7510 | version "6.16.1" | 7505 | version "6.15.1" |
7511 | resolved "https://registry.yarnpkg.com/sequelize/-/sequelize-6.16.1.tgz#2c84036ae0a64843cdfa52c8e3d0bee9c52ce116" | 7506 | resolved "https://registry.yarnpkg.com/sequelize/-/sequelize-6.15.1.tgz#6fa2515564b04c87d355d0b54bf94910e411d140" |
7512 | integrity sha512-YFGqrwkmEhSbpZBxay5+PRKMiZNNUJzgIixCyFkLm9+/5Rqq5jBADEjTAC8RYHzwsOGNboYh18imXrYNCjBZCQ== | 7507 | integrity sha512-UR4LMSnZ13pYL4gNOXxbmreIX1pqanSgAKy4hWjQupHHLOzF3ryckg92axirB68QJy4gaVIaknjhoO3M8zKo8A== |
7513 | dependencies: | 7508 | dependencies: |
7514 | "@types/debug" "^4.1.7" | 7509 | "@types/debug" "^4.1.7" |
7515 | debug "^4.3.3" | 7510 | debug "^4.3.3" |