ActivityPub-federated video streaming platform using P2P directly in your web browser
Convert to short UUIDs for plugin helpers
Chocobozzzccdfe7bf51db
diff --git a/server/core/helpers/custom-validators/misc.ts b/server/core/helpers/custom-validators/misc.tsindex 9f438fa3b7..3b5ae3190e 100644--- a/server/core/helpers/custom-validators/misc.ts+++ b/server/core/helpers/custom-validators/misc.ts@@ -125,10 +125,10 @@ export function checkMimetypeRegex (fileMimeType: string, mimeTypeRegex: string)// ----------------------------------------------------------------------------export function toCompleteUUID (value: string) {- if (isShortUUID(value)) {+export function toCompleteUUID<T extends string | number> (value: T) {+ if (isShortUUID(value + '')) {try {- return shortToUUID(value)+ return shortToUUID(value + '')} catch {return ''}@@ -137,7 +137,7 @@ export function toCompleteUUID (value: string) {return value}-export function toCompleteUUIDs (values: string[]) {+export function toCompleteUUIDs (values: (string | number)[]) {return values.map(v => toCompleteUUID(v))}diff --git a/server/core/helpers/decache.ts b/server/core/helpers/decache.tsindex 6c2c00b469..4543c41c1d 100644--- a/server/core/helpers/decache.ts+++ b/server/core/helpers/decache.ts@@ -11,8 +11,6 @@ export function decachePlugin (require: NodeJS.Require, libraryPath: string) {if (!moduleName) returnsearchCache(require, moduleName, function (mod) {- console.log(mod)-delete require.cache[mod.id]removeCachedPath(mod.path)diff --git a/server/core/lib/plugins/plugin-helpers-builder.ts b/server/core/lib/plugins/plugin-helpers-builder.tsindex 404879f073..37d0379643 100644--- a/server/core/lib/plugins/plugin-helpers-builder.ts+++ b/server/core/lib/plugins/plugin-helpers-builder.ts@@ -1,5 +1,6 @@import { ffprobePromise } from '@peertube/peertube-ffmpeg'import { FileStorage, VideoBlacklistCreate } from '@peertube/peertube-models'+import { toCompleteUUID } from '@server/helpers/custom-validators/misc.js'import { buildLogger } from '@server/helpers/logger.js'import { CONFIG } from '@server/initializers/config.js'import { WEBSERVER } from '@server/initializers/constants.js'@@ -85,11 +86,11 @@ function buildVideosHelpers () {},loadByIdOrUUID: (id: number | string) => {- return VideoModel.loadWithThumbnails(id)+ return VideoModel.loadWithThumbnails(toCompleteUUID(id))},loadByIdOrUUIDWithFiles: (id: number | string) => {- return VideoModel.loadWithFiles(id)+ return VideoModel.loadWithFiles(toCompleteUUID(id))},removeVideo: (id: number) => {