Skip to content

Commit

Permalink
Feat:修复命名与弃用皮肤获取
Browse files Browse the repository at this point in the history
1.添加统一通行证类注释
2.修复命名错误
3.弃用皮肤获取,改用 Skin 类
  • Loading branch information
zhi-feng2008 committed Sep 17, 2024
1 parent 0037c93 commit c518fbe
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
33 changes: 26 additions & 7 deletions Authentication/UnifiedPassAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

namespace StarLight_Core.Authentication
{
// 统一通行证验证类
/// <summary>
/// 统一通行证验证类
/// </summary>
public class UnifiedPassAuthenticator
{
private const string UnifiedPassBaseUrl = "https://auth.mc-user.com:233/";
Expand All @@ -27,7 +29,11 @@ public UnifiedPassAuthenticator(string username, string password, string serverI
BaseUrl = baseUrl;
}

// 统一通行证异步验证方法
/// <summary>
/// 统一通行证异步验证方法
/// </summary>
/// <returns>统一通行证账户信息</returns>
/// <exception cref="ApplicationException">身份验证时出错</exception>
public async Task<UnifiedPassAccount> UnifiedPassAuthAsync()
{
Uri authenticateUri = new Uri(new Uri(BaseUrl), ServerId +"/authserver/authenticate");
Expand Down Expand Up @@ -68,16 +74,23 @@ public async Task<UnifiedPassAccount> UnifiedPassAuthAsync()
return result;
}

public async Task<UnifiedPassAccount> RefreshUnifiedPassAsync(string clientToken, string refreshToken)
/// <summary>
/// 刷新统一通行证令牌
/// </summary>
/// <param name="clientToken">客户端令牌</param>
/// <param name="accessToken">资源令牌</param>
/// <returns>统一通行证账户信息</returns>
/// <exception cref="ApplicationException">刷新令牌时出错</exception>
public async Task<UnifiedPassAccount> RefreshUnifiedPassAsync(string clientToken, string accessToken)
{
var refreshPostData = new
{
accessToken = refreshToken,
accessToken = accessToken,
clientToken = clientToken,
requestUser = true
};

string jsonData = JsonSerializer.Serialize(refreshPostData);
var jsonData = JsonSerializer.Serialize(refreshPostData);
string response;
try
{
Expand All @@ -99,8 +112,14 @@ public async Task<UnifiedPassAccount> RefreshUnifiedPassAsync(string clientToken
};
}

// 获取玩家皮肤信息。
public static async Task<Dictionary<string, string>> RetrieveSkinInfo(string baseUrl, string profileId)
/// <summary>
/// 获取玩家皮肤信息
/// </summary>
/// <param name="baseUrl">基础 Url</param>
/// <param name="profileId">账户 Uuid</param>
/// <returns>无返回</returns>
[Obsolete("此方法已弃用,请使用 StarLight_Core.Skin 中的方法进行获取")]
public static Dictionary<string, string> RetrieveSkinInfo(string baseUrl, string profileId)
{
return new Dictionary<string, string>();
}
Expand Down
6 changes: 3 additions & 3 deletions StarLight.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>2.0.2-preview2</Version>
<Version>2.0.2-preview3</Version>
<Title>StarLight.Core</Title>
<Authors>Ink Marks Studio</Authors>
<Description>An efficient, modular, and versatile core for Minecraft launcher</Description>
Expand All @@ -20,8 +20,8 @@
<PackageReleaseNotes>无</PackageReleaseNotes>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<AssemblyName>StarLight_Core</AssemblyName>
<AssemblyVersion>2.0.2.2</AssemblyVersion>
<FileVersion>2.0.2.2</FileVersion>
<AssemblyVersion>2.0.2.3</AssemblyVersion>
<FileVersion>2.0.2.3</FileVersion>
<Copyright>Copyright (c) 2024 zhi-feng2008</Copyright>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
Expand Down

0 comments on commit c518fbe

Please sign in to comment.