diff options
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-abuse-interface.ts | 4 | ||||
-rw-r--r-- | server/models/video/video-abuse.ts | 18 | ||||
-rw-r--r-- | server/models/video/video-channel-interface.ts | 2 | ||||
-rw-r--r-- | server/models/video/video-channel.ts | 14 | ||||
-rw-r--r-- | server/models/video/video-interface.ts | 12 | ||||
-rw-r--r-- | server/models/video/video.ts | 58 |
6 files changed, 54 insertions, 54 deletions
diff --git a/server/models/video/video-abuse-interface.ts b/server/models/video/video-abuse-interface.ts index 978268926..16806cae2 100644 --- a/server/models/video/video-abuse-interface.ts +++ b/server/models/video/video-abuse-interface.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import * as Promise from 'bluebird' | 2 | import * as Promise from 'bluebird' |
3 | 3 | ||
4 | import { PodInstance } from '../pod/pod-interface' | 4 | import { ServerInstance } from '../server/server-interface' |
5 | import { ResultList } from '../../../shared' | 5 | import { ResultList } from '../../../shared' |
6 | 6 | ||
7 | // Don't use barrel, import just what we need | 7 | // Don't use barrel, import just what we need |
@@ -28,7 +28,7 @@ export interface VideoAbuseInstance extends VideoAbuseClass, VideoAbuseAttribute | |||
28 | createdAt: Date | 28 | createdAt: Date |
29 | updatedAt: Date | 29 | updatedAt: Date |
30 | 30 | ||
31 | Pod: PodInstance | 31 | Server: ServerInstance |
32 | 32 | ||
33 | toFormattedJSON: VideoAbuseMethods.ToFormattedJSON | 33 | toFormattedJSON: VideoAbuseMethods.ToFormattedJSON |
34 | } | 34 | } |
diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts index ebc63e7a0..c1d070ec0 100644 --- a/server/models/video/video-abuse.ts +++ b/server/models/video/video-abuse.ts | |||
@@ -45,7 +45,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da | |||
45 | fields: [ 'videoId' ] | 45 | fields: [ 'videoId' ] |
46 | }, | 46 | }, |
47 | { | 47 | { |
48 | fields: [ 'reporterPodId' ] | 48 | fields: [ 'reporterServerId' ] |
49 | } | 49 | } |
50 | ] | 50 | ] |
51 | } | 51 | } |
@@ -67,18 +67,18 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da | |||
67 | // ------------------------------ METHODS ------------------------------ | 67 | // ------------------------------ METHODS ------------------------------ |
68 | 68 | ||
69 | toFormattedJSON = function (this: VideoAbuseInstance) { | 69 | toFormattedJSON = function (this: VideoAbuseInstance) { |
70 | let reporterPodHost | 70 | let reporterServerHost |
71 | 71 | ||
72 | if (this.Pod) { | 72 | if (this.Server) { |
73 | reporterPodHost = this.Pod.host | 73 | reporterServerHost = this.Server.host |
74 | } else { | 74 | } else { |
75 | // It means it's our video | 75 | // It means it's our video |
76 | reporterPodHost = CONFIG.WEBSERVER.HOST | 76 | reporterServerHost = CONFIG.WEBSERVER.HOST |
77 | } | 77 | } |
78 | 78 | ||
79 | const json = { | 79 | const json = { |
80 | id: this.id, | 80 | id: this.id, |
81 | reporterPodHost, | 81 | reporterServerHost, |
82 | reason: this.reason, | 82 | reason: this.reason, |
83 | reporterUsername: this.reporterUsername, | 83 | reporterUsername: this.reporterUsername, |
84 | videoId: this.videoId, | 84 | videoId: this.videoId, |
@@ -91,9 +91,9 @@ toFormattedJSON = function (this: VideoAbuseInstance) { | |||
91 | // ------------------------------ STATICS ------------------------------ | 91 | // ------------------------------ STATICS ------------------------------ |
92 | 92 | ||
93 | function associate (models) { | 93 | function associate (models) { |
94 | VideoAbuse.belongsTo(models.Pod, { | 94 | VideoAbuse.belongsTo(models.Server, { |
95 | foreignKey: { | 95 | foreignKey: { |
96 | name: 'reporterPodId', | 96 | name: 'reporterServerId', |
97 | allowNull: true | 97 | allowNull: true |
98 | }, | 98 | }, |
99 | onDelete: 'CASCADE' | 99 | onDelete: 'CASCADE' |
@@ -115,7 +115,7 @@ listForApi = function (start: number, count: number, sort: string) { | |||
115 | order: [ getSort(sort) ], | 115 | order: [ getSort(sort) ], |
116 | include: [ | 116 | include: [ |
117 | { | 117 | { |
118 | model: VideoAbuse['sequelize'].models.Pod, | 118 | model: VideoAbuse['sequelize'].models.Server, |
119 | required: false | 119 | required: false |
120 | } | 120 | } |
121 | ] | 121 | ] |
diff --git a/server/models/video/video-channel-interface.ts b/server/models/video/video-channel-interface.ts index 55e772063..8ad3e5cb7 100644 --- a/server/models/video/video-channel-interface.ts +++ b/server/models/video/video-channel-interface.ts | |||
@@ -22,7 +22,7 @@ export namespace VideoChannelMethods { | |||
22 | export type LoadAndPopulateAccount = (id: number) => Promise<VideoChannelInstance> | 22 | export type LoadAndPopulateAccount = (id: number) => Promise<VideoChannelInstance> |
23 | export type LoadByUUIDAndPopulateAccount = (uuid: string) => Promise<VideoChannelInstance> | 23 | export type LoadByUUIDAndPopulateAccount = (uuid: string) => Promise<VideoChannelInstance> |
24 | export type LoadByUUID = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> | 24 | export type LoadByUUID = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> |
25 | export type LoadByHostAndUUID = (uuid: string, podHost: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> | 25 | export type LoadByHostAndUUID = (uuid: string, serverHost: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> |
26 | export type LoadAndPopulateAccountAndVideos = (id: number) => Promise<VideoChannelInstance> | 26 | export type LoadAndPopulateAccountAndVideos = (id: number) => Promise<VideoChannelInstance> |
27 | export type LoadByUrl = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> | 27 | export type LoadByUrl = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> |
28 | export type LoadByUUIDOrUrl = (uuid: string, url: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> | 28 | export type LoadByUUIDOrUrl = (uuid: string, url: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> |
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 6d70f2aa2..3cb4a33b9 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts | |||
@@ -218,7 +218,7 @@ listForApi = function (start: number, count: number, sort: string) { | |||
218 | { | 218 | { |
219 | model: VideoChannel['sequelize'].models.Account, | 219 | model: VideoChannel['sequelize'].models.Account, |
220 | required: true, | 220 | required: true, |
221 | include: [ { model: VideoChannel['sequelize'].models.Pod, required: false } ] | 221 | include: [ { model: VideoChannel['sequelize'].models.Server, required: false } ] |
222 | } | 222 | } |
223 | ] | 223 | ] |
224 | } | 224 | } |
@@ -238,7 +238,7 @@ listByAccount = function (accountId: number) { | |||
238 | id: accountId | 238 | id: accountId |
239 | }, | 239 | }, |
240 | required: true, | 240 | required: true, |
241 | include: [ { model: VideoChannel['sequelize'].models.Pod, required: false } ] | 241 | include: [ { model: VideoChannel['sequelize'].models.Server, required: false } ] |
242 | } | 242 | } |
243 | ] | 243 | ] |
244 | } | 244 | } |
@@ -297,7 +297,7 @@ loadByHostAndUUID = function (fromHost: string, uuid: string, t?: Sequelize.Tran | |||
297 | model: VideoChannel['sequelize'].models.Account, | 297 | model: VideoChannel['sequelize'].models.Account, |
298 | include: [ | 298 | include: [ |
299 | { | 299 | { |
300 | model: VideoChannel['sequelize'].models.Pod, | 300 | model: VideoChannel['sequelize'].models.Server, |
301 | required: true, | 301 | required: true, |
302 | where: { | 302 | where: { |
303 | host: fromHost | 303 | host: fromHost |
@@ -322,7 +322,7 @@ loadByIdAndAccount = function (id: number, accountId: number) { | |||
322 | include: [ | 322 | include: [ |
323 | { | 323 | { |
324 | model: VideoChannel['sequelize'].models.Account, | 324 | model: VideoChannel['sequelize'].models.Account, |
325 | include: [ { model: VideoChannel['sequelize'].models.Pod, required: false } ] | 325 | include: [ { model: VideoChannel['sequelize'].models.Server, required: false } ] |
326 | } | 326 | } |
327 | ] | 327 | ] |
328 | } | 328 | } |
@@ -335,7 +335,7 @@ loadAndPopulateAccount = function (id: number) { | |||
335 | include: [ | 335 | include: [ |
336 | { | 336 | { |
337 | model: VideoChannel['sequelize'].models.Account, | 337 | model: VideoChannel['sequelize'].models.Account, |
338 | include: [ { model: VideoChannel['sequelize'].models.Pod, required: false } ] | 338 | include: [ { model: VideoChannel['sequelize'].models.Server, required: false } ] |
339 | } | 339 | } |
340 | ] | 340 | ] |
341 | } | 341 | } |
@@ -351,7 +351,7 @@ loadByUUIDAndPopulateAccount = function (uuid: string) { | |||
351 | include: [ | 351 | include: [ |
352 | { | 352 | { |
353 | model: VideoChannel['sequelize'].models.Account, | 353 | model: VideoChannel['sequelize'].models.Account, |
354 | include: [ { model: VideoChannel['sequelize'].models.Pod, required: false } ] | 354 | include: [ { model: VideoChannel['sequelize'].models.Server, required: false } ] |
355 | } | 355 | } |
356 | ] | 356 | ] |
357 | } | 357 | } |
@@ -364,7 +364,7 @@ loadAndPopulateAccountAndVideos = function (id: number) { | |||
364 | include: [ | 364 | include: [ |
365 | { | 365 | { |
366 | model: VideoChannel['sequelize'].models.Account, | 366 | model: VideoChannel['sequelize'].models.Account, |
367 | include: [ { model: VideoChannel['sequelize'].models.Pod, required: false } ] | 367 | include: [ { model: VideoChannel['sequelize'].models.Server, required: false } ] |
368 | }, | 368 | }, |
369 | VideoChannel['sequelize'].models.Video | 369 | VideoChannel['sequelize'].models.Video |
370 | ] | 370 | ] |
diff --git a/server/models/video/video-interface.ts b/server/models/video/video-interface.ts index 7243756d2..4df33f801 100644 --- a/server/models/video/video-interface.ts +++ b/server/models/video/video-interface.ts | |||
@@ -46,7 +46,7 @@ export namespace VideoMethods { | |||
46 | 46 | ||
47 | export type ListForApi = (start: number, count: number, sort: string) => Bluebird< ResultList<VideoInstance> > | 47 | export type ListForApi = (start: number, count: number, sort: string) => Bluebird< ResultList<VideoInstance> > |
48 | export type ListUserVideosForApi = (userId: number, start: number, count: number, sort: string) => Bluebird< ResultList<VideoInstance> > | 48 | export type ListUserVideosForApi = (userId: number, start: number, count: number, sort: string) => Bluebird< ResultList<VideoInstance> > |
49 | export type SearchAndPopulateAccountAndPodAndTags = ( | 49 | export type SearchAndPopulateAccountAndServerAndTags = ( |
50 | value: string, | 50 | value: string, |
51 | field: string, | 51 | field: string, |
52 | start: number, | 52 | start: number, |
@@ -60,8 +60,8 @@ export namespace VideoMethods { | |||
60 | export type LoadLocalVideoByUUID = (uuid: string, t?: Sequelize.Transaction) => Bluebird<VideoInstance> | 60 | export type LoadLocalVideoByUUID = (uuid: string, t?: Sequelize.Transaction) => Bluebird<VideoInstance> |
61 | export type LoadByHostAndUUID = (fromHost: string, uuid: string, t?: Sequelize.Transaction) => Bluebird<VideoInstance> | 61 | export type LoadByHostAndUUID = (fromHost: string, uuid: string, t?: Sequelize.Transaction) => Bluebird<VideoInstance> |
62 | export type LoadAndPopulateAccount = (id: number) => Bluebird<VideoInstance> | 62 | export type LoadAndPopulateAccount = (id: number) => Bluebird<VideoInstance> |
63 | export type LoadAndPopulateAccountAndPodAndTags = (id: number) => Bluebird<VideoInstance> | 63 | export type LoadAndPopulateAccountAndServerAndTags = (id: number) => Bluebird<VideoInstance> |
64 | export type LoadByUUIDAndPopulateAccountAndPodAndTags = (uuid: string) => Bluebird<VideoInstance> | 64 | export type LoadByUUIDAndPopulateAccountAndServerAndTags = (uuid: string) => Bluebird<VideoInstance> |
65 | export type LoadByUUIDOrURL = (uuid: string, url: string, t?: Sequelize.Transaction) => Bluebird<VideoInstance> | 65 | export type LoadByUUIDOrURL = (uuid: string, url: string, t?: Sequelize.Transaction) => Bluebird<VideoInstance> |
66 | 66 | ||
67 | export type RemoveThumbnail = (this: VideoInstance) => Promise<void> | 67 | export type RemoveThumbnail = (this: VideoInstance) => Promise<void> |
@@ -79,14 +79,14 @@ export interface VideoClass { | |||
79 | listOwnedByAccount: VideoMethods.ListOwnedByAccount | 79 | listOwnedByAccount: VideoMethods.ListOwnedByAccount |
80 | load: VideoMethods.Load | 80 | load: VideoMethods.Load |
81 | loadAndPopulateAccount: VideoMethods.LoadAndPopulateAccount | 81 | loadAndPopulateAccount: VideoMethods.LoadAndPopulateAccount |
82 | loadAndPopulateAccountAndPodAndTags: VideoMethods.LoadAndPopulateAccountAndPodAndTags | 82 | loadAndPopulateAccountAndServerAndTags: VideoMethods.LoadAndPopulateAccountAndServerAndTags |
83 | loadByHostAndUUID: VideoMethods.LoadByHostAndUUID | 83 | loadByHostAndUUID: VideoMethods.LoadByHostAndUUID |
84 | loadByUUID: VideoMethods.LoadByUUID | 84 | loadByUUID: VideoMethods.LoadByUUID |
85 | loadByUrl: VideoMethods.LoadByUrl | 85 | loadByUrl: VideoMethods.LoadByUrl |
86 | loadByUUIDOrURL: VideoMethods.LoadByUUIDOrURL | 86 | loadByUUIDOrURL: VideoMethods.LoadByUUIDOrURL |
87 | loadLocalVideoByUUID: VideoMethods.LoadLocalVideoByUUID | 87 | loadLocalVideoByUUID: VideoMethods.LoadLocalVideoByUUID |
88 | loadByUUIDAndPopulateAccountAndPodAndTags: VideoMethods.LoadByUUIDAndPopulateAccountAndPodAndTags | 88 | loadByUUIDAndPopulateAccountAndServerAndTags: VideoMethods.LoadByUUIDAndPopulateAccountAndServerAndTags |
89 | searchAndPopulateAccountAndPodAndTags: VideoMethods.SearchAndPopulateAccountAndPodAndTags | 89 | searchAndPopulateAccountAndServerAndTags: VideoMethods.SearchAndPopulateAccountAndServerAndTags |
90 | } | 90 | } |
91 | 91 | ||
92 | export interface VideoAttributes { | 92 | export interface VideoAttributes { |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index dd73dd7ca..86800fb88 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -88,9 +88,9 @@ let loadByUUID: VideoMethods.LoadByUUID | |||
88 | let loadByUUIDOrURL: VideoMethods.LoadByUUIDOrURL | 88 | let loadByUUIDOrURL: VideoMethods.LoadByUUIDOrURL |
89 | let loadLocalVideoByUUID: VideoMethods.LoadLocalVideoByUUID | 89 | let loadLocalVideoByUUID: VideoMethods.LoadLocalVideoByUUID |
90 | let loadAndPopulateAccount: VideoMethods.LoadAndPopulateAccount | 90 | let loadAndPopulateAccount: VideoMethods.LoadAndPopulateAccount |
91 | let loadAndPopulateAccountAndPodAndTags: VideoMethods.LoadAndPopulateAccountAndPodAndTags | 91 | let loadAndPopulateAccountAndServerAndTags: VideoMethods.LoadAndPopulateAccountAndServerAndTags |
92 | let loadByUUIDAndPopulateAccountAndPodAndTags: VideoMethods.LoadByUUIDAndPopulateAccountAndPodAndTags | 92 | let loadByUUIDAndPopulateAccountAndServerAndTags: VideoMethods.LoadByUUIDAndPopulateAccountAndServerAndTags |
93 | let searchAndPopulateAccountAndPodAndTags: VideoMethods.SearchAndPopulateAccountAndPodAndTags | 93 | let searchAndPopulateAccountAndServerAndTags: VideoMethods.SearchAndPopulateAccountAndServerAndTags |
94 | let removeThumbnail: VideoMethods.RemoveThumbnail | 94 | let removeThumbnail: VideoMethods.RemoveThumbnail |
95 | let removePreview: VideoMethods.RemovePreview | 95 | let removePreview: VideoMethods.RemovePreview |
96 | let removeFile: VideoMethods.RemoveFile | 96 | let removeFile: VideoMethods.RemoveFile |
@@ -275,13 +275,13 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da | |||
275 | listOwnedByAccount, | 275 | listOwnedByAccount, |
276 | load, | 276 | load, |
277 | loadAndPopulateAccount, | 277 | loadAndPopulateAccount, |
278 | loadAndPopulateAccountAndPodAndTags, | 278 | loadAndPopulateAccountAndServerAndTags, |
279 | loadByHostAndUUID, | 279 | loadByHostAndUUID, |
280 | loadByUUIDOrURL, | 280 | loadByUUIDOrURL, |
281 | loadByUUID, | 281 | loadByUUID, |
282 | loadLocalVideoByUUID, | 282 | loadLocalVideoByUUID, |
283 | loadByUUIDAndPopulateAccountAndPodAndTags, | 283 | loadByUUIDAndPopulateAccountAndServerAndTags, |
284 | searchAndPopulateAccountAndPodAndTags | 284 | searchAndPopulateAccountAndServerAndTags |
285 | ] | 285 | ] |
286 | const instanceMethods = [ | 286 | const instanceMethods = [ |
287 | createPreview, | 287 | createPreview, |
@@ -477,13 +477,13 @@ getPreviewPath = function (this: VideoInstance) { | |||
477 | } | 477 | } |
478 | 478 | ||
479 | toFormattedJSON = function (this: VideoInstance) { | 479 | toFormattedJSON = function (this: VideoInstance) { |
480 | let podHost | 480 | let serverHost |
481 | 481 | ||
482 | if (this.VideoChannel.Account.Pod) { | 482 | if (this.VideoChannel.Account.Server) { |
483 | podHost = this.VideoChannel.Account.Pod.host | 483 | serverHost = this.VideoChannel.Account.Server.host |
484 | } else { | 484 | } else { |
485 | // It means it's our video | 485 | // It means it's our video |
486 | podHost = CONFIG.WEBSERVER.HOST | 486 | serverHost = CONFIG.WEBSERVER.HOST |
487 | } | 487 | } |
488 | 488 | ||
489 | const json = { | 489 | const json = { |
@@ -498,7 +498,7 @@ toFormattedJSON = function (this: VideoInstance) { | |||
498 | languageLabel: this.getLanguageLabel(), | 498 | languageLabel: this.getLanguageLabel(), |
499 | nsfw: this.nsfw, | 499 | nsfw: this.nsfw, |
500 | description: this.getTruncatedDescription(), | 500 | description: this.getTruncatedDescription(), |
501 | podHost, | 501 | serverHost, |
502 | isLocal: this.isOwned(), | 502 | isLocal: this.isOwned(), |
503 | account: this.VideoChannel.Account.name, | 503 | account: this.VideoChannel.Account.name, |
504 | duration: this.duration, | 504 | duration: this.duration, |
@@ -519,7 +519,7 @@ toFormattedJSON = function (this: VideoInstance) { | |||
519 | toFormattedDetailsJSON = function (this: VideoInstance) { | 519 | toFormattedDetailsJSON = function (this: VideoInstance) { |
520 | const formattedJson = this.toFormattedJSON() | 520 | const formattedJson = this.toFormattedJSON() |
521 | 521 | ||
522 | // Maybe our pod is not up to date and there are new privacy settings since our version | 522 | // Maybe our server is not up to date and there are new privacy settings since our version |
523 | let privacyLabel = VIDEO_PRIVACIES[this.privacy] | 523 | let privacyLabel = VIDEO_PRIVACIES[this.privacy] |
524 | if (!privacyLabel) privacyLabel = 'Unknown' | 524 | if (!privacyLabel) privacyLabel = 'Unknown' |
525 | 525 | ||
@@ -721,7 +721,7 @@ getDescriptionPath = function (this: VideoInstance) { | |||
721 | getCategoryLabel = function (this: VideoInstance) { | 721 | getCategoryLabel = function (this: VideoInstance) { |
722 | let categoryLabel = VIDEO_CATEGORIES[this.category] | 722 | let categoryLabel = VIDEO_CATEGORIES[this.category] |
723 | 723 | ||
724 | // Maybe our pod is not up to date and there are new categories since our version | 724 | // Maybe our server is not up to date and there are new categories since our version |
725 | if (!categoryLabel) categoryLabel = 'Misc' | 725 | if (!categoryLabel) categoryLabel = 'Misc' |
726 | 726 | ||
727 | return categoryLabel | 727 | return categoryLabel |
@@ -730,7 +730,7 @@ getCategoryLabel = function (this: VideoInstance) { | |||
730 | getLicenceLabel = function (this: VideoInstance) { | 730 | getLicenceLabel = function (this: VideoInstance) { |
731 | let licenceLabel = VIDEO_LICENCES[this.licence] | 731 | let licenceLabel = VIDEO_LICENCES[this.licence] |
732 | 732 | ||
733 | // Maybe our pod is not up to date and there are new licences since our version | 733 | // Maybe our server is not up to date and there are new licences since our version |
734 | if (!licenceLabel) licenceLabel = 'Unknown' | 734 | if (!licenceLabel) licenceLabel = 'Unknown' |
735 | 735 | ||
736 | return licenceLabel | 736 | return licenceLabel |
@@ -830,7 +830,7 @@ listForApi = function (start: number, count: number, sort: string) { | |||
830 | model: Video['sequelize'].models.Account, | 830 | model: Video['sequelize'].models.Account, |
831 | include: [ | 831 | include: [ |
832 | { | 832 | { |
833 | model: Video['sequelize'].models.Pod, | 833 | model: Video['sequelize'].models.Server, |
834 | required: false | 834 | required: false |
835 | } | 835 | } |
836 | ] | 836 | ] |
@@ -866,7 +866,7 @@ loadByHostAndUUID = function (fromHost: string, uuid: string, t?: Sequelize.Tran | |||
866 | model: Video['sequelize'].models.Account, | 866 | model: Video['sequelize'].models.Account, |
867 | include: [ | 867 | include: [ |
868 | { | 868 | { |
869 | model: Video['sequelize'].models.Pod, | 869 | model: Video['sequelize'].models.Server, |
870 | required: true, | 870 | required: true, |
871 | where: { | 871 | where: { |
872 | host: fromHost | 872 | host: fromHost |
@@ -989,7 +989,7 @@ loadAndPopulateAccount = function (id: number) { | |||
989 | return Video.findById(id, options) | 989 | return Video.findById(id, options) |
990 | } | 990 | } |
991 | 991 | ||
992 | loadAndPopulateAccountAndPodAndTags = function (id: number) { | 992 | loadAndPopulateAccountAndServerAndTags = function (id: number) { |
993 | const options = { | 993 | const options = { |
994 | include: [ | 994 | include: [ |
995 | { | 995 | { |
@@ -997,7 +997,7 @@ loadAndPopulateAccountAndPodAndTags = function (id: number) { | |||
997 | include: [ | 997 | include: [ |
998 | { | 998 | { |
999 | model: Video['sequelize'].models.Account, | 999 | model: Video['sequelize'].models.Account, |
1000 | include: [ { model: Video['sequelize'].models.Pod, required: false } ] | 1000 | include: [ { model: Video['sequelize'].models.Server, required: false } ] |
1001 | } | 1001 | } |
1002 | ] | 1002 | ] |
1003 | }, | 1003 | }, |
@@ -1009,7 +1009,7 @@ loadAndPopulateAccountAndPodAndTags = function (id: number) { | |||
1009 | return Video.findById(id, options) | 1009 | return Video.findById(id, options) |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | loadByUUIDAndPopulateAccountAndPodAndTags = function (uuid: string) { | 1012 | loadByUUIDAndPopulateAccountAndServerAndTags = function (uuid: string) { |
1013 | const options = { | 1013 | const options = { |
1014 | where: { | 1014 | where: { |
1015 | uuid | 1015 | uuid |
@@ -1020,7 +1020,7 @@ loadByUUIDAndPopulateAccountAndPodAndTags = function (uuid: string) { | |||
1020 | include: [ | 1020 | include: [ |
1021 | { | 1021 | { |
1022 | model: Video['sequelize'].models.Account, | 1022 | model: Video['sequelize'].models.Account, |
1023 | include: [ { model: Video['sequelize'].models.Pod, required: false } ] | 1023 | include: [ { model: Video['sequelize'].models.Server, required: false } ] |
1024 | } | 1024 | } |
1025 | ] | 1025 | ] |
1026 | }, | 1026 | }, |
@@ -1032,15 +1032,15 @@ loadByUUIDAndPopulateAccountAndPodAndTags = function (uuid: string) { | |||
1032 | return Video.findOne(options) | 1032 | return Video.findOne(options) |
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | searchAndPopulateAccountAndPodAndTags = function (value: string, field: string, start: number, count: number, sort: string) { | 1035 | searchAndPopulateAccountAndServerAndTags = function (value: string, field: string, start: number, count: number, sort: string) { |
1036 | const podInclude: Sequelize.IncludeOptions = { | 1036 | const serverInclude: Sequelize.IncludeOptions = { |
1037 | model: Video['sequelize'].models.Pod, | 1037 | model: Video['sequelize'].models.Server, |
1038 | required: false | 1038 | required: false |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | const accountInclude: Sequelize.IncludeOptions = { | 1041 | const accountInclude: Sequelize.IncludeOptions = { |
1042 | model: Video['sequelize'].models.Account, | 1042 | model: Video['sequelize'].models.Account, |
1043 | include: [ podInclude ] | 1043 | include: [ serverInclude ] |
1044 | } | 1044 | } |
1045 | 1045 | ||
1046 | const videoChannelInclude: Sequelize.IncludeOptions = { | 1046 | const videoChannelInclude: Sequelize.IncludeOptions = { |
@@ -1071,13 +1071,13 @@ searchAndPopulateAccountAndPodAndTags = function (value: string, field: string, | |||
1071 | )` | 1071 | )` |
1072 | ) | 1072 | ) |
1073 | } else if (field === 'host') { | 1073 | } else if (field === 'host') { |
1074 | // FIXME: Include our pod? (not stored in the database) | 1074 | // FIXME: Include our server? (not stored in the database) |
1075 | podInclude.where = { | 1075 | serverInclude.where = { |
1076 | host: { | 1076 | host: { |
1077 | [Sequelize.Op.iLike]: '%' + value + '%' | 1077 | [Sequelize.Op.iLike]: '%' + value + '%' |
1078 | } | 1078 | } |
1079 | } | 1079 | } |
1080 | podInclude.required = true | 1080 | serverInclude.required = true |
1081 | } else if (field === 'account') { | 1081 | } else if (field === 'account') { |
1082 | accountInclude.where = { | 1082 | accountInclude.where = { |
1083 | name: { | 1083 | name: { |
@@ -1123,8 +1123,8 @@ function getBaseUrls (video: VideoInstance) { | |||
1123 | baseUrlHttp = CONFIG.WEBSERVER.URL | 1123 | baseUrlHttp = CONFIG.WEBSERVER.URL |
1124 | baseUrlWs = CONFIG.WEBSERVER.WS + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT | 1124 | baseUrlWs = CONFIG.WEBSERVER.WS + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT |
1125 | } else { | 1125 | } else { |
1126 | baseUrlHttp = REMOTE_SCHEME.HTTP + '://' + video.VideoChannel.Account.Pod.host | 1126 | baseUrlHttp = REMOTE_SCHEME.HTTP + '://' + video.VideoChannel.Account.Server.host |
1127 | baseUrlWs = REMOTE_SCHEME.WS + '://' + video.VideoChannel.Account.Pod.host | 1127 | baseUrlWs = REMOTE_SCHEME.WS + '://' + video.VideoChannel.Account.Server.host |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | return { baseUrlHttp, baseUrlWs } | 1130 | return { baseUrlHttp, baseUrlWs } |