/// <reference types="node" />
import express from 'express';
import { Server } from 'http';
import { MOAuthTokenUser, MUser } from '../../types/models';
import { ClientScriptJSON, PluginTranslation } from '../../../shared/models';
import { PluginType } from '../../../shared/models/plugins/plugin.type';
import { ServerHook, ServerHookName } from '../../../shared/models/plugins/server/server-hook.model';
import { PluginModel } from '../../models/server/plugin';
import { RegisterServerAuthExternalOptions, RegisterServerAuthPassOptions } from '../../types/plugins';
import { RegisterHelpers } from './register-helpers';
export interface RegisteredPlugin {
    npmName: string;
    name: string;
    version: string;
    description: string;
    peertubeEngine: string;
    type: PluginType;
    path: string;
    staticDirs: {
        [name: string]: string;
    };
    clientScripts: {
        [name: string]: ClientScriptJSON;
    };
    css: string[];
    registerHelpers?: RegisterHelpers;
    unregister?: Function;
}
export interface HookInformationValue {
    npmName: string;
    pluginName: string;
    handler: Function;
    priority: number;
}
export declare class PluginManager implements ServerHook {
    private static instance;
    private registeredPlugins;
    private hooks;
    private translations;
    private server;
    private constructor();
    init(server: Server): void;
    registerWebSocketRouter(): void;
    isRegistered(npmName: string): boolean;
    getRegisteredPluginOrTheme(npmName: string): RegisteredPlugin;
    getRegisteredPluginByShortName(name: string): RegisteredPlugin;
    getRegisteredThemeByShortName(name: string): RegisteredPlugin;
    getRegisteredPlugins(): RegisteredPlugin[];
    getRegisteredThemes(): RegisteredPlugin[];
    getIdAndPassAuths(): {
        npmName: string;
        name: string;
        version: string;
        idAndPassAuths: RegisterServerAuthPassOptions[];
    }[];
    getExternalAuths(): {
        npmName: string;
        name: string;
        version: string;
        externalAuths: RegisterServerAuthExternalOptions[];
    }[];
    getRegisteredSettings(npmName: string): import("../../../shared/models").RegisterServerSettingOptions[];
    getRouter(npmName: string): express.Router;
    getTranslations(locale: string): PluginTranslation;
    isTokenValid(token: MOAuthTokenUser, type: 'access' | 'refresh'): Promise<boolean>;
    onLogout(npmName: string, authName: string, user: MUser, req: express.Request): Promise<string>;
    onSettingsChanged(name: string, settings: any): Promise<void>;
    runHook<T>(hookName: ServerHookName, result?: T, params?: any): Promise<T>;
    registerPluginsAndThemes(): Promise<void>;
    unregister(npmName: string): Promise<void>;
    install(toInstall: string, version?: string, fromDisk?: boolean): Promise<PluginModel>;
    update(toUpdate: string, fromDisk?: boolean): Promise<PluginModel>;
    uninstall(npmName: string): Promise<void>;
    rebuildNativePluginsIfNeeded(): Promise<void>;
    private registerPluginOrTheme;
    private registerPlugin;
    private addTranslations;
    private deleteTranslations;
    private resetCSSGlobalFile;
    private addCSSToGlobalFile;
    private concatFiles;
    private regeneratePluginGlobalCSS;
    private sortHooksByPriority;
    private getPackageJSON;
    private getPluginPath;
    private getAuth;
    private getRegisteredPluginsOrThemes;
    private getRegisterHelpers;
    private sanitizeAndCheckPackageJSONOrThrow;
    static get Instance(): PluginManager;
}
//# sourceMappingURL=plugin-manager.d.ts.map