diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-28 17:30:59 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-06-29 14:56:35 +0200 |
commit | d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb (patch) | |
tree | a4cb07318100031951c3dffc61f4f2cb95d2cbd0 /server/initializers/migrations | |
parent | 62ddc31a9e4b92d7d27898ccfc363f68ab044139 (diff) | |
download | PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.gz PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.zst PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.zip |
Support short uuid for GET video/playlist
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r-- | server/initializers/migrations/0080-video-channels.ts | 4 | ||||
-rw-r--r-- | server/initializers/migrations/0345-video-playlists.ts | 4 | ||||
-rw-r--r-- | server/initializers/migrations/0560-user-feed-token.ts | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/server/initializers/migrations/0080-video-channels.ts b/server/initializers/migrations/0080-video-channels.ts index 883224cb0..0e6952350 100644 --- a/server/initializers/migrations/0080-video-channels.ts +++ b/server/initializers/migrations/0080-video-channels.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { buildUUID } from '@server/helpers/uuid' | ||
1 | import * as Sequelize from 'sequelize' | 2 | import * as Sequelize from 'sequelize' |
2 | import { v4 as uuidv4 } from 'uuid' | ||
3 | 3 | ||
4 | async function up (utils: { | 4 | async function up (utils: { |
5 | transaction: Sequelize.Transaction | 5 | transaction: Sequelize.Transaction |
@@ -23,7 +23,7 @@ async function up (utils: { | |||
23 | { | 23 | { |
24 | const authors = await utils.db.Author.findAll() | 24 | const authors = await utils.db.Author.findAll() |
25 | for (const author of authors) { | 25 | for (const author of authors) { |
26 | author.uuid = uuidv4() | 26 | author.uuid = buildUUID() |
27 | await author.save() | 27 | await author.save() |
28 | } | 28 | } |
29 | } | 29 | } |
diff --git a/server/initializers/migrations/0345-video-playlists.ts b/server/initializers/migrations/0345-video-playlists.ts index 89a14a6ee..8dd631dff 100644 --- a/server/initializers/migrations/0345-video-playlists.ts +++ b/server/initializers/migrations/0345-video-playlists.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import { buildUUID } from '@server/helpers/uuid' | ||
2 | import { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos' | 3 | import { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos' |
3 | import { v4 as uuidv4 } from 'uuid' | ||
4 | import { WEBSERVER } from '../constants' | 4 | import { WEBSERVER } from '../constants' |
5 | 5 | ||
6 | async function up (utils: { | 6 | async function up (utils: { |
@@ -57,7 +57,7 @@ CREATE TABLE IF NOT EXISTS "videoPlaylistElement" | |||
57 | const usernames = userResult.map(r => r.username) | 57 | const usernames = userResult.map(r => r.username) |
58 | 58 | ||
59 | for (const username of usernames) { | 59 | for (const username of usernames) { |
60 | const uuid = uuidv4() | 60 | const uuid = buildUUID() |
61 | 61 | ||
62 | const baseUrl = WEBSERVER.URL + '/video-playlists/' + uuid | 62 | const baseUrl = WEBSERVER.URL + '/video-playlists/' + uuid |
63 | const query = ` | 63 | const query = ` |
diff --git a/server/initializers/migrations/0560-user-feed-token.ts b/server/initializers/migrations/0560-user-feed-token.ts index 7c61def17..042301352 100644 --- a/server/initializers/migrations/0560-user-feed-token.ts +++ b/server/initializers/migrations/0560-user-feed-token.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import { v4 as uuidv4 } from 'uuid' | 2 | import { buildUUID } from '@server/helpers/uuid' |
3 | 3 | ||
4 | async function up (utils: { | 4 | async function up (utils: { |
5 | transaction: Sequelize.Transaction | 5 | transaction: Sequelize.Transaction |
@@ -26,7 +26,7 @@ async function up (utils: { | |||
26 | const users = await utils.sequelize.query<any>(query, options) | 26 | const users = await utils.sequelize.query<any>(query, options) |
27 | 27 | ||
28 | for (const user of users) { | 28 | for (const user of users) { |
29 | const queryUpdate = `UPDATE "user" SET "feedToken" = '${uuidv4()}' WHERE id = ${user.id}` | 29 | const queryUpdate = `UPDATE "user" SET "feedToken" = '${buildUUID()}' WHERE id = ${user.id}` |
30 | await utils.sequelize.query(queryUpdate) | 30 | await utils.sequelize.query(queryUpdate) |
31 | } | 31 | } |
32 | } | 32 | } |