aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/server/plugin.ts19
1 files changed, 15 insertions, 4 deletions
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 {
10import { PluginType } from '../../../shared/models/plugins/plugin.type' 10import { PluginType } from '../../../shared/models/plugins/plugin.type'
11import { PeerTubePlugin } from '../../../shared/models/plugins/peertube-plugin.model' 11import { PeerTubePlugin } from '../../../shared/models/plugins/peertube-plugin.model'
12import { FindAndCountOptions, json } from 'sequelize' 12import { FindAndCountOptions, json } from 'sequelize'
13import { PeerTubePluginIndex } from '../../../shared/models/plugins/peertube-plugin-index.model'
13 14
14@DefaultScope(() => ({ 15@DefaultScope(() => ({
15 attributes: { 16 attributes: {
@@ -177,7 +178,7 @@ export class PluginModel extends Model<PluginModel> {
177 } 178 }
178 179
179 static listForApi (options: { 180 static listForApi (options: {
180 type?: PluginType, 181 pluginType?: PluginType,
181 uninstalled?: boolean, 182 uninstalled?: boolean,
182 start: number, 183 start: number,
183 count: number, 184 count: number,
@@ -193,7 +194,7 @@ export class PluginModel extends Model<PluginModel> {
193 } 194 }
194 } 195 }
195 196
196 if (options.type) query.where['type'] = options.type 197 if (options.pluginType) query.where['type'] = options.pluginType
197 198
198 return PluginModel 199 return PluginModel
199 .findAndCountAll(query) 200 .findAndCountAll(query)
@@ -202,8 +203,18 @@ export class PluginModel extends Model<PluginModel> {
202 }) 203 })
203 } 204 }
204 205
205 static normalizePluginName (name: string) { 206 static listInstalled () {
206 return name.replace(/^peertube-((theme)|(plugin))-/, '') 207 const query = {
208 where: {
209 uninstalled: false
210 }
211 }
212
213 return PluginModel.findAll(query)
214 }
215
216 static normalizePluginName (npmName: string) {
217 return npmName.replace(/^peertube-((theme)|(plugin))-/, '')
207 } 218 }
208 219
209 static getTypeFromNpmName (npmName: string) { 220 static getTypeFromNpmName (npmName: string) {