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 --- .../src/app/shared/shared-main/angular/link.component.ts | 2 +- .../shared/shared-main/users/user-notification.model.ts | 3 ++- client/src/app/shared/shared-main/video/video.model.ts | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) (limited to 'client/src/app/shared/shared-main') diff --git a/client/src/app/shared/shared-main/angular/link.component.ts b/client/src/app/shared/shared-main/angular/link.component.ts index 76d1201b9..597a16871 100644 --- a/client/src/app/shared/shared-main/angular/link.component.ts +++ b/client/src/app/shared/shared-main/angular/link.component.ts @@ -6,7 +6,7 @@ import { Component, Input, ViewEncapsulation } from '@angular/core' templateUrl: './link.component.html' }) export class LinkComponent { - @Input() internalLink?: any[] + @Input() internalLink?: string | any[] @Input() href?: string @Input() target?: string diff --git a/client/src/app/shared/shared-main/users/user-notification.model.ts b/client/src/app/shared/shared-main/users/user-notification.model.ts index c80bc13b0..4c15eb981 100644 --- a/client/src/app/shared/shared-main/users/user-notification.model.ts +++ b/client/src/app/shared/shared-main/users/user-notification.model.ts @@ -12,6 +12,7 @@ import { UserRight, VideoInfo } from '@shared/models' +import { Video } from '../video' export class UserNotification implements UserNotificationServer { id: number @@ -238,7 +239,7 @@ export class UserNotification implements UserNotificationServer { } private buildVideoUrl (video: { uuid: string }) { - return '/w/' + video.uuid + return Video.buildWatchUrl(video) } private buildAccountUrl (account: { name: string, host: string }) { diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts index ab8ed9051..f0a4a3f37 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts @@ -26,12 +26,18 @@ export class Video implements VideoServerModel { licence: VideoConstant language: VideoConstant privacy: VideoConstant + description: string + duration: number durationLabel: string + id: number uuid: string + shortUUID: string + isLocal: boolean + name: string serverHost: string thumbnailPath: string @@ -85,8 +91,12 @@ export class Video implements VideoServerModel { pluginData?: any - static buildClientUrl (videoUUID: string) { - return '/w/' + videoUUID + static buildWatchUrl (video: Partial>) { + return '/w/' + (video.shortUUID || video.uuid) + } + + static buildUpdateUrl (video: Pick) { + return '/videos/update/' + video.uuid } constructor (hash: VideoServerModel, translations = {}) { @@ -109,6 +119,7 @@ export class Video implements VideoServerModel { this.id = hash.id this.uuid = hash.uuid + this.shortUUID = hash.shortUUID this.isLocal = hash.isLocal this.name = hash.name -- cgit v1.2.3