From f50dab94a49031770e766a20dce8ef3bcd96c8b9 Mon Sep 17 00:00:00 2001 From: Robert McRackan Date: Tue, 11 Aug 2020 14:19:35 -0400 Subject: [PATCH] Libation 4.0 prep: incrementally incorporate jsonpath (1) all AccountsSettings.json access must use centralized jsonpath. For now == null --- FileManager/UNTESTED/AudibleApiStorage.cs | 20 +++++++++++++++++-- .../UNTESTED/AudibleApiActions.cs | 6 +----- LibationLauncher/LibationLauncher.csproj | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/FileManager/UNTESTED/AudibleApiStorage.cs b/FileManager/UNTESTED/AudibleApiStorage.cs index 868d47c3..7f06a75e 100644 --- a/FileManager/UNTESTED/AudibleApiStorage.cs +++ b/FileManager/UNTESTED/AudibleApiStorage.cs @@ -1,10 +1,26 @@ -using System.IO; +using Newtonsoft.Json; +using System.IO; namespace FileManager { public static class AudibleApiStorage { - // not customizable. don't move to config public static string AccountsSettingsFile => Path.Combine(Configuration.Instance.LibationFiles, "AccountsSettings.json"); + + public static string GetJsonPath( + //string username + ////, string locale + ) + { + return null; + + + //var usernameSanitized = JsonConvert.ToString(username); + + ////var localeSanitized = JsonConvert.ToString(locale); + ////return $"$.ApiConnectionSettings[?(@.Username == '{usernameSanitized}' && @.IdentityTokens.Locale == '{localeSanitized}')].IdentityTokens"; + + //return $"$.ApiConnectionSettings[?(@.Username == '{usernameSanitized}')].IdentityTokens"; + } } } diff --git a/InternalUtilities/UNTESTED/AudibleApiActions.cs b/InternalUtilities/UNTESTED/AudibleApiActions.cs index 2b743a4a..29578cfe 100644 --- a/InternalUtilities/UNTESTED/AudibleApiActions.cs +++ b/InternalUtilities/UNTESTED/AudibleApiActions.cs @@ -15,13 +15,9 @@ namespace InternalUtilities /// USE THIS from within Libation. It wraps the call with correct JSONPath public static async Task GetApiAsync(ILoginCallback loginCallback = null) { - var identityFilePath = AudibleApiStorage.AccountsSettingsFile; - - // TODO: get jsonpath from ... somewhere - string jsonPath = null; Localization.SetLocale(Configuration.Instance.LocaleCountryCode); - return await EzApiCreator.GetApiAsync(identityFilePath, loginCallback, jsonPath); + return await EzApiCreator.GetApiAsync(AudibleApiStorage.AccountsSettingsFile, AudibleApiStorage.GetJsonPath(), loginCallback); } private static AsyncRetryPolicy policy { get; } diff --git a/LibationLauncher/LibationLauncher.csproj b/LibationLauncher/LibationLauncher.csproj index dda944db..b3611b1e 100644 --- a/LibationLauncher/LibationLauncher.csproj +++ b/LibationLauncher/LibationLauncher.csproj @@ -13,7 +13,7 @@ win-x64 - 3.1.12.54 + 3.1.12.62