Skip to content

Commit 124569b

Browse files
committed
fix: tons of change
1 parent 1bf3629 commit 124569b

7 files changed

Lines changed: 41 additions & 38 deletions

File tree

Lagrange.Core/Internal/Packets/Login/WtLogin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public async Task<ReadOnlyMemory<byte>> BuildOicq09Android(string password)
173173
tlvs.Tlv001();
174174
tlvs.Tlv106Pwd(password);
175175
tlvs.Tlv116();
176-
tlvs.Tlv100Android((uint)AppInfo.SdkInfo.MainSigMap);
176+
tlvs.Tlv100Android(16724722);
177177
tlvs.Tlv107Android();
178178
tlvs.Tlv142();
179179
tlvs.Tlv144Report(false);

Lagrange.Milky/Configuration/SignerConfiguration.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ public class SignerConfiguration
44
{
55
public string? Base { get; set; }
66

7-
public string? Version { get; set; }
8-
97
public string? Token { get; set; }
108

119
public string? ProxyUrl { get; set; }

Lagrange.Milky/Resources/appsettings.jsonc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
// Signer Base URL
2121
"Base": "https://sign.lagrangecore.org/api/sign",
2222

23-
// Signer version
24-
"Version": "30366",
25-
2623
// Signer token
2724
// "Token": null
2825

@@ -34,7 +31,7 @@
3431
// Account uin
3532
// If the Uin is inconsistent with the actual login account, quick login will not be possible
3633
"Uin": 0,
37-
34+
3835
// Account password
3936
// Set to null to login via QrCode
4037
// "Password": null,

Lagrange.Milky/Resources/appsettings_schema.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,12 @@
4141
},
4242
"Signer": {
4343
"type": "object",
44-
"required": ["Base", "Version"],
44+
"required": ["Base"],
4545
"properties": {
4646
"Base": {
4747
"type": "string",
4848
"description": "Signer Base URL"
4949
},
50-
"Version": {
51-
"type": "string",
52-
"description": "Signer version"
53-
},
5450
"Token": {
5551
"type": ["string", "null"],
5652
"description": "Signer token"

Lagrange.Milky/Utility/CaptchaResolver/OnlineCaptchaResolver.cs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,22 @@ public class OnlineCaptchaResolver(ILogger<OnlineCaptchaResolver> logger, IOptio
2828
{
2929
token.ThrowIfCancellationRequested();
3030

31-
string queryUrl = string.Format(QueryUrl, _bot.BotUin);
32-
var response = await _client.GetAsync(queryUrl, token);
33-
if (response.StatusCode == HttpStatusCode.NotFound)
34-
{
35-
_logger.LogCaptchaWaiting();
36-
continue;
37-
}
31+
// string queryUrl = string.Format(QueryUrl, _bot.BotUin);
32+
// var response = await _client.GetAsync(queryUrl, token);
33+
// if (response.StatusCode == HttpStatusCode.NotFound)
34+
// {
35+
// _logger.LogCaptchaWaiting();
36+
// continue;
37+
// }
3838

39-
if (!response.IsSuccessStatusCode)
40-
{
41-
throw new Exception($"Unexpected http status code({response.StatusCode})");
42-
}
39+
// if (!response.IsSuccessStatusCode)
40+
// {
41+
// throw new Exception($"Unexpected http status code({response.StatusCode})");
42+
// }
4343

44-
string result = await response.Content.ReadAsStringAsync(token);
45-
string? json = JsonNode.Parse(result)?["data"]?.GetValue<string>();
44+
// string result = await response.Content.ReadAsStringAsync(token);
45+
// string? json = JsonNode.Parse(result)?["data"]?.GetValue<string>();
46+
var json = await Console.In.ReadLineAsync(token);
4647
if (json == null) continue;
4748

4849
return (json.Split('|')[0], json.Split('|')[1]);

Lagrange.Milky/Utility/JsonUtility.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public static partial class JsonUtility
2929
[JsonSerializable(typeof(AndroidDebugXwidRequest))]
3030
[JsonSerializable(typeof(AndroidSignerResponse<AndroidSecSignResponseData>))]
3131
[JsonSerializable(typeof(AndroidSignerResponse<string>))]
32+
[JsonSerializable(typeof(AndroidSignerResponse<BotAppInfo>))]
3233

3334
// === api ===
3435
[JsonSerializable(typeof(ApiOkResult))]

Lagrange.Milky/Utility/Signer.cs

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ public class Signer : AndroidBotSignProvider, IDisposable
168168
private readonly ILogger<Signer> _logger;
169169

170170
private readonly string _base;
171-
private readonly string _version;
172171
private readonly string? _token;
173172
private readonly HttpClient _client;
174173

@@ -181,7 +180,6 @@ public Signer(ILogger<Signer> logger, IOptions<CoreConfiguration> options)
181180

182181
var signerConfiguration = options.Value.Signer;
183182
_base = signerConfiguration.Base ?? throw new Exception("Core.Signer.Base cannot be null");
184-
_version = signerConfiguration.Version ?? throw new Exception("Core.Signer.Version connot be null");
185183
_token = signerConfiguration.Token;
186184
_client = new HttpClient(new HttpClientHandler
187185
{
@@ -230,7 +228,7 @@ public override bool IsWhiteListCommand(string cmd)
230228
private async Task<SsoSecureInfo> GetPcSecSign(string cmd, int seq, ReadOnlyMemory<byte> body)
231229
{
232230
var response = await GetSign<PcSecSignRequest, PcSecSignResponse>(
233-
$"{_base}/{_version}",
231+
_base,
234232
new PcSecSignRequest(cmd, seq, Convert.ToHexString(body.Span))
235233
);
236234

@@ -252,7 +250,8 @@ private async Task<SsoSecureInfo> GetAndroidSecSign(long uin, string cmd, int se
252250
seq,
253251
Convert.ToHexString(body.Span),
254252
Convert.ToHexString(Context.Keystore.Guid),
255-
Context.AppInfo.PtVersion
253+
Context.AppInfo.PtVersion,
254+
"V1_AND_SQ_9.2.20_11650_YYB_D"
256255
)
257256
);
258257

@@ -275,7 +274,8 @@ public override async Task<byte[]> GetEnergy(long uin, string data)
275274
data,
276275
Convert.ToHexString(Context.Keystore.Guid),
277276
Context.AppInfo.SdkInfo.SdkVersion,
278-
Context.AppInfo.PtVersion
277+
Context.AppInfo.PtVersion,
278+
"V1_AND_SQ_9.2.20_11650_YYB_D"
279279
)
280280
);
281281

@@ -298,7 +298,8 @@ public override async Task<byte[]> GetDebugXwid(long uin, string data)
298298
uin,
299299
data,
300300
Convert.ToHexString(Context.Keystore.Guid),
301-
Context.AppInfo.PtVersion
301+
Context.AppInfo.PtVersion,
302+
"V1_AND_SQ_9.2.20_11650_YYB_D"
302303
)
303304
);
304305

@@ -340,17 +341,17 @@ public async Task<BotAppInfo> GetAppInfo()
340341

341342
using var request = new HttpRequestMessage();
342343
request.Method = HttpMethod.Get;
343-
request.RequestUri = new Uri($"{_base}/{_version}/appinfo_v2");
344+
request.RequestUri = new Uri($"{_base}/appinfo_v2");
344345
if (!string.IsNullOrWhiteSpace(_token)) request.Headers.Add("X-API-Key", _token);
345346

346347
using var response = await _client.SendAsync(request);
347348
if (!response.IsSuccessStatusCode) throw new Exception($"Unexpected http status code({response.StatusCode})");
348349

349-
var result = JsonUtility.Deserialize<BotAppInfo>(await response.Content.ReadAsStreamAsync());
350+
var result = JsonUtility.Deserialize<AndroidSignerResponse<BotAppInfo>>(await response.Content.ReadAsStreamAsync());
350351
if (result == null) throw new NullReferenceException("Result is null");
351352

352-
_info = result;
353-
return result;
353+
_info = result.Data;
354+
return result.Data;
354355
}
355356
finally
356357
{
@@ -400,7 +401,7 @@ public class PcSecSignResponseValue(string sign, string token, string extra)
400401
public string Extra { get; init; } = extra;
401402
}
402403

403-
public class AndroidSecSignRequest(long uin, string cmd, int seq, string buffer, string guid, string version)
404+
public class AndroidSecSignRequest(long uin, string cmd, int seq, string buffer, string guid, string version, string qua)
404405
{
405406
[JsonPropertyName("uin")]
406407
public long Uin { get; } = uin;
@@ -419,9 +420,12 @@ public class AndroidSecSignRequest(long uin, string cmd, int seq, string buffer,
419420

420421
[JsonPropertyName("version")]
421422
public string Version { get; } = version;
423+
424+
[JsonPropertyName("qua")]
425+
public string Qua { get; } = qua;
422426
}
423427

424-
public class AndroidEnergyRequest(long uin, string data, string guid, string ver, string version)
428+
public class AndroidEnergyRequest(long uin, string data, string guid, string ver, string version, string qua)
425429
{
426430
[JsonPropertyName("uin")]
427431
public long Uin { get; } = uin;
@@ -437,9 +441,12 @@ public class AndroidEnergyRequest(long uin, string data, string guid, string ver
437441

438442
[JsonPropertyName("version")]
439443
public string Version { get; } = version;
444+
445+
[JsonPropertyName("qua")]
446+
public string Qua { get; } = qua;
440447
}
441448

442-
public class AndroidDebugXwidRequest(long uin, string data, string guid, string version)
449+
public class AndroidDebugXwidRequest(long uin, string data, string guid, string version, string qua)
443450
{
444451
[JsonPropertyName("uin")]
445452
public long Uin { get; } = uin;
@@ -452,6 +459,9 @@ public class AndroidDebugXwidRequest(long uin, string data, string guid, string
452459

453460
[JsonPropertyName("version")]
454461
public string Version { get; } = version;
462+
463+
[JsonPropertyName("qua")]
464+
public string Qua { get; } = qua;
455465
}
456466

457467
public class AndroidSignerResponse<TData>(TData data)

0 commit comments

Comments
 (0)