Skip to content

Commit

Permalink
add better protection against non standard plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
blurymind committed Aug 10, 2024
1 parent 6b0c6bd commit 27d5e1d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/public/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ async function importModuleWeb(
modulePath,
{ forceUpdate } = { forceUpdate: false }
) {
if(!script.startsWith("export.module")) return Promise.reject( `${modulePath} Not a module`);

const { AsyncFunction, cache } = globalThis.__import__ || {
AsyncFunction: Object.getPrototypeOf(async function() {}).constructor,
cache: new Map(),
Expand Down Expand Up @@ -371,7 +373,6 @@ export var Plugins = function(app) {
const onLoadPluginsFromVolatile = () => {
Object.values(volatilePlugins).forEach(volatilePlugin => {
if (volatilePlugin.type === 'builtin') return; // todo for now built in ones dont

importModuleWeb(volatilePlugin.content, volatilePlugin.name).then(
importedPlugin => {
const initializedPlugin = new importedPlugin(pluginApiMethods);
Expand Down

0 comments on commit 27d5e1d

Please sign in to comment.