Skip to content

Commit

Permalink
Implemented plugin manifest update
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfug committed Jul 10, 2024
1 parent 1268a7a commit d6ae8d7
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
4 changes: 4 additions & 0 deletions FugioApp/plugins/pluginsform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ void PluginsForm::on_mButtonSourceUpdateAll_clicked()

mPluginCache.updateRepo( RepoName );
}

rebuildPluginInformation();
}


Expand All @@ -91,6 +93,8 @@ void PluginsForm::on_mButtonSourceUpdate_clicked()
QListWidgetItem *item = ui->mSourceList->currentItem();

mPluginCache.updateRepo( item->text() );

rebuildPluginInformation();
}

void PluginsForm::rebuildPluginInformation()
Expand Down
55 changes: 54 additions & 1 deletion FugioLib/pluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,60 @@ void PluginCache::updateRepo( const QString &pRepoName )
QString CacheFileName = repoCacheDirectory().absoluteFilePath( QString( "%1.manifest.json" ).arg( pRepoName ) );
QFileInfo CacheFileInfo( CacheFileName );

qDebug() << CacheFileInfo.lastModified().toUTC();
QDateTime CacheModified = CacheFileInfo.lastModified().toUTC();

qDebug() << CacheModified;

QUrl url = repoUrl( pRepoName );
QString manifestFilename;
bool manifestRemove = false;
QDateTime modified;

if( !url.isLocalFile() )
{
PluginActionDownload RepoDown( url );

RepoDown.setAutoRemove( false );

if( RepoDown.action() )
{
manifestFilename = RepoDown.tempFileName();

modified = RepoDown.modified();

manifestRemove = true;
}
}
else
{
QFileInfo repoFileInfo( url.toLocalFile() );

manifestFilename = repoFileInfo.absoluteFilePath();

modified = repoFileInfo.lastModified().toUTC();
}

if( manifestFilename.isEmpty() )
{
return;
}


if( modified <= CacheModified )
{
return;
}

PluginRepoManifest RepoManifest( manifestFilename, "win64" );

RepoManifest.setModified( modified );

addRepoManifest( RepoManifest, url );

if( manifestRemove )
{
QFile::remove( manifestFilename );
}
}

void PluginCache::updateRepos()
Expand Down

0 comments on commit d6ae8d7

Please sign in to comment.