ActivityPub-federated video streaming platform using P2P directly in your web browser
Check latest plugins version with config interval
Chocobozzzd133f3858288
diff --git a/config/default.yaml b/config/default.yamlindex 341de49b8f..a26625ab3e 100644--- a/config/default.yaml+++ b/config/default.yaml@@ -156,10 +156,11 @@ views:max_age: -1plugins:- # The website PeerTube will ask for available PeerTube plugins- # This is an unmoderated plugin index, so only install plugins you trust+ # The website PeerTube will ask for available PeerTube plugins and themes+ # This is an unmoderated plugin index, so only install plugins/themes you trustindex:enabled: true+ check_latest_versions_interval: '1 day' # How often you want to check new plugins/themes versionsurl: 'https://packages.joinpeertube.org'cache:diff --git a/config/production.yaml.example b/config/production.yaml.exampleindex 28f078efee..ec7744deb1 100644--- a/config/production.yaml.example+++ b/config/production.yaml.example@@ -161,6 +161,7 @@ plugins:# This is an unmoderated plugin index, so only install plugins you trustindex:enabled: true+ check_latest_versions_interval: '1 day' # How often you want to check new plugins/themes versionsurl: 'https://packages.joinpeertube.org'diff --git a/server/initializers/config.ts b/server/initializers/config.tsindex 2c1b30021e..58241e4ea9 100644--- a/server/initializers/config.ts+++ b/server/initializers/config.ts@@ -137,7 +137,8 @@ const CONFIG = {PLUGINS: {INDEX: {ENABLED: config.get<boolean>('plugins.index.enabled'),- URL: config.get<boolean>('plugins.index.url')+ CHECK_LATEST_VERSIONS_INTERVAL: parseDurationToMs(config.get<string>('plugins.index.check_latest_versions_interval')),+ URL: config.get<string>('plugins.index.url')}},ADMIN: {diff --git a/server/initializers/constants.ts b/server/initializers/constants.tsindex 367ae8d458..cd4d4e847c 100644--- a/server/initializers/constants.ts+++ b/server/initializers/constants.ts@@ -4,7 +4,7 @@ import { ActivityPubActorType } from '../../shared/models/activitypub'import { FollowState } from '../../shared/models/actors'import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS } from '../../shared/models/videos'// Do not use barrels, remain constants as independent as possible-import { isTestInstance, sanitizeHost, sanitizeUrl, root } from '../helpers/core-utils'+import { isTestInstance, sanitizeHost, sanitizeUrl, root, parseDurationToMs } from '../helpers/core-utils'import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'import { invert } from 'lodash'import { CronRepeatOptions, EveryRepeatOptions } from 'bull'@@ -167,7 +167,7 @@ const SCHEDULER_INTERVALS_MS = {removeOldJobs: 60000 * 60, // 1 hourupdateVideos: 60000, // 1 minuteyoutubeDLUpdate: 60000 * 60 * 24, // 1 day- checkPlugins: 60000 * 60 * 24, // 1 day+ checkPlugins: CONFIG.PLUGINS.INDEX.CHECK_LATEST_VERSIONS_INTERVAL,removeOldViews: 60000 * 60 * 24, // 1 dayremoveOldHistory: 60000 * 60 * 24 // 1 day}@@ -618,7 +618,6 @@ if (isTestInstance() === true) {SCHEDULER_INTERVALS_MS.removeOldHistory = 5000SCHEDULER_INTERVALS_MS.removeOldViews = 5000SCHEDULER_INTERVALS_MS.updateVideos = 5000- SCHEDULER_INTERVALS_MS.checkPlugins = 10000REPEAT_JOBS[ 'videos-views' ] = { every: 5000 }REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1diff --git a/server/lib/schedulers/plugins-check-scheduler.ts b/server/lib/schedulers/plugins-check-scheduler.tsindex 8dfdd51778..7ff41e6394 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 {plugin.latestVersion = result.latestVersionawait plugin.save()- logger.info('Plugin %s has a new latest version %s.', PluginModel.buildNpmName(plugin.name, plugin.type), plugin.latestVersion)+ logger.info('Plugin %s has a new latest version %s.', result.npmName, plugin.latestVersion)}}} catch (err) {