PluginManager refactor (#6677)
* fix: refactor plugin manager * fix: make id optional * fix: allow add to accept single object * fix: getHooks * fix: tsc * fix: remove id
This commit is contained in:
@@ -1,15 +1,21 @@
|
||||
import {
|
||||
PluginManager,
|
||||
PluginPriority,
|
||||
PluginType,
|
||||
Hook,
|
||||
} from "@server/utils/PluginManager";
|
||||
import env from "./env";
|
||||
import Iframely from "./iframely";
|
||||
|
||||
PluginManager.register(PluginType.UnfurlProvider, Iframely.get, {
|
||||
id: "iframely",
|
||||
enabled: !!env.IFRAMELY_API_KEY && !!env.IFRAMELY_URL,
|
||||
const enabled = !!env.IFRAMELY_API_KEY && !!env.IFRAMELY_URL;
|
||||
|
||||
// Make sure this is last in the stack to be evaluated after all other unfurl providers
|
||||
priority: PluginPriority.VeryLow,
|
||||
});
|
||||
if (enabled) {
|
||||
PluginManager.add([
|
||||
{
|
||||
type: Hook.UnfurlProvider,
|
||||
value: Iframely.get,
|
||||
|
||||
// Make sure this is last in the stack to be evaluated after all other unfurl providers
|
||||
priority: PluginPriority.VeryLow,
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user