mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
fix code style
This commit is contained in:
@@ -25,7 +25,7 @@ public class ImageCache : IImageCache
|
||||
{
|
||||
private const string DateAccessedProperty = "System.DateAccessed";
|
||||
|
||||
private static readonly ImmutableDictionary<int, TimeSpan> retryCountToDelay = new Dictionary<int, TimeSpan>()
|
||||
private static readonly ImmutableDictionary<int, TimeSpan> RetryCountToDelay = new Dictionary<int, TimeSpan>()
|
||||
{
|
||||
[0] = TimeSpan.FromSeconds(4),
|
||||
[1] = TimeSpan.FromSeconds(16),
|
||||
@@ -239,7 +239,7 @@ public class ImageCache : IImageCache
|
||||
else
|
||||
{
|
||||
retryCount++;
|
||||
TimeSpan delay = message.Headers.RetryAfter?.Delta ?? retryCountToDelay[retryCount];
|
||||
TimeSpan delay = message.Headers.RetryAfter?.Delta ?? RetryCountToDelay[retryCount];
|
||||
await Task.Delay(delay).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<Identity
|
||||
Name="7f0db578-026f-4e0b-a75b-d5d06bb0a74d"
|
||||
Publisher="CN=DGP Studio"
|
||||
Version="1.2.3.0" />
|
||||
Version="1.2.4.0" />
|
||||
|
||||
<Properties>
|
||||
<DisplayName>胡桃</DisplayName>
|
||||
|
||||
@@ -21,6 +21,7 @@ internal class GeetestClient
|
||||
/// 构造一个新的极验客户端
|
||||
/// </summary>
|
||||
/// <param name="httpClient">http客户端</param>
|
||||
/// <param name="options">Json 序列化选项</param>
|
||||
public GeetestClient(HttpClient httpClient, JsonSerializerOptions options)
|
||||
{
|
||||
this.httpClient = httpClient;
|
||||
@@ -64,44 +65,3 @@ internal class GeetestClient
|
||||
return GetAjaxAsync(registration.Gt, registration.Challenge);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 极验返回结果信息
|
||||
/// </summary>
|
||||
public class GeetestResult<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// 成功失败的标识码 success
|
||||
/// </summary>
|
||||
[JsonPropertyName("status")]
|
||||
public string Status { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 返回数据,json格式
|
||||
/// </summary>
|
||||
[JsonPropertyName("data")]
|
||||
public T Data { get; set; } = default!;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 极验数据
|
||||
/// </summary>
|
||||
public class GeetestData
|
||||
{
|
||||
/// <summary>
|
||||
/// 结果
|
||||
/// </summary>
|
||||
[JsonPropertyName("result")]
|
||||
public string Result { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 验证
|
||||
/// </summary>
|
||||
[JsonPropertyName("validate")]
|
||||
public string? Validate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分数
|
||||
/// </summary>
|
||||
public int Score { get; set; } = default!;
|
||||
}
|
||||
27
src/Snap.Hutao/Snap.Hutao/Web/Geetest/GeetestData.cs
Normal file
27
src/Snap.Hutao/Snap.Hutao/Web/Geetest/GeetestData.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Web.Geetest;
|
||||
|
||||
/// <summary>
|
||||
/// 极验数据
|
||||
/// </summary>
|
||||
public class GeetestData
|
||||
{
|
||||
/// <summary>
|
||||
/// 结果
|
||||
/// </summary>
|
||||
[JsonPropertyName("result")]
|
||||
public string Result { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 验证
|
||||
/// </summary>
|
||||
[JsonPropertyName("validate")]
|
||||
public string? Validate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分数
|
||||
/// </summary>
|
||||
public int Score { get; set; } = default!;
|
||||
}
|
||||
23
src/Snap.Hutao/Snap.Hutao/Web/Geetest/GeetestResult.cs
Normal file
23
src/Snap.Hutao/Snap.Hutao/Web/Geetest/GeetestResult.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Web.Geetest;
|
||||
|
||||
/// <summary>
|
||||
/// 极验返回结果信息
|
||||
/// </summary>
|
||||
/// <typeparam name="T">数据类型</typeparam>
|
||||
public class GeetestResult<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// 成功失败的标识码 success
|
||||
/// </summary>
|
||||
[JsonPropertyName("status")]
|
||||
public string Status { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 返回数据,json格式
|
||||
/// </summary>
|
||||
[JsonPropertyName("data")]
|
||||
public T Data { get; set; } = default!;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace Snap.Hutao.Web.Hoyolab.Annotation;
|
||||
/// <summary>
|
||||
/// 指示相关的类忽略Http请求的Set-Cookie头
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple =false, Inherited =false)]
|
||||
internal class IgnoreSetCookieAttribute : Attribute
|
||||
{
|
||||
}
|
||||
@@ -61,8 +61,7 @@ internal class AuthClient
|
||||
/// <summary>
|
||||
/// 获取 MultiToken
|
||||
/// </summary>
|
||||
/// <param name="loginTicket">登录票证</param>
|
||||
/// <param name="loginUid">uid</param>
|
||||
/// <param name="cookie">login cookie</param>
|
||||
/// <param name="token">取消令牌</param>
|
||||
/// <returns>包含token的字典</returns>
|
||||
public async Task<Dictionary<string, string>> GetMultiTokenByLoginTicketAsync(Cookie cookie, CancellationToken token)
|
||||
|
||||
@@ -106,44 +106,4 @@ public class CardClient
|
||||
[JsonPropertyName("geetest_seccode")]
|
||||
public string GeetestSeccode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证注册
|
||||
/// </summary>
|
||||
public class VerificationRegistration
|
||||
{
|
||||
/// <summary>
|
||||
/// 极验流水号
|
||||
/// </summary>
|
||||
[JsonPropertyName("challenge")]
|
||||
public string Challenge { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 极验Id
|
||||
/// </summary>
|
||||
[JsonPropertyName("gt")]
|
||||
public string Gt { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 新验证
|
||||
/// </summary>
|
||||
public int NewCaptcha { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否成功注册
|
||||
/// </summary>
|
||||
public int Success { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证结果
|
||||
/// </summary>
|
||||
public class VerificationResult
|
||||
{
|
||||
/// <summary>
|
||||
/// 极验流水号
|
||||
/// </summary>
|
||||
[JsonPropertyName("challenge")]
|
||||
public string? Challenge { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.DependencyInjection.Annotation.HttpClient;
|
||||
using Snap.Hutao.Model.Entity;
|
||||
using Snap.Hutao.Web.Hoyolab.Annotation;
|
||||
using Snap.Hutao.Web.Hoyolab.DynamicSecret;
|
||||
using Snap.Hutao.Web.Hoyolab.Takumi.GameRecord.Widget;
|
||||
using Snap.Hutao.Web.Response;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace Snap.Hutao.Web.Hoyolab.Takumi.GameRecord;
|
||||
|
||||
/// <summary>
|
||||
/// 验证注册
|
||||
/// </summary>
|
||||
public class VerificationRegistration
|
||||
{
|
||||
/// <summary>
|
||||
/// 极验流水号
|
||||
/// </summary>
|
||||
[JsonPropertyName("challenge")]
|
||||
public string Challenge { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 极验Id
|
||||
/// </summary>
|
||||
[JsonPropertyName("gt")]
|
||||
public string Gt { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 新验证
|
||||
/// </summary>
|
||||
public int NewCaptcha { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否成功注册
|
||||
/// </summary>
|
||||
public int Success { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.DependencyInjection.Annotation.HttpClient;
|
||||
using Snap.Hutao.Model.Entity;
|
||||
using Snap.Hutao.Web.Hoyolab.Annotation;
|
||||
using Snap.Hutao.Web.Hoyolab.DynamicSecret;
|
||||
using Snap.Hutao.Web.Hoyolab.Takumi.GameRecord.Widget;
|
||||
using Snap.Hutao.Web.Response;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace Snap.Hutao.Web.Hoyolab.Takumi.GameRecord;
|
||||
|
||||
/// <summary>
|
||||
/// 验证结果
|
||||
/// </summary>
|
||||
public class VerificationResult
|
||||
{
|
||||
/// <summary>
|
||||
/// 极验流水号
|
||||
/// </summary>
|
||||
[JsonPropertyName("challenge")]
|
||||
public string? Challenge { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user