fix(spoof): persist and apply all spoofing fields

This commit is contained in:
klockky
2026-06-06 19:36:24 +03:00
parent e954e0bc3b
commit 2daf384dad
3 changed files with 73 additions and 5 deletions
+18 -3
View File
@@ -179,6 +179,9 @@ class Api {
String locale = 'ru';
String deviceLocale = Platform.localeName.substring(0, 2);
String deviceId = await DeviceIdentity.deviceId();
String pushDeviceType = 'GCM';
String instanceId = await DeviceIdentity.instanceId();
int clientSessionId = DeviceIdentity.clientSessionId;
if (Platform.isLinux) {
final linuxInfo = await deviceInfo.linuxInfo;
@@ -223,6 +226,10 @@ class Api {
locale = sLocale;
deviceLocale = sLocale.split(RegExp(r'[-_]')).first;
}
final sDeviceLocale = spoofed['device_locale'] as String?;
if (sDeviceLocale != null && sDeviceLocale.isNotEmpty) {
deviceLocale = sDeviceLocale;
}
final sDeviceId = spoofed['device_id'] as String?;
if (sDeviceId != null && sDeviceId.isNotEmpty) deviceId = sDeviceId;
appVersion = (spoofed['app_version'] as String?) ?? appVersion;
@@ -233,6 +240,14 @@ class Api {
} else if (sBuild is String) {
buildNumber = int.tryParse(sBuild) ?? buildNumber;
}
final sPushType = spoofed['push_device_type'] as String?;
if (sPushType != null && sPushType.isNotEmpty) pushDeviceType = sPushType;
final sInstanceId = spoofed['instance_id'] as String?;
if (sInstanceId != null && sInstanceId.isNotEmpty) {
instanceId = sInstanceId;
}
final sClientSession = spoofed['client_session_id'];
if (sClientSession is int) clientSessionId = sClientSession;
}
_userAgent = {
@@ -241,7 +256,7 @@ class Api {
'osVersion': osVersion,
'timezone': timezone,
'screen': screen,
'pushDeviceType': 'GCM',
'pushDeviceType': pushDeviceType,
'arch': architecture,
'locale': locale,
'buildNumber': buildNumber,
@@ -252,9 +267,9 @@ class Api {
_deviceId = deviceId;
final payload = <dynamic, dynamic>{
'mt_instanceid': await DeviceIdentity.instanceId(),
'mt_instanceid': instanceId,
'userAgent': _userAgent,
'clientSessionId': DeviceIdentity.clientSessionId,
'clientSessionId': clientSessionId,
'deviceId': deviceId,
};
+6 -2
View File
@@ -16,11 +16,15 @@ class SpoofingService {
'screen': prefs.getString('spoof_screen'),
'timezone': prefs.getString('spoof_timezone'),
'locale': prefs.getString('spoof_locale'),
'device_locale': prefs.getString('spoof_devicelocale'),
'device_id': prefs.getString('spoof_deviceid'),
'device_type': prefs.getString('spoof_devicetype'),
'app_version': hardcodedAppVersion,
'app_version': prefs.getString('spoof_appversion') ?? hardcodedAppVersion,
'arch': prefs.getString('spoof_arch') ?? 'arm64-v8a',
'build_number': hardcodedBuildNumber,
'build_number': prefs.getInt('spoof_buildnumber') ?? hardcodedBuildNumber,
'instance_id': prefs.getString('spoof_instanceid'),
'client_session_id': prefs.getInt('spoof_clientsessionid'),
'push_device_type': prefs.getString('spoof_pushdevicetype'),
};
}
}
@@ -103,6 +103,21 @@ class _SpoofScreenState extends State<SpoofScreen> {
_buildNumberController.text =
prefs.getInt('spoof_buildnumber')?.toString() ??
'$_hardcodedBuildNumber';
_pushDeviceTypeController.text =
prefs.getString('spoof_pushdevicetype') ?? 'GCM';
final savedDeviceLocale = prefs.getString('spoof_devicelocale');
if (savedDeviceLocale != null && savedDeviceLocale.isNotEmpty) {
_deviceLocaleController.text = savedDeviceLocale;
}
final savedInstanceId = prefs.getString('spoof_instanceid');
if (savedInstanceId != null && savedInstanceId.isNotEmpty) {
_instanceIdController.text = savedInstanceId;
}
final savedClientSessionId = prefs.getInt('spoof_clientsessionid');
if (savedClientSessionId != null) {
_clientSessionIdController.text = '$savedClientSessionId';
}
String savedType = prefs.getString('spoof_devicetype') ?? 'ANDROID';
if (savedType == 'WEB') savedType = 'ANDROID';
@@ -235,6 +250,13 @@ class _SpoofScreenState extends State<SpoofScreen> {
'device_id': prefs.getString('spoof_deviceid') ?? '',
'device_type': prefs.getString('spoof_devicetype') ?? 'ANDROID',
'arch': prefs.getString('spoof_arch') ?? '',
'device_locale': prefs.getString('spoof_devicelocale') ?? '',
'app_version': prefs.getString('spoof_appversion') ?? '',
'build_number': prefs.getInt('spoof_buildnumber')?.toString() ?? '',
'push_device_type': prefs.getString('spoof_pushdevicetype') ?? '',
'instance_id': prefs.getString('spoof_instanceid') ?? '',
'client_session_id':
prefs.getInt('spoof_clientsessionid')?.toString() ?? '',
};
final newValues = {
@@ -246,6 +268,12 @@ class _SpoofScreenState extends State<SpoofScreen> {
'device_id': _deviceIdController.text,
'device_type': _selectedDeviceType,
'arch': _selectedArch,
'device_locale': _deviceLocaleController.text,
'app_version': _appVersionController.text,
'build_number': _buildNumberController.text,
'push_device_type': _pushDeviceTypeController.text,
'instance_id': _instanceIdController.text,
'client_session_id': _clientSessionIdController.text,
};
bool otherDataChanged = false;
@@ -358,6 +386,27 @@ class _SpoofScreenState extends State<SpoofScreen> {
await prefs.setString('spoof_deviceid', _deviceIdController.text);
await prefs.setString('spoof_devicetype', _selectedDeviceType);
await prefs.setString('spoof_arch', _selectedArch);
await prefs.setString('spoof_devicelocale', _deviceLocaleController.text);
await prefs.setString('spoof_appversion', _appVersionController.text);
await prefs.setString(
'spoof_pushdevicetype',
_pushDeviceTypeController.text,
);
await prefs.setString('spoof_instanceid', _instanceIdController.text);
final buildNumber = int.tryParse(_buildNumberController.text);
if (buildNumber != null) {
await prefs.setInt('spoof_buildnumber', buildNumber);
} else {
await prefs.remove('spoof_buildnumber');
}
final clientSessionId = int.tryParse(_clientSessionIdController.text);
if (clientSessionId != null) {
await prefs.setInt('spoof_clientsessionid', clientSessionId);
} else {
await prefs.remove('spoof_clientsessionid');
}
}
void _generateNewDeviceId() {