diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/plugins/plugin-manager.ts | 14 |
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' | |||
5 | import { decachePlugin } from '@server/helpers/decache' | 5 | import { decachePlugin } from '@server/helpers/decache' |
6 | import { MOAuthTokenUser, MUser } from '@server/types/models' | 6 | import { MOAuthTokenUser, MUser } from '@server/types/models' |
7 | import { getCompleteLocale } from '@shared/core-utils' | 7 | import { getCompleteLocale } from '@shared/core-utils' |
8 | import { ClientScript, PluginPackageJson, PluginTranslation, PluginTranslationPaths, RegisterServerHookOptions } from '@shared/models' | 8 | import { ClientScriptJSON, PluginPackageJSON, PluginTranslation, PluginTranslationPathsJSON, RegisterServerHookOptions } from '@shared/models' |
9 | import { getHookType, internalRunHook } from '../../../shared/core-utils/plugins/hooks' | 9 | import { getHookType, internalRunHook } from '../../../shared/core-utils/plugins/hooks' |
10 | import { PluginType } from '../../../shared/models/plugins/plugin.type' | 10 | import { PluginType } from '../../../shared/models/plugins/plugin.type' |
11 | import { ServerHook, ServerHookName } from '../../../shared/models/plugins/server/server-hook.model' | 11 | import { 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 = [] |