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());
|
this->libraryPermissions.insert(t.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasDangerousLibraries()
|
||||||
|
{
|
||||||
|
const auto *perms = &this->libraryPermissions;
|
||||||
|
return perms->contains("io") || perms->contains("package") ||
|
||||||
|
perms->contains("os");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Plugin
|
class Plugin
|
||||||
|
|
|
@ -93,19 +93,15 @@ void PluginsPage::rebuildContent()
|
||||||
pl->addRow("License", new QLabel(plugin->meta.license));
|
pl->addRow("License", new QLabel(plugin->meta.license));
|
||||||
|
|
||||||
QString libString;
|
QString libString;
|
||||||
bool hasDangerous = false;
|
|
||||||
for (const auto &library : plugin->meta.libraryPermissions)
|
for (const auto &library : plugin->meta.libraryPermissions)
|
||||||
{
|
{
|
||||||
if (!libString.isEmpty())
|
if (!libString.isEmpty())
|
||||||
{
|
{
|
||||||
libString += ", ";
|
libString += ", ";
|
||||||
}
|
}
|
||||||
if (library == "os" || library == "io" || library == "package")
|
|
||||||
{
|
|
||||||
hasDangerous = true;
|
|
||||||
}
|
|
||||||
libString += library;
|
libString += library;
|
||||||
}
|
}
|
||||||
|
bool hasDangerous = plugin->meta.hasDangerousLibraries();
|
||||||
if (hasDangerous)
|
if (hasDangerous)
|
||||||
{
|
{
|
||||||
libString += "\nDetected potentially dangerous libraries used, be "
|
libString += "\nDetected potentially dangerous libraries used, be "
|
||||||
|
|
Loading…
Reference in a new issue