aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/controllers/api/config.ts8
-rw-r--r--server/models/account/actor-image.ts6
-rw-r--r--server/models/account/user.ts16
-rw-r--r--server/tests/api/videos/video-channels.ts4
4 files changed, 31 insertions, 3 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index 313513cea..e28f7502d 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -163,6 +163,14 @@ async function getConfig (req: express.Request, res: express.Response) {
163 extensions: CONSTRAINTS_FIELDS.ACTORS.IMAGE.EXTNAME 163 extensions: CONSTRAINTS_FIELDS.ACTORS.IMAGE.EXTNAME
164 } 164 }
165 }, 165 },
166 banner: {
167 file: {
168 size: {
169 max: CONSTRAINTS_FIELDS.ACTORS.IMAGE.FILE_SIZE.max
170 },
171 extensions: CONSTRAINTS_FIELDS.ACTORS.IMAGE.EXTNAME
172 }
173 },
166 video: { 174 video: {
167 image: { 175 image: {
168 extensions: CONSTRAINTS_FIELDS.VIDEOS.IMAGE.EXTNAME, 176 extensions: CONSTRAINTS_FIELDS.VIDEOS.IMAGE.EXTNAME,
diff --git a/server/models/account/actor-image.ts b/server/models/account/actor-image.ts
index c532bd08d..b779e3cf6 100644
--- a/server/models/account/actor-image.ts
+++ b/server/models/account/actor-image.ts
@@ -72,7 +72,11 @@ export class ActorImageModel extends Model {
72 } 72 }
73 73
74 getStaticPath () { 74 getStaticPath () {
75 return join(LAZY_STATIC_PATHS.AVATARS, this.filename) 75 if (this.type === ActorImageType.AVATAR) {
76 return join(LAZY_STATIC_PATHS.AVATARS, this.filename)
77 }
78
79 return join(LAZY_STATIC_PATHS.BANNERS, this.filename)
76 } 80 }
77 81
78 getPath () { 82 getPath () {
diff --git a/server/models/account/user.ts b/server/models/account/user.ts
index a7a65c489..00c6d73aa 100644
--- a/server/models/account/user.ts
+++ b/server/models/account/user.ts
@@ -71,6 +71,7 @@ import { VideoLiveModel } from '../video/video-live'
71import { VideoPlaylistModel } from '../video/video-playlist' 71import { VideoPlaylistModel } from '../video/video-playlist'
72import { AccountModel } from './account' 72import { AccountModel } from './account'
73import { UserNotificationSettingModel } from './user-notification-setting' 73import { UserNotificationSettingModel } from './user-notification-setting'
74import { ActorImageModel } from './actor-image'
74 75
75enum ScopeNames { 76enum ScopeNames {
76 FOR_ME_API = 'FOR_ME_API', 77 FOR_ME_API = 'FOR_ME_API',
@@ -97,7 +98,20 @@ enum ScopeNames {
97 model: AccountModel, 98 model: AccountModel,
98 include: [ 99 include: [
99 { 100 {
100 model: VideoChannelModel 101 model: VideoChannelModel.unscoped(),
102 include: [
103 {
104 model: ActorModel,
105 required: true,
106 include: [
107 {
108 model: ActorImageModel,
109 as: 'Banner',
110 required: false
111 }
112 ]
113 }
114 ]
101 }, 115 },
102 { 116 {
103 attributes: [ 'id', 'name', 'type' ], 117 attributes: [ 'id', 'name', 'type' ],
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 8033b9ba5..e50582218 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -9,6 +9,7 @@ import {
9 doubleFollow, 9 doubleFollow,
10 flushAndRunMultipleServers, 10 flushAndRunMultipleServers,
11 getVideo, 11 getVideo,
12 getVideoChannel,
12 getVideoChannelVideos, 13 getVideoChannelVideos,
13 testImage, 14 testImage,
14 updateVideo, 15 updateVideo,
@@ -306,7 +307,8 @@ describe('Test video channels', function () {
306 await waitJobs(servers) 307 await waitJobs(servers)
307 308
308 for (const server of servers) { 309 for (const server of servers) {
309 const videoChannel = await findChannel(server, secondVideoChannelId) 310 const res = await getVideoChannel(server.url, 'second_video_channel@' + servers[0].host)
311 const videoChannel = res.body
310 312
311 await testImage(server.url, 'banner-resized', videoChannel.banner.path) 313 await testImage(server.url, 'banner-resized', videoChannel.banner.path)
312 } 314 }