mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-22 15:57:44 +01:00
feat: add download counts to PluginRepository, PluginInstallerWindow
This commit is contained in:
parent
93352b9883
commit
61662b536c
3 changed files with 18 additions and 5 deletions
|
|
@ -57,5 +57,10 @@ namespace Dalamud.Plugin
|
||||||
/// The API level of this plugin. For the current API level, please see <see cref="PluginManager.DALAMUD_API_LEVEL"/> for the currently used API level.
|
/// The API level of this plugin. For the current API level, please see <see cref="PluginManager.DALAMUD_API_LEVEL"/> for the currently used API level.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int DalamudApiLevel { get; set; }
|
public int DalamudApiLevel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of downloads this plugin has.
|
||||||
|
/// </summary>
|
||||||
|
public long DownloadCount { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ namespace Dalamud.Plugin
|
||||||
|
|
||||||
ImGui.Text(pluginDefinition.Name);
|
ImGui.Text(pluginDefinition.Name);
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.TextColored(new Vector4(0.5f, 0.5f, 0.5f, 1.0f), $" by {pluginDefinition.Author}");
|
ImGui.TextColored(new Vector4(0.5f, 0.5f, 0.5f, 1.0f), $" by {pluginDefinition.Author}, {pluginDefinition.DownloadCount} downloads");
|
||||||
|
|
||||||
ImGui.Text(pluginDefinition.Description);
|
ImGui.Text(pluginDefinition.Description);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,10 @@ namespace Dalamud.Plugin
|
||||||
{
|
{
|
||||||
internal class PluginRepository
|
internal class PluginRepository
|
||||||
{
|
{
|
||||||
private string PluginRepoBaseUrl => "https://raw.githubusercontent.com/goatcorp/DalamudPlugins/" + (this.dalamud.Configuration.DoPluginTest ? "testing/" : "master/");
|
private string PluginRepoBaseUrl => "https://raw.githubusercontent.com/goatcorp/DalamudPlugins/testing/plugins/{0}/latest.zip";
|
||||||
|
private string PluginFunctionBaseUrl => "https://us-central1-xl-functions.cloudfunctions.net/download-plugin/?plugin={0}";
|
||||||
|
private string PluginMasterUrl => "https://raw.githubusercontent.com/goatcorp/DalamudPlugins/" + (this.dalamud.Configuration.DoPluginTest ? "testing/" : "master/") + "pluginmaster.json";
|
||||||
|
|
||||||
|
|
||||||
private readonly Dalamud dalamud;
|
private readonly Dalamud dalamud;
|
||||||
private string pluginDirectory;
|
private string pluginDirectory;
|
||||||
|
|
@ -46,7 +49,7 @@ namespace Dalamud.Plugin
|
||||||
{
|
{
|
||||||
using var client = new WebClient();
|
using var client = new WebClient();
|
||||||
|
|
||||||
var data = client.DownloadString(PluginRepoBaseUrl + "pluginmaster.json");
|
var data = client.DownloadString(PluginMasterUrl);
|
||||||
|
|
||||||
this.PluginMaster = JsonConvert.DeserializeObject<ReadOnlyCollection<PluginDefinition>>(data);
|
this.PluginMaster = JsonConvert.DeserializeObject<ReadOnlyCollection<PluginDefinition>>(data);
|
||||||
|
|
||||||
|
|
@ -92,9 +95,14 @@ namespace Dalamud.Plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
var path = Path.GetTempFileName();
|
var path = Path.GetTempFileName();
|
||||||
Log.Information("Downloading plugin to {0}", path);
|
|
||||||
using var client = new WebClient();
|
using var client = new WebClient();
|
||||||
client.DownloadFile(PluginRepoBaseUrl + $"/plugins/{definition.InternalName}/latest.zip", path);
|
|
||||||
|
var url = this.dalamud.Configuration.DoPluginTest ? PluginRepoBaseUrl : PluginFunctionBaseUrl;
|
||||||
|
url = string.Format(url, definition.InternalName);
|
||||||
|
Log.Information("Downloading plugin to {0} from {1}", path, url);
|
||||||
|
|
||||||
|
client.DownloadFile(url, path);
|
||||||
|
|
||||||
Log.Information("Extracting to {0}", outputDir);
|
Log.Information("Extracting to {0}", outputDir);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue