feat: add repo name to installer

This commit is contained in:
goat 2020-12-14 18:20:34 +01:00
parent 1c593f8350
commit 078dea73fc
3 changed files with 13 additions and 2 deletions

View file

@ -77,5 +77,10 @@ namespace Dalamud.Plugin
/// The last time this plugin was updated.
/// </summary>
public long LastUpdate { get; set; }
/// <summary>
/// Domain of the origin repo
/// </summary>
public string FromRepo { get; set; }
}
}

View file

@ -323,7 +323,7 @@ namespace Dalamud.Plugin
ImGui.Text(pluginDefinition.Name);
ImGui.SameLine();
ImGui.TextColored(new Vector4(0.5f, 0.5f, 0.5f, 1.0f),
$" by {pluginDefinition.Author}, {pluginDefinition.DownloadCount} downloads");
$" by {pluginDefinition.Author}, {pluginDefinition.DownloadCount} downloads{(pluginDefinition.FromRepo != "goatcorp.github.io" ? $", from {pluginDefinition.FromRepo}" : string.Empty)}");
ImGui.Text(pluginDefinition.Description);

View file

@ -15,7 +15,7 @@ namespace Dalamud.Plugin
{
internal class PluginRepository {
private string PluginFunctionBaseUrl => "https://us-central1-xl-functions.cloudfunctions.net/download-plugin/?plugin={0}&isUpdate={1}&isTesting={2}";
private string PluginMasterUrl => "https://raw.githubusercontent.com/goatcorp/DalamudPlugins/master/pluginmaster.json";
private string PluginMasterUrl => "https://goatcorp.github.io/DalamudPlugins/pluginmaster.json";
private readonly Dalamud dalamud;
private string pluginDirectory;
@ -58,6 +58,12 @@ namespace Dalamud.Plugin
var data = client.DownloadString(repo);
var unsortedPluginMaster = JsonConvert.DeserializeObject<List<PluginDefinition>>(data);
var host = new Uri(repo).Host;
foreach (var pluginDefinition in unsortedPluginMaster) {
pluginDefinition.FromRepo = host;
}
allPlugins.AddRange(unsortedPluginMaster);
}