diff options
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/account/actor-image.ts | 5 | ||||
-rw-r--r-- | server/models/video/video.ts | 9 |
2 files changed, 5 insertions, 9 deletions
diff --git a/server/models/account/actor-image.ts b/server/models/account/actor-image.ts index b779e3cf6..f7438991a 100644 --- a/server/models/account/actor-image.ts +++ b/server/models/account/actor-image.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { remove } from 'fs-extra' | 1 | import { remove } from 'fs-extra' |
2 | import { join } from 'path' | 2 | import { join } from 'path' |
3 | import { AfterDestroy, AllowNull, Column, CreatedAt, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' | 3 | import { AfterDestroy, AllowNull, Column, CreatedAt, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' |
4 | import { v4 as uuidv4 } from 'uuid' | ||
4 | import { MActorImageFormattable } from '@server/types/models' | 5 | import { MActorImageFormattable } from '@server/types/models' |
5 | import { ActorImageType } from '@shared/models' | 6 | import { ActorImageType } from '@shared/models' |
6 | import { ActorImage } from '../../../shared/models/actors/actor-image.model' | 7 | import { ActorImage } from '../../../shared/models/actors/actor-image.model' |
@@ -53,6 +54,10 @@ export class ActorImageModel extends Model { | |||
53 | .catch(err => logger.error('Cannot remove actor image file %s.', instance.filename, err)) | 54 | .catch(err => logger.error('Cannot remove actor image file %s.', instance.filename, err)) |
54 | } | 55 | } |
55 | 56 | ||
57 | static generateFilename () { | ||
58 | return uuidv4() + '.jpg' | ||
59 | } | ||
60 | |||
56 | static loadByName (filename: string) { | 61 | static loadByName (filename: string) { |
57 | const query = { | 62 | const query = { |
58 | where: { | 63 | where: { |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 086269921..b10c6e38e 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -24,7 +24,6 @@ import { | |||
24 | Table, | 24 | Table, |
25 | UpdatedAt | 25 | UpdatedAt |
26 | } from 'sequelize-typescript' | 26 | } from 'sequelize-typescript' |
27 | import { v4 as uuidv4 } from 'uuid' | ||
28 | import { buildNSFWFilter } from '@server/helpers/express-utils' | 27 | import { buildNSFWFilter } from '@server/helpers/express-utils' |
29 | import { getPrivaciesForFederation, isPrivacyForFederation, isStateForFederation } from '@server/helpers/video' | 28 | import { getPrivaciesForFederation, isPrivacyForFederation, isStateForFederation } from '@server/helpers/video' |
30 | import { LiveManager } from '@server/lib/live-manager' | 29 | import { LiveManager } from '@server/lib/live-manager' |
@@ -1871,20 +1870,12 @@ export class VideoModel extends Model { | |||
1871 | this.Thumbnails.push(savedThumbnail) | 1870 | this.Thumbnails.push(savedThumbnail) |
1872 | } | 1871 | } |
1873 | 1872 | ||
1874 | generateThumbnailName () { | ||
1875 | return uuidv4() + '.jpg' | ||
1876 | } | ||
1877 | |||
1878 | getMiniature () { | 1873 | getMiniature () { |
1879 | if (Array.isArray(this.Thumbnails) === false) return undefined | 1874 | if (Array.isArray(this.Thumbnails) === false) return undefined |
1880 | 1875 | ||
1881 | return this.Thumbnails.find(t => t.type === ThumbnailType.MINIATURE) | 1876 | return this.Thumbnails.find(t => t.type === ThumbnailType.MINIATURE) |
1882 | } | 1877 | } |
1883 | 1878 | ||
1884 | generatePreviewName () { | ||
1885 | return uuidv4() + '.jpg' | ||
1886 | } | ||
1887 | |||
1888 | hasPreview () { | 1879 | hasPreview () { |
1889 | return !!this.getPreview() | 1880 | return !!this.getPreview() |
1890 | } | 1881 | } |