Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/lib/loadPlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import loadPlugin from "./loadPlugin";
export default async function loadPlugins() {
const plugins = await fsOperation(PLUGIN_DIR).lsDir();
const results = [];
const failedPlugins = [];

if (plugins.length > 0) {
toast(strings["loading plugins"]);
Expand All @@ -20,10 +21,31 @@ export default async function loadPlugins() {
window.log("error", `Failed to load plugin: ${pluginId}`);
window.log("error", error);
toast(`Failed to load plugin: ${pluginId}`);
failedPlugins.push(pluginId);
results.push(false);
}
});

await Promise.allSettled(loadPromises);
if (failedPlugins.length > 0) {
setTimeout(() => {
cleanupFailedPlugins(failedPlugins).catch((error) => {
console.error("Failed to cleanup plugins:", error);
});
}, 1000);
}
return results.filter(Boolean).length;
}

async function cleanupFailedPlugins(pluginIds) {
for (const pluginId of pluginIds) {
try {
const pluginDir = Url.join(PLUGIN_DIR, pluginId);
if (await fsOperation(pluginDir).exists()) {
await fsOperation(pluginDir).delete();
}
} catch (error) {
window.log("error", `Failed to cleanup plugin ${pluginId}:`, error);
}
}
}
2 changes: 1 addition & 1 deletion src/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ async function loadApp() {

// Check for app updates
if (navigator.onLine) {
fetch("https://api.github.com/repos/deadlyjack/Acode/releases/latest")
fetch("https://api.github.com/repos/Acode-Foundation/Acode/releases/latest")
.then((res) => res.json())
.then((release) => {
// assuming version is in format v1.2.3
Expand Down
Loading