Big update. Replaced Newtonsoft with System.Text.Json where possible, removed Spectre, tried to suppress the pile of compiler warnings I get on the GUI project, and tried to correct an issue where sometimes the session token retrieved is not usable.

This commit is contained in:
barelyprofessional
2024-06-14 23:03:05 +08:00
parent 98f7b2b27e
commit cdad1d6549
21 changed files with 281 additions and 251 deletions

View File

@@ -40,11 +40,11 @@ public class KfTokenService
await page.WaitForSelectorAsync("img[alt=\"Kiwi Farms\"]");
if (await page.QuerySelectorAsync("html[data-template=\"login\"]") == null)
{
logger.Debug("Page template is not login. This is expected if we're already logged in. Retrieving cookies");
logger.Debug("Page template is not login. This is expected if we're already logged in. Reloading page to get the freshest cookies then retrieving");
await page.ReloadAsync();
return await GetXfSessionCookie();
}
var usernameFieldSelector = await page.QuerySelectorAsync("input[autocomplete=\"username\"]");
var passwordFieldSelector = await page.QuerySelectorAsync("input[autocomplete=\"current-password\"]");
var loginButtonSelector = await page.QuerySelectorAsync("div[class=\"formSubmitRow-controls\"] > button[type=\"submit\"]");