X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fplugins%2Fplugin-manager.ts;h=a46b97fa46cfb069a2dec56379bf41a23f59ab11;hb=c795e19663a93c24908a7318975f820bac63164f;hp=a706df1e0a0ed90a8423e21363f1c41f55a7b92e;hpb=fd59208e8ccd796f9ad7e35db82d0c33acfcb92c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts index a706df1e0..a46b97fa4 100644 --- a/server/lib/plugins/plugin-manager.ts +++ b/server/lib/plugins/plugin-manager.ts @@ -3,6 +3,7 @@ import { createReadStream, createWriteStream } from 'fs' import { ensureDir, outputFile, readJSON } from 'fs-extra' import { basename, join } from 'path' import { decachePlugin } from '@server/helpers/decache' +import { ApplicationModel } from '@server/models/application/application' import { MOAuthTokenUser, MUser } from '@server/types/models' import { getCompleteLocale } from '@shared/core-utils' import { @@ -23,7 +24,7 @@ import { PluginModel } from '../../models/server/plugin' import { PluginLibrary, RegisterServerAuthExternalOptions, RegisterServerAuthPassOptions, RegisterServerOptions } from '../../types/plugins' import { ClientHtml } from '../client-html' import { RegisterHelpers } from './register-helpers' -import { installNpmPlugin, installNpmPluginFromDisk, removeNpmPlugin } from './yarn' +import { installNpmPlugin, installNpmPluginFromDisk, rebuildNativePlugins, removeNpmPlugin } from './yarn' export interface RegisteredPlugin { npmName: string @@ -384,6 +385,12 @@ export class PluginManager implements ServerHook { logger.info('Plugin %s uninstalled.', npmName) } + async rebuildNativePluginsIfNeeded () { + if (!await ApplicationModel.nodeABIChanged()) return + + return rebuildNativePlugins() + } + // ###################### Private register ###################### private async registerPluginOrTheme (plugin: PluginModel) {