mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Move dangerous stdlib logic to PluginMeta
This commit is contained in:
parent
cf9e5ed66c
commit
13d2ff870f
2 changed files with 8 additions and 5 deletions
|
@ -66,6 +66,13 @@ struct PluginMeta {
|
|||
this->libraryPermissions.insert(t.toString());
|
||||
}
|
||||
}
|
||||
|
||||
bool hasDangerousLibraries()
|
||||
{
|
||||
const auto *perms = &this->libraryPermissions;
|
||||
return perms->contains("io") || perms->contains("package") ||
|
||||
perms->contains("os");
|
||||
}
|
||||
};
|
||||
|
||||
class Plugin
|
||||
|
|
|
@ -93,19 +93,15 @@ void PluginsPage::rebuildContent()
|
|||
pl->addRow("License", new QLabel(plugin->meta.license));
|
||||
|
||||
QString libString;
|
||||
bool hasDangerous = false;
|
||||
for (const auto &library : plugin->meta.libraryPermissions)
|
||||
{
|
||||
if (!libString.isEmpty())
|
||||
{
|
||||
libString += ", ";
|
||||
}
|
||||
if (library == "os" || library == "io" || library == "package")
|
||||
{
|
||||
hasDangerous = true;
|
||||
}
|
||||
libString += library;
|
||||
}
|
||||
bool hasDangerous = plugin->meta.hasDangerousLibraries();
|
||||
if (hasDangerous)
|
||||
{
|
||||
libString += "\nDetected potentially dangerous libraries used, be "
|
||||
|
|
Loading…
Reference in a new issue