aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/shared/shared-video-miniature/videos-list.component.ts2
-rw-r--r--server/initializers/constants.ts20
-rw-r--r--server/initializers/migrations/0755-unique-viewer-url.ts27
-rw-r--r--server/models/view/local-video-viewer.ts4
4 files changed, 34 insertions, 19 deletions
diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.ts b/client/src/app/shared/shared-video-miniature/videos-list.component.ts
index a423377de..7b832263e 100644
--- a/client/src/app/shared/shared-video-miniature/videos-list.component.ts
+++ b/client/src/app/shared/shared-video-miniature/videos-list.component.ts
@@ -415,8 +415,6 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy {
415 .pipe(concatMap(({ reset, obs }) => obs.pipe(map(({ data }) => ({ data, reset }))))) 415 .pipe(concatMap(({ reset, obs }) => obs.pipe(map(({ data }) => ({ data, reset })))))
416 .subscribe({ 416 .subscribe({
417 next: ({ data, reset }) => { 417 next: ({ data, reset }) => {
418 console.log(data[0].name)
419
420 this.hasDoneFirstQuery = true 418 this.hasDoneFirstQuery = true
421 this.lastQueryLength = data.length 419 this.lastQueryLength = data.length
422 420
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 2ef3da2e7..54380f7bf 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -6,7 +6,6 @@ import { randomInt, root } from '@shared/core-utils'
6import { 6import {
7 AbuseState, 7 AbuseState,
8 JobType, 8 JobType,
9 UserRegistrationState,
10 VideoChannelSyncState, 9 VideoChannelSyncState,
11 VideoImportState, 10 VideoImportState,
12 VideoPrivacy, 11 VideoPrivacy,
@@ -26,7 +25,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
26 25
27// --------------------------------------------------------------------------- 26// ---------------------------------------------------------------------------
28 27
29const LAST_MIGRATION_VERSION = 750 28const LAST_MIGRATION_VERSION = 755
30 29
31// --------------------------------------------------------------------------- 30// ---------------------------------------------------------------------------
32 31
@@ -79,8 +78,6 @@ const SORTABLE_COLUMNS = {
79 ACCOUNT_FOLLOWERS: [ 'createdAt' ], 78 ACCOUNT_FOLLOWERS: [ 'createdAt' ],
80 CHANNEL_FOLLOWERS: [ 'createdAt' ], 79 CHANNEL_FOLLOWERS: [ 'createdAt' ],
81 80
82 USER_REGISTRATIONS: [ 'createdAt', 'state' ],
83
84 VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'originallyPublishedAt', 'views', 'likes', 'trending', 'hot', 'best' ], 81 VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'originallyPublishedAt', 'views', 'likes', 'trending', 'hot', 'best' ],
85 82
86 // Don't forget to update peertube-search-index with the same values 83 // Don't forget to update peertube-search-index with the same values
@@ -293,10 +290,6 @@ const CONSTRAINTS_FIELDS = {
293 ABUSE_MESSAGES: { 290 ABUSE_MESSAGES: {
294 MESSAGE: { min: 2, max: 3000 } // Length 291 MESSAGE: { min: 2, max: 3000 } // Length
295 }, 292 },
296 USER_REGISTRATIONS: {
297 REASON_MESSAGE: { min: 2, max: 3000 }, // Length
298 MODERATOR_MESSAGE: { min: 2, max: 3000 } // Length
299 },
300 VIDEO_BLACKLIST: { 293 VIDEO_BLACKLIST: {
301 REASON: { min: 2, max: 300 } // Length 294 REASON: { min: 2, max: 300 } // Length
302 }, 295 },
@@ -523,12 +516,6 @@ const ABUSE_STATES: { [ id in AbuseState ]: string } = {
523 [AbuseState.ACCEPTED]: 'Accepted' 516 [AbuseState.ACCEPTED]: 'Accepted'
524} 517}
525 518
526const USER_REGISTRATION_STATES: { [ id in UserRegistrationState ]: string } = {
527 [UserRegistrationState.PENDING]: 'Pending',
528 [UserRegistrationState.REJECTED]: 'Rejected',
529 [UserRegistrationState.ACCEPTED]: 'Accepted'
530}
531
532const VIDEO_PLAYLIST_PRIVACIES: { [ id in VideoPlaylistPrivacy ]: string } = { 519const VIDEO_PLAYLIST_PRIVACIES: { [ id in VideoPlaylistPrivacy ]: string } = {
533 [VideoPlaylistPrivacy.PUBLIC]: 'Public', 520 [VideoPlaylistPrivacy.PUBLIC]: 'Public',
534 [VideoPlaylistPrivacy.UNLISTED]: 'Unlisted', 521 [VideoPlaylistPrivacy.UNLISTED]: 'Unlisted',
@@ -673,7 +660,7 @@ const USER_PASSWORD_CREATE_LIFETIME = 60000 * 60 * 24 * 7 // 7 days
673 660
674const TWO_FACTOR_AUTH_REQUEST_TOKEN_LIFETIME = 60000 * 10 // 10 minutes 661const TWO_FACTOR_AUTH_REQUEST_TOKEN_LIFETIME = 60000 * 10 // 10 minutes
675 662
676const EMAIL_VERIFY_LIFETIME = 60000 * 60 // 60 minutes 663const USER_EMAIL_VERIFY_LIFETIME = 60000 * 60 // 60 minutes
677 664
678const NSFW_POLICY_TYPES: { [ id: string ]: NSFWPolicyType } = { 665const NSFW_POLICY_TYPES: { [ id: string ]: NSFWPolicyType } = {
679 DO_NOT_LIST: 'do_not_list', 666 DO_NOT_LIST: 'do_not_list',
@@ -1082,14 +1069,13 @@ export {
1082 VIDEO_TRANSCODING_FPS, 1069 VIDEO_TRANSCODING_FPS,
1083 FFMPEG_NICE, 1070 FFMPEG_NICE,
1084 ABUSE_STATES, 1071 ABUSE_STATES,
1085 USER_REGISTRATION_STATES,
1086 LRU_CACHE, 1072 LRU_CACHE,
1087 REQUEST_TIMEOUTS, 1073 REQUEST_TIMEOUTS,
1088 MAX_LOCAL_VIEWER_WATCH_SECTIONS, 1074 MAX_LOCAL_VIEWER_WATCH_SECTIONS,
1089 USER_PASSWORD_RESET_LIFETIME, 1075 USER_PASSWORD_RESET_LIFETIME,
1090 USER_PASSWORD_CREATE_LIFETIME, 1076 USER_PASSWORD_CREATE_LIFETIME,
1091 MEMOIZE_TTL, 1077 MEMOIZE_TTL,
1092 EMAIL_VERIFY_LIFETIME, 1078 USER_EMAIL_VERIFY_LIFETIME,
1093 OVERVIEWS, 1079 OVERVIEWS,
1094 SCHEDULER_INTERVALS_MS, 1080 SCHEDULER_INTERVALS_MS,
1095 REPEAT_JOBS, 1081 REPEAT_JOBS,
diff --git a/server/initializers/migrations/0755-unique-viewer-url.ts b/server/initializers/migrations/0755-unique-viewer-url.ts
new file mode 100644
index 000000000..b3dff9258
--- /dev/null
+++ b/server/initializers/migrations/0755-unique-viewer-url.ts
@@ -0,0 +1,27 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
7 db: any
8}): Promise<void> {
9 const { transaction } = utils
10
11 const query = 'DELETE FROM "localVideoViewer" t1 ' +
12 'USING (SELECT MIN(id) as id, "url" FROM "localVideoViewer" GROUP BY "url" HAVING COUNT(*) > 1) t2 ' +
13 'WHERE t1."url" = t2."url" AND t1.id <> t2.id'
14
15 await utils.sequelize.query(query, { transaction })
16}
17
18async function down (utils: {
19 queryInterface: Sequelize.QueryInterface
20 transaction: Sequelize.Transaction
21}) {
22}
23
24export {
25 up,
26 down
27}
diff --git a/server/models/view/local-video-viewer.ts b/server/models/view/local-video-viewer.ts
index 9d0d89a59..274117e86 100644
--- a/server/models/view/local-video-viewer.ts
+++ b/server/models/view/local-video-viewer.ts
@@ -21,6 +21,10 @@ import { LocalVideoViewerWatchSectionModel } from './local-video-viewer-watch-se
21 indexes: [ 21 indexes: [
22 { 22 {
23 fields: [ 'videoId' ] 23 fields: [ 'videoId' ]
24 },
25 {
26 fields: [ 'url' ],
27 unique: true
24 } 28 }
25 ] 29 ]
26}) 30})