Skip to content

Commit

Permalink
implement TestingDalamudApiLevel
Browse files Browse the repository at this point in the history
  • Loading branch information
goaaats committed Jul 1, 2024
1 parent b40c5aa commit 16e2f00
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion XLWebServices/Controllers/PluginController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public IActionResult PluginMaster([FromQuery] bool proxy = true, [FromQuery] int

if (minApiLevel > 0)
{
pluginMaster = pluginMaster.Where(manifest => manifest.DalamudApiLevel >= minApiLevel).ToArray();
pluginMaster = pluginMaster.Where(manifest => manifest.DalamudApiLevel >= minApiLevel ||
manifest.TestingDalamudApiLevel >= minApiLevel).ToArray();
}

return Content(JsonSerializer.Serialize(pluginMaster), "application/json");
Expand Down
9 changes: 7 additions & 2 deletions XLWebServices/Services/PluginData/PluginDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,12 @@ async Task ProcessPluginsInChannel(Dip17State.Channel channel, string channelNam
if (manifest == null)
throw new Exception($"Could not fetch manifest for DIP17 plugin: {channelName}/{pluginName}");

if (manifest.DalamudApiLevel < apiLevel - 2)
if (Math.Max(manifest.DalamudApiLevel, manifest.TestingDalamudApiLevel) < apiLevel - 2)
{
_logger.LogInformation("{PluginName} too old, api{Level}", manifest.InternalName, manifest.DalamudApiLevel);
_logger.LogInformation("{PluginName} too old, api{Level} (testing: api{TestingLevel})",
manifest.InternalName,
manifest.DalamudApiLevel,
manifest.TestingDalamudApiLevel);
continue;
}

Expand Down Expand Up @@ -228,13 +231,15 @@ async Task ProcessPluginsInChannel(Dip17State.Channel channel, string channelNam
if (stableVersion != null)
{
stableVersion.TestingAssemblyVersion = manifest.AssemblyVersion;
stableVersion.TestingDalamudApiLevel = manifest.DalamudApiLevel;
stableVersion.IsTestingExclusive = false;
stableVersion.IsDip17Plugin = true;
stableVersion.Dip17Channel = channelName;
}
else
{
manifest.TestingAssemblyVersion = manifest.AssemblyVersion;
manifest.TestingDalamudApiLevel = manifest.DalamudApiLevel;
manifest.IsTestingExclusive = true;
pluginMaster.Add(manifest);
}
Expand Down
9 changes: 9 additions & 0 deletions XLWebServices/Services/PluginData/PluginManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public PluginManifest(PluginManifest toCopy)
this.RepoUrl = toCopy.RepoUrl;
this.ApplicableVersion = toCopy.ApplicableVersion;
this.DalamudApiLevel = toCopy.DalamudApiLevel;
this.TestingDalamudApiLevel = toCopy.TestingDalamudApiLevel;
this.DownloadCount = toCopy.DownloadCount;
this.LastUpdate = toCopy.LastUpdate;
this.DownloadLinkInstall = toCopy.DownloadLinkInstall;
Expand Down Expand Up @@ -147,6 +148,14 @@ public PluginManifest(PluginManifest toCopy)
/// </summary>
[JsonPropertyName("DalamudApiLevel")]
public int DalamudApiLevel { get; set; }

/// <summary>
/// Gets the API level of this plugin's testing version. For the current API level, please see
/// <see cref="PluginManager.DalamudApiLevel" />
/// for the currently used API level.
/// </summary>
[JsonPropertyName("TestingDalamudApiLevel")]
public int TestingDalamudApiLevel { get; set; }

/// <summary>
/// Gets the number of downloads this plugin has.
Expand Down

0 comments on commit 16e2f00

Please sign in to comment.