mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
38 lines
837 B
JavaScript
38 lines
837 B
JavaScript
// Maintains a set of known ignis plugin IDs for filtering.
|
|
// Populated on bridge plugin load and updated when plugins are enabled/disabled.
|
|
|
|
const knownIds = new Set(["ignis-bridge"]);
|
|
|
|
async function refresh() {
|
|
try {
|
|
const res = await fetch("/api/plugins");
|
|
const plugins = await res.json();
|
|
|
|
// Keep ignis-bridge, add all bundled plugin IDs.
|
|
knownIds.clear();
|
|
knownIds.add("ignis-bridge");
|
|
|
|
for (const plugin of plugins) {
|
|
if (plugin.bundledPluginId) {
|
|
knownIds.add(plugin.bundledPluginId);
|
|
}
|
|
}
|
|
} catch {
|
|
// Keep whatever we had.
|
|
}
|
|
}
|
|
|
|
function isIgnisPlugin(pluginId) {
|
|
return knownIds.has(pluginId);
|
|
}
|
|
|
|
function addId(pluginId) {
|
|
knownIds.add(pluginId);
|
|
}
|
|
|
|
function getKnownIds() {
|
|
return knownIds;
|
|
}
|
|
|
|
module.exports = { refresh, isIgnisPlugin, addId, getKnownIds };
|