]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/thumbnail.ts
Merge branch 'release/4.2.0' into develop
[github/Chocobozzz/PeerTube.git] / server / models / video / thumbnail.ts
index 9533c8d1920a7ab0798368655dbd8a29059e7ef2..05c58cf19cc57b5bd494b9b82f37dffb0a06ad54 100644 (file)
@@ -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<Partial<AttributesOnly<ThumbnailModel>>> {
 
   @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 () {