aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r--server/models/video/video.ts58
1 files changed, 29 insertions, 29 deletions
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
88let loadByUUIDOrURL: VideoMethods.LoadByUUIDOrURL 88let loadByUUIDOrURL: VideoMethods.LoadByUUIDOrURL
89let loadLocalVideoByUUID: VideoMethods.LoadLocalVideoByUUID 89let loadLocalVideoByUUID: VideoMethods.LoadLocalVideoByUUID
90let loadAndPopulateAccount: VideoMethods.LoadAndPopulateAccount 90let loadAndPopulateAccount: VideoMethods.LoadAndPopulateAccount
91let loadAndPopulateAccountAndPodAndTags: VideoMethods.LoadAndPopulateAccountAndPodAndTags 91let loadAndPopulateAccountAndServerAndTags: VideoMethods.LoadAndPopulateAccountAndServerAndTags
92let loadByUUIDAndPopulateAccountAndPodAndTags: VideoMethods.LoadByUUIDAndPopulateAccountAndPodAndTags 92let loadByUUIDAndPopulateAccountAndServerAndTags: VideoMethods.LoadByUUIDAndPopulateAccountAndServerAndTags
93let searchAndPopulateAccountAndPodAndTags: VideoMethods.SearchAndPopulateAccountAndPodAndTags 93let searchAndPopulateAccountAndServerAndTags: VideoMethods.SearchAndPopulateAccountAndServerAndTags
94let removeThumbnail: VideoMethods.RemoveThumbnail 94let removeThumbnail: VideoMethods.RemoveThumbnail
95let removePreview: VideoMethods.RemovePreview 95let removePreview: VideoMethods.RemovePreview
96let removeFile: VideoMethods.RemoveFile 96let 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
479toFormattedJSON = function (this: VideoInstance) { 479toFormattedJSON = 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) {
519toFormattedDetailsJSON = function (this: VideoInstance) { 519toFormattedDetailsJSON = 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) {
721getCategoryLabel = function (this: VideoInstance) { 721getCategoryLabel = 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) {
730getLicenceLabel = function (this: VideoInstance) { 730getLicenceLabel = 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
992loadAndPopulateAccountAndPodAndTags = function (id: number) { 992loadAndPopulateAccountAndServerAndTags = 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
1012loadByUUIDAndPopulateAccountAndPodAndTags = function (uuid: string) { 1012loadByUUIDAndPopulateAccountAndServerAndTags = 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
1035searchAndPopulateAccountAndPodAndTags = function (value: string, field: string, start: number, count: number, sort: string) { 1035searchAndPopulateAccountAndServerAndTags = 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 }