API 部分迁移完成

This commit is contained in:
muwoo
2021-12-08 13:45:40 +08:00
parent a9827c6db1
commit 951f21f5fa
17 changed files with 818 additions and 39 deletions

View File

@@ -40,9 +40,23 @@ global.LOCAL_PLUGINS = {
});
if (!has) {
global.LOCAL_PLUGINS.PLUGINS.unshift(plugin);
fs.writeFileSync(configPath, JSON.stringify(global.LOCAL_PLUGINS.PLUGINS));
fs.writeFileSync(
configPath,
JSON.stringify(global.LOCAL_PLUGINS.PLUGINS)
);
}
},
updatePlugin(plugin) {
global.LOCAL_PLUGINS.PLUGINS = global.LOCAL_PLUGINS.PLUGINS.map(
(origin) => {
if (origin.name === plugin.name) {
return plugin;
}
return origin;
}
);
fs.writeFileSync(configPath, JSON.stringify(global.LOCAL_PLUGINS.PLUGINS));
},
async deletePlugin(plugin) {
await pluginInstance.uninstall([plugin.name]);
global.LOCAL_PLUGINS.PLUGINS = global.LOCAL_PLUGINS.PLUGINS.filter((p) => plugin.name !== p.name);