From d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 28 Jun 2021 17:30:59 +0200 Subject: Support short uuid for GET video/playlist --- server/initializers/migrations/0080-video-channels.ts | 4 ++-- server/initializers/migrations/0345-video-playlists.ts | 4 ++-- server/initializers/migrations/0560-user-feed-token.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'server/initializers') 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 @@ +import { buildUUID } from '@server/helpers/uuid' import * as Sequelize from 'sequelize' -import { v4 as uuidv4 } from 'uuid' async function up (utils: { transaction: Sequelize.Transaction @@ -23,7 +23,7 @@ async function up (utils: { { const authors = await utils.db.Author.findAll() for (const author of authors) { - author.uuid = uuidv4() + author.uuid = buildUUID() await author.save() } } 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 @@ import * as Sequelize from 'sequelize' +import { buildUUID } from '@server/helpers/uuid' import { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos' -import { v4 as uuidv4 } from 'uuid' import { WEBSERVER } from '../constants' async function up (utils: { @@ -57,7 +57,7 @@ CREATE TABLE IF NOT EXISTS "videoPlaylistElement" const usernames = userResult.map(r => r.username) for (const username of usernames) { - const uuid = uuidv4() + const uuid = buildUUID() const baseUrl = WEBSERVER.URL + '/video-playlists/' + uuid 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 @@ import * as Sequelize from 'sequelize' -import { v4 as uuidv4 } from 'uuid' +import { buildUUID } from '@server/helpers/uuid' async function up (utils: { transaction: Sequelize.Transaction @@ -26,7 +26,7 @@ async function up (utils: { const users = await utils.sequelize.query(query, options) for (const user of users) { - const queryUpdate = `UPDATE "user" SET "feedToken" = '${uuidv4()}' WHERE id = ${user.id}` + const queryUpdate = `UPDATE "user" SET "feedToken" = '${buildUUID()}' WHERE id = ${user.id}` await utils.sequelize.query(queryUpdate) } } -- cgit v1.2.3