aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-16 15:03:00 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commitd133f3858288b20d790e9bb57664fc6e22d9aeaf (patch)
tree5ff8d553337bd97d92b0d5004e23239e4668721a
parente0ce715a1ded6e84c877004dae3e354c8716fb06 (diff)
downloadPeerTube-d133f3858288b20d790e9bb57664fc6e22d9aeaf.tar.gz
PeerTube-d133f3858288b20d790e9bb57664fc6e22d9aeaf.tar.zst
PeerTube-d133f3858288b20d790e9bb57664fc6e22d9aeaf.zip
Check latest plugins version with config interval
-rw-r--r--config/default.yaml5
-rw-r--r--config/production.yaml.example1
-rw-r--r--server/initializers/config.ts3
-rw-r--r--server/initializers/constants.ts5
-rw-r--r--server/lib/schedulers/plugins-check-scheduler.ts2
5 files changed, 9 insertions, 7 deletions
diff --git a/config/default.yaml b/config/default.yaml
index 341de49b8..a26625ab3 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -156,10 +156,11 @@ views:
156 max_age: -1 156 max_age: -1
157 157
158plugins: 158plugins:
159 # The website PeerTube will ask for available PeerTube plugins 159 # The website PeerTube will ask for available PeerTube plugins and themes
160 # This is an unmoderated plugin index, so only install plugins you trust 160 # This is an unmoderated plugin index, so only install plugins/themes you trust
161 index: 161 index:
162 enabled: true 162 enabled: true
163 check_latest_versions_interval: '1 day' # How often you want to check new plugins/themes versions
163 url: 'https://packages.joinpeertube.org' 164 url: 'https://packages.joinpeertube.org'
164 165
165cache: 166cache:
diff --git a/config/production.yaml.example b/config/production.yaml.example
index 28f078efe..ec7744deb 100644
--- a/config/production.yaml.example
+++ b/config/production.yaml.example
@@ -161,6 +161,7 @@ plugins:
161 # This is an unmoderated plugin index, so only install plugins you trust 161 # This is an unmoderated plugin index, so only install plugins you trust
162 index: 162 index:
163 enabled: true 163 enabled: true
164 check_latest_versions_interval: '1 day' # How often you want to check new plugins/themes versions
164 url: 'https://packages.joinpeertube.org' 165 url: 'https://packages.joinpeertube.org'
165 166
166 167
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index 2c1b30021..58241e4ea 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -137,7 +137,8 @@ const CONFIG = {
137 PLUGINS: { 137 PLUGINS: {
138 INDEX: { 138 INDEX: {
139 ENABLED: config.get<boolean>('plugins.index.enabled'), 139 ENABLED: config.get<boolean>('plugins.index.enabled'),
140 URL: config.get<boolean>('plugins.index.url') 140 CHECK_LATEST_VERSIONS_INTERVAL: parseDurationToMs(config.get<string>('plugins.index.check_latest_versions_interval')),
141 URL: config.get<string>('plugins.index.url')
141 } 142 }
142 }, 143 },
143 ADMIN: { 144 ADMIN: {
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 367ae8d45..cd4d4e847 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -4,7 +4,7 @@ import { ActivityPubActorType } from '../../shared/models/activitypub'
4import { FollowState } from '../../shared/models/actors' 4import { FollowState } from '../../shared/models/actors'
5import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS } from '../../shared/models/videos' 5import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS } from '../../shared/models/videos'
6// Do not use barrels, remain constants as independent as possible 6// Do not use barrels, remain constants as independent as possible
7import { isTestInstance, sanitizeHost, sanitizeUrl, root } from '../helpers/core-utils' 7import { isTestInstance, sanitizeHost, sanitizeUrl, root, parseDurationToMs } from '../helpers/core-utils'
8import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' 8import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
9import { invert } from 'lodash' 9import { invert } from 'lodash'
10import { CronRepeatOptions, EveryRepeatOptions } from 'bull' 10import { CronRepeatOptions, EveryRepeatOptions } from 'bull'
@@ -167,7 +167,7 @@ const SCHEDULER_INTERVALS_MS = {
167 removeOldJobs: 60000 * 60, // 1 hour 167 removeOldJobs: 60000 * 60, // 1 hour
168 updateVideos: 60000, // 1 minute 168 updateVideos: 60000, // 1 minute
169 youtubeDLUpdate: 60000 * 60 * 24, // 1 day 169 youtubeDLUpdate: 60000 * 60 * 24, // 1 day
170 checkPlugins: 60000 * 60 * 24, // 1 day 170 checkPlugins: CONFIG.PLUGINS.INDEX.CHECK_LATEST_VERSIONS_INTERVAL,
171 removeOldViews: 60000 * 60 * 24, // 1 day 171 removeOldViews: 60000 * 60 * 24, // 1 day
172 removeOldHistory: 60000 * 60 * 24 // 1 day 172 removeOldHistory: 60000 * 60 * 24 // 1 day
173} 173}
@@ -618,7 +618,6 @@ if (isTestInstance() === true) {
618 SCHEDULER_INTERVALS_MS.removeOldHistory = 5000 618 SCHEDULER_INTERVALS_MS.removeOldHistory = 5000
619 SCHEDULER_INTERVALS_MS.removeOldViews = 5000 619 SCHEDULER_INTERVALS_MS.removeOldViews = 5000
620 SCHEDULER_INTERVALS_MS.updateVideos = 5000 620 SCHEDULER_INTERVALS_MS.updateVideos = 5000
621 SCHEDULER_INTERVALS_MS.checkPlugins = 10000
622 REPEAT_JOBS[ 'videos-views' ] = { every: 5000 } 621 REPEAT_JOBS[ 'videos-views' ] = { every: 5000 }
623 622
624 REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1 623 REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1
diff --git a/server/lib/schedulers/plugins-check-scheduler.ts b/server/lib/schedulers/plugins-check-scheduler.ts
index 8dfdd5177..7ff41e639 100644
--- a/server/lib/schedulers/plugins-check-scheduler.ts
+++ b/server/lib/schedulers/plugins-check-scheduler.ts
@@ -53,7 +53,7 @@ export class PluginsCheckScheduler extends AbstractScheduler {
53 plugin.latestVersion = result.latestVersion 53 plugin.latestVersion = result.latestVersion
54 await plugin.save() 54 await plugin.save()
55 55
56 logger.info('Plugin %s has a new latest version %s.', PluginModel.buildNpmName(plugin.name, plugin.type), plugin.latestVersion) 56 logger.info('Plugin %s has a new latest version %s.', result.npmName, plugin.latestVersion)
57 } 57 }
58 } 58 }
59 } catch (err) { 59 } catch (err) {