1
0
Fork 0

Check latest plugins version with config interval

This commit is contained in:
Chocobozzz 2019-07-16 15:03:00 +02:00 committed by Chocobozzz
parent e0ce715a1d
commit d133f38582
5 changed files with 9 additions and 7 deletions

View File

@ -156,10 +156,11 @@ views:
max_age: -1 max_age: -1
plugins: plugins:
# The website PeerTube will ask for available PeerTube plugins # The website PeerTube will ask for available PeerTube plugins and themes
# This is an unmoderated plugin index, so only install plugins you trust # This is an unmoderated plugin index, so only install plugins/themes you trust
index: index:
enabled: true enabled: true
check_latest_versions_interval: '1 day' # How often you want to check new plugins/themes versions
url: 'https://packages.joinpeertube.org' url: 'https://packages.joinpeertube.org'
cache: cache:

View File

@ -161,6 +161,7 @@ plugins:
# This is an unmoderated plugin index, so only install plugins you trust # This is an unmoderated plugin index, so only install plugins you trust
index: index:
enabled: true enabled: true
check_latest_versions_interval: '1 day' # How often you want to check new plugins/themes versions
url: 'https://packages.joinpeertube.org' url: 'https://packages.joinpeertube.org'

View File

@ -137,7 +137,8 @@ const CONFIG = {
PLUGINS: { PLUGINS: {
INDEX: { INDEX: {
ENABLED: config.get<boolean>('plugins.index.enabled'), 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: { ADMIN: {

View File

@ -4,7 +4,7 @@ import { ActivityPubActorType } from '../../shared/models/activitypub'
import { FollowState } from '../../shared/models/actors' import { FollowState } from '../../shared/models/actors'
import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS } from '../../shared/models/videos' import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS } from '../../shared/models/videos'
// Do not use barrels, remain constants as independent as possible // 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 { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
import { invert } from 'lodash' import { invert } from 'lodash'
import { CronRepeatOptions, EveryRepeatOptions } from 'bull' import { CronRepeatOptions, EveryRepeatOptions } from 'bull'
@ -167,7 +167,7 @@ const SCHEDULER_INTERVALS_MS = {
removeOldJobs: 60000 * 60, // 1 hour removeOldJobs: 60000 * 60, // 1 hour
updateVideos: 60000, // 1 minute updateVideos: 60000, // 1 minute
youtubeDLUpdate: 60000 * 60 * 24, // 1 day 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 removeOldViews: 60000 * 60 * 24, // 1 day
removeOldHistory: 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.removeOldHistory = 5000
SCHEDULER_INTERVALS_MS.removeOldViews = 5000 SCHEDULER_INTERVALS_MS.removeOldViews = 5000
SCHEDULER_INTERVALS_MS.updateVideos = 5000 SCHEDULER_INTERVALS_MS.updateVideos = 5000
SCHEDULER_INTERVALS_MS.checkPlugins = 10000
REPEAT_JOBS[ 'videos-views' ] = { every: 5000 } REPEAT_JOBS[ 'videos-views' ] = { every: 5000 }
REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1 REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1

View File

@ -53,7 +53,7 @@ export class PluginsCheckScheduler extends AbstractScheduler {
plugin.latestVersion = result.latestVersion plugin.latestVersion = result.latestVersion
await plugin.save() 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) { } catch (err) {