made RS not to ask for plugin confirmation on first load

This commit is contained in:
csoler 2017-07-29 23:12:56 +02:00
parent 345f24eb5f
commit e8415c4f03
9 changed files with 19 additions and 12 deletions

View file

@ -140,6 +140,8 @@ void RsPluginManager::loadPlugins(const std::vector<std::string>& plugin_directo
// 0 - get the list of files to read
bool first_time = (_accepted_hashes.empty()) && _rejected_hashes.empty() ;
for(uint32_t i=0;i<plugin_directories.size();++i)
{
librs::util::FolderIterator dirIt(plugin_directories[i],true);
@ -164,7 +166,7 @@ void RsPluginManager::loadPlugins(const std::vector<std::string>& plugin_directo
std::cerr << "Found plugin " << fullname << std::endl;
std::cerr << " Loading plugin..." << std::endl;
loadPlugin(fullname) ;
loadPlugin(fullname, first_time) ;
}
dirIt.closedir();
}
@ -262,7 +264,7 @@ bool RsPluginManager::loadPlugin(RsPlugin *p)
return true;
}
bool RsPluginManager::loadPlugin(const std::string& plugin_name)
bool RsPluginManager::loadPlugin(const std::string& plugin_name,bool first_time)
{
std::cerr << " Loading plugin " << plugin_name << std::endl;
@ -289,7 +291,7 @@ bool RsPluginManager::loadPlugin(const std::string& plugin_name)
if(!_allow_all_plugins)
{
if(_accepted_hashes.find(pinfo.file_hash) == _accepted_hashes.end() && _rejected_hashes.find(pinfo.file_hash) == _rejected_hashes.end() )
if(!RsServer::notify()->askForPluginConfirmation(pinfo.file_name,pinfo.file_hash.toStdString()))
if(!RsServer::notify()->askForPluginConfirmation(pinfo.file_name,pinfo.file_hash.toStdString(),first_time))
_rejected_hashes.insert(pinfo.file_hash) ; // accepted hashes are treated at the end, for security.
if(_rejected_hashes.find(pinfo.file_hash) != _rejected_hashes.end() )

View file

@ -106,7 +106,7 @@ class RsPluginManager: public RsPluginHandler, public p3Config
private:
bool loadPlugin(RsPlugin *) ;
bool loadPlugin(const std::string& shared_library_name) ;
bool loadPlugin(const std::string& shared_library_name, bool first_time) ;
RsFileHash hashPlugin(const std::string& shared_library_name) ;
std::vector<PluginInfo> _plugins ;