diff --git a/ModpackUpdater.Manager/Extensions.cs b/ModpackUpdater.Manager/Extensions.cs index 4b518cd..2c25730 100644 --- a/ModpackUpdater.Manager/Extensions.cs +++ b/ModpackUpdater.Manager/Extensions.cs @@ -47,4 +47,18 @@ public static class Extensions return @this.SourceUrl; return @this.SourceUrl.Replace("{version}", version.ToString(3)); } + + public static string GetInstallUrl(this ModpackConfig @this) + { + if (string.IsNullOrWhiteSpace(@this.RefTag)) + return @this.InstallUrl; + return @this.InstallUrl.Replace("{ref}", @this.RefTag); + } + + public static string GetUpdateUrl(this ModpackConfig @this) + { + if (string.IsNullOrWhiteSpace(@this.RefTag)) + return @this.UpdateUrl; + return @this.UpdateUrl.Replace("{ref}", @this.RefTag); + } } \ No newline at end of file diff --git a/ModpackUpdater.Manager/ModpackInstaller.cs b/ModpackUpdater.Manager/ModpackInstaller.cs index bde60c2..26c3847 100644 --- a/ModpackUpdater.Manager/ModpackInstaller.cs +++ b/ModpackUpdater.Manager/ModpackInstaller.cs @@ -32,13 +32,13 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf private async Task DownloadUpdateInfos() { - var content = await http.GetStringAsync(updateConfig.UpdateUrl); + var content = await http.GetStringAsync(updateConfig.GetUpdateUrl()); return UpdateInfos.Parse(content); } private async Task DownloadInstallInfos() { - var content = await http.GetStringAsync(updateConfig.InstallUrl); + var content = await http.GetStringAsync(updateConfig.GetInstallUrl()); return InstallInfos.Parse(content); } diff --git a/ModpackUpdater/ModpackConfig.cs b/ModpackUpdater/ModpackConfig.cs index 9d3d30d..9d53935 100644 --- a/ModpackUpdater/ModpackConfig.cs +++ b/ModpackUpdater/ModpackConfig.cs @@ -13,6 +13,7 @@ public class ModpackConfig public string UnleashInstanceId { get; set; } public bool PreferDirectLinks { get; set; } public string MinecraftVersion { get; set; } + public string RefTag { get; set; } [JsonConverter(typeof(StringEnumConverter))] public ModLoader ModLoader { get; set; }