aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/plugins
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-24 10:40:51 +0100
committerChocobozzz <me@florianbigard.com>2021-12-24 10:40:51 +0100
commitc7cdac440970525d78d257a055899c26f6899a82 (patch)
tree531af934a361aeca81d8f1eacf47036f56eafb1b /server/lib/plugins
parentd17c7b4e8c52317bdc874917387b7a49f6cf8b01 (diff)
downloadPeerTube-c7cdac440970525d78d257a055899c26f6899a82.tar.gz
PeerTube-c7cdac440970525d78d257a055899c26f6899a82.tar.zst
PeerTube-c7cdac440970525d78d257a055899c26f6899a82.zip
Fix type conflict
Diffstat (limited to 'server/lib/plugins')
-rw-r--r--server/lib/plugins/plugin-manager.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts
index 6c2f4764e..ff00ab9e8 100644
--- a/server/lib/plugins/plugin-manager.ts
+++ b/server/lib/plugins/plugin-manager.ts
@@ -5,7 +5,7 @@ import { basename, join } from 'path'
5import { decachePlugin } from '@server/helpers/decache' 5import { decachePlugin } from '@server/helpers/decache'
6import { MOAuthTokenUser, MUser } from '@server/types/models' 6import { MOAuthTokenUser, MUser } from '@server/types/models'
7import { getCompleteLocale } from '@shared/core-utils' 7import { getCompleteLocale } from '@shared/core-utils'
8import { ClientScript, PluginPackageJson, PluginTranslation, PluginTranslationPaths, RegisterServerHookOptions } from '@shared/models' 8import { ClientScriptJSON, PluginPackageJSON, PluginTranslation, PluginTranslationPathsJSON, RegisterServerHookOptions } from '@shared/models'
9import { getHookType, internalRunHook } from '../../../shared/core-utils/plugins/hooks' 9import { getHookType, internalRunHook } from '../../../shared/core-utils/plugins/hooks'
10import { PluginType } from '../../../shared/models/plugins/plugin.type' 10import { PluginType } from '../../../shared/models/plugins/plugin.type'
11import { ServerHook, ServerHookName } from '../../../shared/models/plugins/server/server-hook.model' 11import { ServerHook, ServerHookName } from '../../../shared/models/plugins/server/server-hook.model'
@@ -31,7 +31,7 @@ export interface RegisteredPlugin {
31 path: string 31 path: string
32 32
33 staticDirs: { [name: string]: string } 33 staticDirs: { [name: string]: string }
34 clientScripts: { [name: string]: ClientScript } 34 clientScripts: { [name: string]: ClientScriptJSON }
35 35
36 css: string[] 36 css: string[]
37 37
@@ -392,7 +392,7 @@ export class PluginManager implements ServerHook {
392 registerHelpers = result.registerStore 392 registerHelpers = result.registerStore
393 } 393 }
394 394
395 const clientScripts: { [id: string]: ClientScript } = {} 395 const clientScripts: { [id: string]: ClientScriptJSON } = {}
396 for (const c of packageJSON.clientScripts) { 396 for (const c of packageJSON.clientScripts) {
397 clientScripts[c.script] = c 397 clientScripts[c.script] = c
398 } 398 }
@@ -415,7 +415,7 @@ export class PluginManager implements ServerHook {
415 await this.addTranslations(plugin, npmName, packageJSON.translations) 415 await this.addTranslations(plugin, npmName, packageJSON.translations)
416 } 416 }
417 417
418 private async registerPlugin (plugin: PluginModel, pluginPath: string, packageJSON: PluginPackageJson) { 418 private async registerPlugin (plugin: PluginModel, pluginPath: string, packageJSON: PluginPackageJSON) {
419 const npmName = PluginModel.buildNpmName(plugin.name, plugin.type) 419 const npmName = PluginModel.buildNpmName(plugin.name, plugin.type)
420 420
421 // Delete cache if needed 421 // Delete cache if needed
@@ -442,7 +442,7 @@ export class PluginManager implements ServerHook {
442 442
443 // ###################### Translations ###################### 443 // ###################### Translations ######################
444 444
445 private async addTranslations (plugin: PluginModel, npmName: string, translationPaths: PluginTranslationPaths) { 445 private async addTranslations (plugin: PluginModel, npmName: string, translationPaths: PluginTranslationPathsJSON) {
446 for (const locale of Object.keys(translationPaths)) { 446 for (const locale of Object.keys(translationPaths)) {
447 const path = translationPaths[locale] 447 const path = translationPaths[locale]
448 const json = await readJSON(join(this.getPluginPath(plugin.name, plugin.type), path)) 448 const json = await readJSON(join(this.getPluginPath(plugin.name, plugin.type), path))
@@ -513,7 +513,7 @@ export class PluginManager implements ServerHook {
513 private getPackageJSON (pluginName: string, pluginType: PluginType) { 513 private getPackageJSON (pluginName: string, pluginType: PluginType) {
514 const pluginPath = join(this.getPluginPath(pluginName, pluginType), 'package.json') 514 const pluginPath = join(this.getPluginPath(pluginName, pluginType), 'package.json')
515 515
516 return readJSON(pluginPath) as Promise<PluginPackageJson> 516 return readJSON(pluginPath) as Promise<PluginPackageJSON>
517 } 517 }
518 518
519 private getPluginPath (pluginName: string, pluginType: PluginType) { 519 private getPluginPath (pluginName: string, pluginType: PluginType) {
@@ -572,7 +572,7 @@ export class PluginManager implements ServerHook {
572 } 572 }
573 } 573 }
574 574
575 private sanitizeAndCheckPackageJSONOrThrow (packageJSON: PluginPackageJson, pluginType: PluginType) { 575 private sanitizeAndCheckPackageJSONOrThrow (packageJSON: PluginPackageJSON, pluginType: PluginType) {
576 if (!packageJSON.staticDirs) packageJSON.staticDirs = {} 576 if (!packageJSON.staticDirs) packageJSON.staticDirs = {}
577 if (!packageJSON.css) packageJSON.css = [] 577 if (!packageJSON.css) packageJSON.css = []
578 if (!packageJSON.clientScripts) packageJSON.clientScripts = [] 578 if (!packageJSON.clientScripts) packageJSON.clientScripts = []