Skip to content

Commit

Permalink
Merge branch 'TCORE-228_Refactor_Plugin_SQLite' into TCORE-228_Refact…
Browse files Browse the repository at this point in the history
…or_Plugin_Others
  • Loading branch information
bgelatti authored Oct 10, 2024
2 parents b5dd55a + c6201e0 commit 192a1f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
3 changes: 3 additions & 0 deletions packages/tcore-api/src/Plugins/Plugin/Plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ class Plugin {
public static async returnFullDescription(folder: string, relativePath: string) {
const fullPath = path.join(folder, relativePath);
const data = fs.readFileSync(fullPath, "utf8");
if (!data) {
return "";
}
return data;
}
}
Expand Down
19 changes: 10 additions & 9 deletions packages/tcore-api/src/Services/Plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,16 @@ async function getInstalledInsidePlugins(plugins: string[], settings: ISettings)
const fullPath = path.join(__dirname, "../../../..", "plugins", folder);
const getPackage = await Plugin.getPackageAsync(fullPath).catch(() => null);

if (getPackage) {
const isInstalled = settings.installed_plugins?.includes(md5(getPackage.name));
const isInstalledDatabasePlugin = settings.database_plugin?.split(":")[0] === md5(getPackage.name);
const isDatabase = getPackage?.tcore?.types?.includes("database");
const isStore = getPackage?.tcore?.store;

if (isInstalled || isInstalledDatabasePlugin || (isDatabase && !settings.database_plugin) || isStore) {
plugins.push(fullPath);
}
if (!getPackage) {
continue;
}
const isInstalled = settings.installed_plugins?.includes(md5(getPackage.name));
const isInstalledDatabasePlugin = settings.database_plugin?.split(":")[0] === md5(getPackage.name);
const isDatabase = getPackage?.tcore?.types?.includes("database");
const isStore = getPackage?.tcore?.store;

if (isInstalled || isInstalledDatabasePlugin || (isDatabase && !settings.database_plugin) || isStore) {
plugins.push(fullPath);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,6 @@ function PluginButton(props: IPluginButtonProps) {
<span>Disable Plugin</span>
</div>
))}

{item.allow_uninstall && (
<div className="item" onClick={() => setModalUninstall(true)}>
<Icon icon={EIcon["trash-alt"]} />
<span>Remove Plugin</span>
</div>
)}
</Style.Dropdown>

{modalUninstall && (
Expand Down

0 comments on commit 192a1f1

Please sign in to comment.