Skip to content

Commit

Permalink
Improvements & enhancements when updating plugins
Browse files Browse the repository at this point in the history
Technical improvements to allow updating more plugins

Added some more plugins that can be updated:
 - KeePassWinHello
 - KPEntryTemplates
 - KPSimpleBackup

Closes #51
  • Loading branch information
Rookiestyle committed May 29, 2022
1 parent 60ca260 commit 113e7f8
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 11 deletions.
28 changes: 26 additions & 2 deletions ExternalPluginUpdates/ExternalPluginUpdates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ can use ExternalPluginUpdatesUser.xml to remove certain plugins
from one-click update
-->
<UpdateInfoExternList>
<Version>12</Version>
<Version>13</Version>
<UpdateInfoExtern>
<PluginName>WebAutoType</PluginName>
<PluginURL>https://sourceforge.net/projects/webautotype/</PluginURL>
Expand Down Expand Up @@ -85,7 +85,7 @@ from one-click update
<UpdateInfoExtern>
<PluginName>KPSync For Google Drive</PluginName>
<PluginURL>https://github.com/walterpg/google-drive-sync/releases</PluginURL>
<PluginUpdateURL>https://github.com/walterpg/google-drive-sync/releases/latest/download/KPSyncForDrive-{major}.{minor}.{build}.plgx</PluginUpdateURL>
<PluginUpdateURL>https://github.com/walterpg/google-drive-sync/releases/latest/download/KPSyncForDrive-{major}.{minor}.{build!}.plgx</PluginUpdateURL>
<UpdateMode>PlgxDirect</UpdateMode>
<AllowVersionStripping>False</AllowVersionStripping>
</UpdateInfoExtern>
Expand Down Expand Up @@ -159,4 +159,28 @@ from one-click update
<UpdateMode>PlgxDirect</UpdateMode>
<AllowVersionStripping>False</AllowVersionStripping>
</UpdateInfoExtern>
<!-- KPEntry Templates by Mitch Capper -->
<UpdateInfoExtern>
<PluginName>Entry Templates for KeePass</PluginName>
<PluginURL>https://keepass.info/plugins.html#kpentrytemplates</PluginURL>
<PluginUpdateURL>https://github.com/mitchcapper/KPEntryTemplates/releases/latest/download/KPEntryTemplates.plgx</PluginUpdateURL>
<UpdateMode>PlgxDirect</UpdateMode>
<AllowVersionStripping>False</AllowVersionStripping>
</UpdateInfoExtern>
<!-- KeePass Windows Hello by sirAndros -->
<UpdateInfoExtern>
<PluginName>KeePassWinHello</PluginName>
<PluginURL>https://github.com/sirAndros/KeePassWinHello/</PluginURL>
<PluginUpdateURL>https://github.com/sirAndros/KeePassWinHello/releases/latest/download/KeePassWinHelloPlugin.plgx</PluginUpdateURL>
<UpdateMode>PlgxDirect</UpdateMode>
<AllowVersionStripping>False</AllowVersionStripping>
</UpdateInfoExtern>
<!-- KPSimple Backup by Marvin Weber -->
<UpdateInfoExtern>
<PluginName>KPSimpleBackup</PluginName>
<PluginURL>https://github.com/marvinweber/KPSimpleBackup/</PluginURL>
<PluginUpdateURL>https://github.com/marvinweber/KPSimpleBackup/releases/latest/download/KPSimpleBackup-v{major}.{minor}.{build!}.zip</PluginUpdateURL>
<UpdateMode>ZipExtractPlgx</UpdateMode>
<AllowVersionStripping>False</AllowVersionStripping>
</UpdateInfoExtern>
</UpdateInfoExternList>
15 changes: 10 additions & 5 deletions src/PluginUpdateInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,17 @@ protected virtual string MergeInVersion(bool bUseAvailableVersion)
Regex r = new Regex(@"\{([^}]*)REVISION\}", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
if (bStripping) sResult = r.Replace(sResult, string.Empty);
else sResult = r.Replace(sResult, "$1\n" + v.Revision.ToString());


bStripping &= v.Build < 1;
r = new Regex(@"\{([^}]*)BUILD\}", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
if (bStripping) sResult = r.Replace(sResult, string.Empty);
else sResult = r.Replace(sResult, "$1\n" + v.Build.ToString());
else
{
sResult = r.Replace(sResult, "$1\n" + v.Build.ToString());
//Special handling for plugins that ALWAYS include the build
r = new Regex(@"\{([^}]*)BUILD!\}", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
sResult = r.Replace(sResult, "$1\n0");
}

bStripping &= v.Minor < 1;
r = new Regex(@"\{([^}]*)MINOR\}", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
Expand Down Expand Up @@ -1038,16 +1043,16 @@ internal static PluginUpdate Factory(string sPluginNamespace)
{
switch (sPluginNamespace.ToLowerInvariant())
{
case "kpsyncfordrive": return new OPU_KPSyncForDrive(sPluginNamespace);
//case "kpsyncfordrive": return new OPU_EnforceBuild(sPluginNamespace);
default: return new OtherPluginUpdate(sPluginNamespace);
}
throw new NotImplementedException();
}
}

internal class OPU_KPSyncForDrive : OtherPluginUpdate
internal class OPU_EnforceBuild : OtherPluginUpdate
{
internal OPU_KPSyncForDrive(string PluginName) : base(PluginName) { }
internal OPU_EnforceBuild(string PluginName) : base(PluginName) { }
protected override string MergeInVersion(bool bUseAvailableVersion)
{
//KPSyn for Drive always uses major, minor and revision
Expand Down
4 changes: 2 additions & 2 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("4.1.4")]
[assembly: AssemblyFileVersion("4.1.4")]
[assembly: AssemblyVersion("4.2")]
[assembly: AssemblyFileVersion("4.2")]
[assembly: Guid("672570AF-CC57-4980-86F9-D48FD1CC707D")]
4 changes: 2 additions & 2 deletions version.info
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
:
Early update check:4.1.4
Early update check:4.2
Early update check!de:9
Early update check!ru:2
Early update check!fr:1
Early update check!pt:3
Early update check!it:1
Early update check!zh:1
Early update check!ja:1
ExternalPluginUpdates:12
ExternalPluginUpdates:13
:

0 comments on commit 113e7f8

Please sign in to comment.