some fixes (#498)

* nologin reject headtbeat

* fix: change anonymity

* use account as key
This commit is contained in:
My-Responsitories
2025-03-23 13:46:04 +08:00
committed by GitHub
parent 9d0ac30fad
commit 7c3e3cb1f8
7 changed files with 33 additions and 26 deletions

View File

@@ -92,7 +92,13 @@ class AccountManager extends Interceptor {
final Account account = options.extra['account'] ?? _findAccount(path);
if (account.isLogin) options.headers.addAll(account.headers);
if (account.isLogin) {
options.headers.addAll(account.headers);
} else if (path == Api.heartBeat) {
return handler.reject(
DioException.requestCancelled(requestOptions: options, reason: null),
false);
}
// app端不需要管理cookie
if (path.startsWith(HttpString.appBaseUrl)) {
@@ -190,8 +196,8 @@ class AccountManager extends Interceptor {
}
Future<void> _saveCookies(Response response) async {
final account = (response.requestOptions.extra['account'] as Account? ??
_findAccount(response.requestOptions.path));
final Account account = response.requestOptions.extra['account'] ??
_findAccount(response.requestOptions.path);
final setCookies = response.headers[HttpHeaders.setCookieHeader];
if (setCookies == null || setCookies.isEmpty) {
return;