mod: account (#591)

* fix: onLoginMain

* fix: account override

* opt: sponsor block url
This commit is contained in:
My-Responsitories
2025-04-03 12:18:30 +08:00
committed by GitHub
parent 64fc995f6b
commit e190ca5868
4 changed files with 14 additions and 9 deletions

View File

@@ -66,7 +66,9 @@ class AccountManager extends Interceptor {
Api.oauth2AccessToken,
};
const AccountManager();
AccountManager();
String blockServer = GStorage.blockServer;
static String getCookies(List<Cookie> cookies) {
// Sort cookies by path (longer path first).
@@ -236,8 +238,8 @@ class AccountManager extends Interceptor {
await account.onChange();
}
static bool _skipCookie(String path) {
return path.startsWith(GStorage.blockServer) ||
bool _skipCookie(String path) {
return path.startsWith(blockServer) ||
path.contains('hdslb.com') ||
path.contains('biliimg.com');
}

View File

@@ -49,8 +49,8 @@ class LoginUtils {
SmartDialog.showToast('设置登录态失败,$e');
}
final result = await UserHttp.userInfo();
final UserInfoData data = result['data'];
if (result['status'] && data.isLogin!) {
if (result['status'] && result['data']?.isLogin == true) {
final UserInfoData data = result['data'];
SmartDialog.showToast('main登录成功');
await GStorage.userInfo.put('userInfoCache', data);
try {
@@ -109,7 +109,7 @@ class LoginUtils {
// 获取用户信息失败
await Accounts.deleteAll({account});
SmartDialog.showNotify(
msg: '登录失败请检查cookie是否正确${result['message']}',
msg: '登录失败请检查cookie是否正确${result['msg']}',
notifyType: NotifyType.warning);
}
}