aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-18 11:07:08 +0100
committerChocobozzz <chocobozzz@cpy.re>2021-02-18 13:38:09 +0100
commitb3d5cb92b100406df98e5cd1f54eff9cd2078b1c (patch)
tree234c9b0b799424c1599af0dee27e84e4ad7240ff /server
parentd9a2a03196275065c28f4a0b7d4d7bc9992d77a1 (diff)
downloadPeerTube-b3d5cb92b100406df98e5cd1f54eff9cd2078b1c.tar.gz
PeerTube-b3d5cb92b100406df98e5cd1f54eff9cd2078b1c.tar.zst
PeerTube-b3d5cb92b100406df98e5cd1f54eff9cd2078b1c.zip
Add ability to update torrents cache in client
Diffstat (limited to 'server')
-rw-r--r--server/controllers/api/config.ts3
-rw-r--r--server/lib/thumbnail.ts3
-rw-r--r--server/middlewares/validators/config.ts1
-rw-r--r--server/models/server/tracker.ts2
-rw-r--r--server/tests/api/check-params/config.ts3
-rw-r--r--server/tests/api/server/config.ts5
6 files changed, 14 insertions, 3 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index 5c242da04..fb108ca1c 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -395,6 +395,9 @@ function customConfig (): CustomConfig {
395 }, 395 },
396 captions: { 396 captions: {
397 size: CONFIG.CACHE.VIDEO_CAPTIONS.SIZE 397 size: CONFIG.CACHE.VIDEO_CAPTIONS.SIZE
398 },
399 torrents: {
400 size: CONFIG.CACHE.TORRENTS.SIZE
398 } 401 }
399 }, 402 },
400 signup: { 403 signup: {
diff --git a/server/lib/thumbnail.ts b/server/lib/thumbnail.ts
index 49317df28..e37aefc85 100644
--- a/server/lib/thumbnail.ts
+++ b/server/lib/thumbnail.ts
@@ -1,6 +1,5 @@
1import { copy } from 'fs-extra'
2import { join } from 'path' 1import { join } from 'path'
3import { logger } from '@server/helpers/logger' 2
4import { ThumbnailType } from '../../shared/models/videos/thumbnail.type' 3import { ThumbnailType } from '../../shared/models/videos/thumbnail.type'
5import { generateImageFromVideoFile } from '../helpers/ffmpeg-utils' 4import { generateImageFromVideoFile } from '../helpers/ffmpeg-utils'
6import { processImage } from '../helpers/image-utils' 5import { processImage } from '../helpers/image-utils'
diff --git a/server/middlewares/validators/config.ts b/server/middlewares/validators/config.ts
index 71098ff99..a85883b19 100644
--- a/server/middlewares/validators/config.ts
+++ b/server/middlewares/validators/config.ts
@@ -25,6 +25,7 @@ const customConfigUpdateValidator = [
25 25
26 body('cache.previews.size').isInt().withMessage('Should have a valid previews cache size'), 26 body('cache.previews.size').isInt().withMessage('Should have a valid previews cache size'),
27 body('cache.captions.size').isInt().withMessage('Should have a valid captions cache size'), 27 body('cache.captions.size').isInt().withMessage('Should have a valid captions cache size'),
28 body('cache.torrents.size').isInt().withMessage('Should have a valid torrents cache size'),
28 29
29 body('signup.enabled').isBoolean().withMessage('Should have a valid signup enabled boolean'), 30 body('signup.enabled').isBoolean().withMessage('Should have a valid signup enabled boolean'),
30 body('signup.limit').isInt().withMessage('Should have a valid signup limit'), 31 body('signup.limit').isInt().withMessage('Should have a valid signup limit'),
diff --git a/server/models/server/tracker.ts b/server/models/server/tracker.ts
index d7c91faad..97520f92d 100644
--- a/server/models/server/tracker.ts
+++ b/server/models/server/tracker.ts
@@ -36,7 +36,7 @@ export class TrackerModel extends Model {
36 const query = { 36 const query = {
37 include: [ 37 include: [
38 { 38 {
39 attributes: [ 'id', 'trackerId' ], 39 attributes: [ 'id' ],
40 model: VideoModel.unscoped(), 40 model: VideoModel.unscoped(),
41 required: true, 41 required: true,
42 where: { id: videoId } 42 where: { id: videoId }
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index c7eb3189b..004aa65b3 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -65,6 +65,9 @@ describe('Test config API validators', function () {
65 }, 65 },
66 captions: { 66 captions: {
67 size: 3 67 size: 3
68 },
69 torrents: {
70 size: 4
68 } 71 }
69 }, 72 },
70 signup: { 73 signup: {
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index b2371614f..0b0f48d22 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -55,6 +55,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) {
55 55
56 expect(data.cache.previews.size).to.equal(1) 56 expect(data.cache.previews.size).to.equal(1)
57 expect(data.cache.captions.size).to.equal(1) 57 expect(data.cache.captions.size).to.equal(1)
58 expect(data.cache.torrents.size).to.equal(1)
58 59
59 expect(data.signup.enabled).to.be.true 60 expect(data.signup.enabled).to.be.true
60 expect(data.signup.limit).to.equal(4) 61 expect(data.signup.limit).to.equal(4)
@@ -144,6 +145,7 @@ function checkUpdatedConfig (data: CustomConfig) {
144 145
145 expect(data.cache.previews.size).to.equal(2) 146 expect(data.cache.previews.size).to.equal(2)
146 expect(data.cache.captions.size).to.equal(3) 147 expect(data.cache.captions.size).to.equal(3)
148 expect(data.cache.torrents.size).to.equal(4)
147 149
148 expect(data.signup.enabled).to.be.false 150 expect(data.signup.enabled).to.be.false
149 expect(data.signup.limit).to.equal(5) 151 expect(data.signup.limit).to.equal(5)
@@ -305,6 +307,9 @@ describe('Test config', function () {
305 }, 307 },
306 captions: { 308 captions: {
307 size: 3 309 size: 3
310 },
311 torrents: {
312 size: 4
308 } 313 }
309 }, 314 },
310 signup: { 315 signup: {