X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fthumbnail.ts;h=05c58cf19cc57b5bd494b9b82f37dffb0a06ad54;hb=0c9a83546687d2ae80b3f5299a8ee59d741f894f;hp=9533c8d1920a7ab0798368655dbd8a29059e7ef2;hpb=90a8bd305de4153ec21137a73ff482dcc2e3e19b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/thumbnail.ts b/server/models/video/thumbnail.ts index 9533c8d19..05c58cf19 100644 --- a/server/models/video/thumbnail.ts +++ b/server/models/video/thumbnail.ts @@ -15,9 +15,9 @@ import { Table, UpdatedAt } from 'sequelize-typescript' -import { buildRemoteVideoBaseUrl } from '@server/helpers/activitypub' import { afterCommitIfTransaction } from '@server/helpers/database-utils' -import { MThumbnail, MThumbnailVideo, MVideoWithHost } from '@server/types/models' +import { MThumbnail, MThumbnailVideo, MVideo } from '@server/types/models' +import { AttributesOnly } from '@shared/typescript-utils' import { ThumbnailType } from '../../../shared/models/videos/thumbnail.type' import { logger } from '../../helpers/logger' import { CONFIG } from '../../initializers/config' @@ -41,7 +41,7 @@ import { VideoPlaylistModel } from './video-playlist' } ] }) -export class ThumbnailModel extends Model { +export class ThumbnailModel extends Model>> { @AllowNull(false) @Column @@ -164,14 +164,12 @@ export class ThumbnailModel extends Model { return join(directory, filename) } - getFileUrl (video: MVideoWithHost) { + getFileUrl (video: MVideo) { const staticPath = ThumbnailModel.types[this.type].staticPath + this.filename if (video.isOwned()) return WEBSERVER.URL + staticPath - if (this.fileUrl) return this.fileUrl - // Fallback if we don't have a file URL - return buildRemoteVideoBaseUrl(video, staticPath) + return this.fileUrl } getPath () {