Skip to content

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.yaml
index 341de49b8f..a26625ab3e 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -156,10 +156,11 @@ views:
max_age: -1
plugins:
- # 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 trust
index:
enabled: true
+ check_latest_versions_interval: '1 day' # How often you want to check new plugins/themes versions
url: 'https://packages.joinpeertube.org'
cache:
diff --git a/config/production.yaml.example b/config/production.yaml.example
index 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 trust
index:
enabled: true
+ check_latest_versions_interval: '1 day' # How often you want to check new plugins/themes versions
url: 'https://packages.joinpeertube.org'
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index 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.ts
index 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 hour
updateVideos: 60000, // 1 minute
youtubeDLUpdate: 60000 * 60 * 24, // 1 day
- checkPlugins: 60000 * 60 * 24, // 1 day
+ checkPlugins: CONFIG.PLUGINS.INDEX.CHECK_LATEST_VERSIONS_INTERVAL,
removeOldViews: 60000 * 60 * 24, // 1 day
removeOldHistory: 60000 * 60 * 24 // 1 day
}
@@ -618,7 +618,6 @@ if (isTestInstance() === true) {
SCHEDULER_INTERVALS_MS.removeOldHistory = 5000
SCHEDULER_INTERVALS_MS.removeOldViews = 5000
SCHEDULER_INTERVALS_MS.updateVideos = 5000
- SCHEDULER_INTERVALS_MS.checkPlugins = 10000
REPEAT_JOBS[ 'videos-views' ] = { every: 5000 }
REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1
diff --git a/server/lib/schedulers/plugins-check-scheduler.ts b/server/lib/schedulers/plugins-check-scheduler.ts
index 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.latestVersion
await 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) {