public async Task <Http.Client> GetAuthedClient()
        {
            Helpers.Cookie[] cookies;
            if (Consts.IsServer || IsCloudFlareProtected)
            {
                try
                {
                    cookies = await Utils.FromEncryptedJson <Helpers.Cookie[]>(_encryptedKeyName);

                    if (cookies != null)
                    {
                        return(Helpers.GetClient(cookies, SiteURL.ToString()));
                    }
                }
                catch (FileNotFoundException) { }

                cookies = await Utils.Log(new RequestSiteLogin(this)).Task;

                return(Helpers.GetClient(cookies, SiteURL.ToString()));
            }

            cookies = await ClientAPI.GetAuthInfo <Helpers.Cookie[]>(_encryptedKeyName);

            var client = Helpers.GetClient(cookies, SiteURL.ToString());

            return(client);
        }
Пример #2
0
        public async Task <HttpClient> GetAuthedClient()
        {
            Helpers.Cookie[] cookies;
            try
            {
                cookies = Utils.FromEncryptedJson <Helpers.Cookie[]>(_encryptedKeyName);
                if (cookies != null)
                {
                    return(Helpers.GetClient(cookies, SiteURL.ToString()));
                }
            }
            catch (FileNotFoundException) { }

            cookies = await Utils.Log(new RequestSiteLogin(this)).Task;

            return(Helpers.GetClient(cookies, SiteURL.ToString()));
        }