MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / getInstalledPlugins

Function getInstalledPlugins

src/pages/plugins/plugins.js:650–672  ·  view source on GitHub ↗
(updates)

Source from the content-addressed store, hash-verified

648 }
649
650 async function getInstalledPlugins(updates) {
651 $list.installed.setAttribute("empty-msg", strings["loading..."]);
652 plugins.installed = [];
653 const disabledMap = settings.value.pluginsDisabled || {};
654 const installed = await fsOperation(PLUGIN_DIR).lsDir();
655 await Promise.all(
656 installed.map(async (item) => {
657 const id = Url.basename(item.url);
658 if (!((updates && updates.includes(id)) || !updates)) return;
659 const url = Url.join(item.url, "plugin.json");
660 const plugin = await fsOperation(url).readFile("json");
661 const iconUrl = getLocalRes(id, plugin.icon);
662 plugin.icon = await helpers.toInternalUri(iconUrl);
663 plugin.installed = true;
664 plugin.enabled = disabledMap[id] !== true; // default to true
665 plugin.onToggleEnabled = onToggleEnabled;
666 plugins.installed.push(plugin);
667 if ($list.installed.get(`[data-id=\"${id}\"]`)) return;
668 $list.installed.append(<Item {...plugin} updates={updates} />);
669 }),
670 );
671 $list.installed.setAttribute("empty-msg", strings["no plugins found"]);
672 }
673
674 async function getOwned() {
675 $list.owned.setAttribute("empty-msg", strings["loading..."]);

Callers 2

plugins.jsFile · 0.85
addSourceFunction · 0.85

Calls 7

fsOperationFunction · 0.85
basenameMethod · 0.80
appendMethod · 0.80
getLocalResFunction · 0.70
lsDirMethod · 0.45
readFileMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected