Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-11 11:21:27 +08:00
parent e7f27e4913
commit 95f1d1485d
26 changed files with 168 additions and 233 deletions

View File

@@ -25,28 +25,28 @@ import 'package:get/get.dart';
class LoginUtils {
static final random = Random();
static Future setWebCookie([Account? account]) async {
final cookies = (account ?? Accounts.main).cookieJar.toList();
final webManager = web.CookieManager();
return Future.wait(
cookies.map(
(cookie) => webManager.setCookie(
url: web.WebUri(cookie.domain ?? ''),
name: cookie.name,
value: cookie.value,
path: cookie.path ?? '/',
domain: cookie.domain,
isSecure: cookie.secure,
isHttpOnly: cookie.httpOnly,
),
),
);
}
static Future<void> onLoginMain() async {
final account = Accounts.main;
GrpcReq.updateHeaders(account.accessKey);
try {
final cookies = account.cookieJar.toList();
final webManager = web.CookieManager();
Future.wait([
...cookies.map(
(item) => webManager.setCookie(
url: web.WebUri(item.domain ?? ''),
name: item.name,
value: item.value,
path: item.path ?? '',
domain: item.domain,
isSecure: item.secure,
isHttpOnly: item.httpOnly,
),
),
]);
} catch (e) {
SmartDialog.showToast('设置登录态失败,$e');
}
setWebCookie(account);
final result = await UserHttp.userInfo();
if (result.isSuccess) {
final UserInfoData data = result.data;

View File

@@ -67,15 +67,13 @@ class PageUtils {
final shareListRes = await ImGrpc.shareList(size: 3);
if (shareListRes.isSuccess && shareListRes.data.sessionList.isNotEmpty) {
userList.addAll(
shareListRes.data.sessionList
.map<UserModel>(
(item) => UserModel(
mid: item.talkerId.toInt(),
name: item.talkerUname,
avatar: item.talkerIcon,
),
)
.toList(),
shareListRes.data.sessionList.map<UserModel>(
(item) => UserModel(
mid: item.talkerId.toInt(),
name: item.talkerUname,
avatar: item.talkerIcon,
),
),
);
} else if (context.mounted) {
UserModel? userModel = await Navigator.of(context).push(

View File

@@ -70,10 +70,7 @@ class Utils {
String baseDirectory,
List<String> shaders,
) {
List<String> absolutePaths = shaders.map((shader) {
return path.join(baseDirectory, shader);
}).toList();
return absolutePaths.join(':');
return shaders.map((shader) => path.join(baseDirectory, shader)).join(':');
}
static final numericRegex = RegExp(r'^[\d\.]+$');