X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fserver%2Fplugin.ts;h=ba43713f66d1d61695b6fbcae1614674ecbd8da6;hb=6702a1b2ccd666285dee9c72b5bace641d2fce8b;hp=bd3d7a81ec46443ad6e11149a98febc55d9998e9;hpb=503c6f440abc8f5924c38c4bd63591cb6cefacec;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/server/plugin.ts b/server/models/server/plugin.ts index bd3d7a81e..ba43713f6 100644 --- a/server/models/server/plugin.ts +++ b/server/models/server/plugin.ts @@ -10,6 +10,7 @@ import { import { PluginType } from '../../../shared/models/plugins/plugin.type' import { PeerTubePlugin } from '../../../shared/models/plugins/peertube-plugin.model' import { FindAndCountOptions, json } from 'sequelize' +import { PeerTubePluginIndex } from '../../../shared/models/plugins/peertube-plugin-index.model' @DefaultScope(() => ({ attributes: { @@ -177,7 +178,7 @@ export class PluginModel extends Model { } static listForApi (options: { - type?: PluginType, + pluginType?: PluginType, uninstalled?: boolean, start: number, count: number, @@ -193,7 +194,7 @@ export class PluginModel extends Model { } } - if (options.type) query.where['type'] = options.type + if (options.pluginType) query.where['type'] = options.pluginType return PluginModel .findAndCountAll(query) @@ -202,8 +203,18 @@ export class PluginModel extends Model { }) } - static normalizePluginName (name: string) { - return name.replace(/^peertube-((theme)|(plugin))-/, '') + static listInstalled () { + const query = { + where: { + uninstalled: false + } + } + + return PluginModel.findAll(query) + } + + static normalizePluginName (npmName: string) { + return npmName.replace(/^peertube-((theme)|(plugin))-/, '') } static getTypeFromNpmName (npmName: string) {