|
8 | 8 | using System.Security.Cryptography; |
9 | 9 |
|
10 | 10 | namespace Olympus { |
11 | | - public class CmdUpdateAllMods : Cmd<string, bool, string, IEnumerator> { |
| 11 | + public class CmdUpdateAllMods : Cmd<string, bool, string, bool, IEnumerator> { |
12 | 12 | public override bool Taskable => true; |
13 | 13 |
|
14 | | - public override IEnumerator Run(string root, bool onlyEnabled, string mirrorPreferences) { |
| 14 | + public override IEnumerator Run(string root, bool onlyEnabled, string mirrorPreferences, bool apiMirror) { |
15 | 15 | yield return "Downloading mod versions list..."; |
16 | | - Dictionary<string, ModUpdateInfo> modVersionList = downloadModUpdateList(); |
| 16 | + Dictionary<string, ModUpdateInfo> modVersionList = downloadModUpdateList(apiMirror); |
17 | 17 |
|
18 | 18 | yield return "Checking for outdated mods..."; |
19 | 19 |
|
@@ -186,11 +186,11 @@ private static void log(string line) { |
186 | 186 | /// Downloads the full update list from the update checker server. |
187 | 187 | /// Returns null if the download fails for any reason. |
188 | 188 | /// </summary> |
189 | | - private static Dictionary<string, ModUpdateInfo> downloadModUpdateList() { |
| 189 | + private static Dictionary<string, ModUpdateInfo> downloadModUpdateList(bool apiMirror) { |
190 | 190 | Dictionary<string, ModUpdateInfo> updateCatalog = null; |
191 | 191 |
|
192 | 192 | try { |
193 | | - string modUpdaterDatabaseUrl = getModUpdaterDatabaseUrl(); |
| 193 | + string modUpdaterDatabaseUrl = getModUpdaterDatabaseUrl(apiMirror); |
194 | 194 |
|
195 | 195 | log($"Downloading last versions list from {modUpdaterDatabaseUrl}"); |
196 | 196 |
|
@@ -252,7 +252,9 @@ private static void installModUpdate(ModUpdateInfo update, CmdModList.ModInfo mo |
252 | 252 | /// Retrieves the mod updater database location from everestapi.github.io. |
253 | 253 | /// This should point to a running instance of https://github.com/maddie480/EverestUpdateCheckerServer. |
254 | 254 | /// </summary> |
255 | | - private static string getModUpdaterDatabaseUrl() { |
| 255 | + private static string getModUpdaterDatabaseUrl(bool apiMirror) { |
| 256 | + if (apiMirror) return "https://everestapi.github.io/updatermirror/everest_update.yaml"; |
| 257 | + |
256 | 258 | using (HttpClient wc = new HttpClientWithCompressionSupport()) { |
257 | 259 | log("Fetching mod updater database URL"); |
258 | 260 | return wc.GetStringAsync("https://everestapi.github.io/modupdater.txt").Result.Trim(); |
|
0 commit comments