-
Notifications
You must be signed in to change notification settings - Fork 0
fix: tons of change #1
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -28,21 +28,22 @@ public class OnlineCaptchaResolver(ILogger<OnlineCaptchaResolver> logger, IOptio | |||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| token.ThrowIfCancellationRequested(); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| string queryUrl = string.Format(QueryUrl, _bot.BotUin); | ||||||||||||||||||||||||||||||||||||
| var response = await _client.GetAsync(queryUrl, token); | ||||||||||||||||||||||||||||||||||||
| if (response.StatusCode == HttpStatusCode.NotFound) | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| _logger.LogCaptchaWaiting(); | ||||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| // string queryUrl = string.Format(QueryUrl, _bot.BotUin); | ||||||||||||||||||||||||||||||||||||
| // var response = await _client.GetAsync(queryUrl, token); | ||||||||||||||||||||||||||||||||||||
| // if (response.StatusCode == HttpStatusCode.NotFound) | ||||||||||||||||||||||||||||||||||||
| // { | ||||||||||||||||||||||||||||||||||||
| // _logger.LogCaptchaWaiting(); | ||||||||||||||||||||||||||||||||||||
| // continue; | ||||||||||||||||||||||||||||||||||||
| // } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| if (!response.IsSuccessStatusCode) | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| throw new Exception($"Unexpected http status code({response.StatusCode})"); | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| // if (!response.IsSuccessStatusCode) | ||||||||||||||||||||||||||||||||||||
| // { | ||||||||||||||||||||||||||||||||||||
| // throw new Exception($"Unexpected http status code({response.StatusCode})"); | ||||||||||||||||||||||||||||||||||||
| // } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| string result = await response.Content.ReadAsStringAsync(token); | ||||||||||||||||||||||||||||||||||||
| string? json = JsonNode.Parse(result)?["data"]?.GetValue<string>(); | ||||||||||||||||||||||||||||||||||||
| // string result = await response.Content.ReadAsStringAsync(token); | ||||||||||||||||||||||||||||||||||||
| // string? json = JsonNode.Parse(result)?["data"]?.GetValue<string>(); | ||||||||||||||||||||||||||||||||||||
| var json = await Console.In.ReadLineAsync(token); | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+46
|
||||||||||||||||||||||||||||||||||||
| if (json == null) continue; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| return (json.Split('|')[0], json.Split('|')[1]); | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
47
to
49
|
||||||||||||||||||||||||||||||||||||
| if (json == null) continue; | |
| return (json.Split('|')[0], json.Split('|')[1]); | |
| if (string.IsNullOrWhiteSpace(json)) | |
| { | |
| _logger.LogWarning("Received empty captcha response from console, waiting for valid input."); | |
| continue; | |
| } | |
| var parts = json.Split('|'); | |
| if (parts.Length < 2 || string.IsNullOrWhiteSpace(parts[0]) || string.IsNullOrWhiteSpace(parts[1])) | |
| { | |
| _logger.LogWarning("Invalid captcha response format: {Response}. Expected 'ticket|randstr'.", json); | |
| continue; | |
| } | |
| return (parts[0], parts[1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tlv100Androidwas changed from usingAppInfo.SdkInfo.MainSigMapto a magic number (16724722). This makes the login packet behavior opaque and ignores any future changes to the configured AppInfo/protocol; please either keep usingAppInfo.SdkInfo.MainSigMapor define a well-named constant (with rationale) derived fromSigflags so it stays maintainable.