Send platform-dependent client token request

This commit is contained in:
Roderick van Domburg 2022-01-26 22:24:40 +01:00
parent 31c682453b
commit cb1cfddb74
No known key found for this signature in database
GPG key ID: A9EF5222A26F0451
4 changed files with 63 additions and 14 deletions

View file

@ -111,11 +111,11 @@ where
_ => Platform::PLATFORM_FREEBSD_X86,
},
"ios" => match ARCH {
"arm64" => Platform::PLATFORM_IPHONE_ARM64,
"aarch64" => Platform::PLATFORM_IPHONE_ARM64,
_ => Platform::PLATFORM_IPHONE_ARM,
},
"linux" => match ARCH {
"arm" | "arm64" => Platform::PLATFORM_LINUX_ARM,
"arm" | "aarch64" => Platform::PLATFORM_LINUX_ARM,
"blackfin" => Platform::PLATFORM_LINUX_BLACKFIN,
"mips" => Platform::PLATFORM_LINUX_MIPS,
"sh" => Platform::PLATFORM_LINUX_SH,
@ -128,7 +128,7 @@ where
_ => Platform::PLATFORM_OSX_X86,
},
"windows" => match ARCH {
"arm" => Platform::PLATFORM_WINDOWS_CE_ARM,
"arm" | "aarch64" => Platform::PLATFORM_WINDOWS_CE_ARM,
"x86_64" => Platform::PLATFORM_WIN32_X86_64,
_ => Platform::PLATFORM_WIN32_X86,
},

View file

@ -86,7 +86,7 @@ impl HttpClient {
let spotify_platform = match OS {
"android" => "Android/31",
"ios" => "iOS/15.2",
"ios" => "iOS/15.2.1",
"macos" => "OSX/0",
"windows" => "Win32/0",
_ => "Linux/0",

View file

@ -122,14 +122,55 @@ impl SpClient {
connectivity_data.set_device_id(self.session().device_id().to_string());
let platform_data = connectivity_data.mut_platform_specific_data();
let windows_data = platform_data.mut_windows();
windows_data.set_os_version(10);
windows_data.set_os_build(21370);
windows_data.set_platform_id(2);
windows_data.set_unknown_value_6(9);
windows_data.set_image_file_machine(332);
windows_data.set_pe_machine(34404);
windows_data.set_unknown_value_10(true);
match std::env::consts::OS {
"windows" => {
let (pe, image_file) = match std::env::consts::ARCH {
"arm" => (448, 452),
"aarch64" => (43620, 452),
"x86_64" => (34404, 34404),
_ => (332, 332), // x86
};
let windows_data = platform_data.mut_desktop_windows();
windows_data.set_os_version(10);
windows_data.set_os_build(21370);
windows_data.set_platform_id(2);
windows_data.set_unknown_value_6(9);
windows_data.set_image_file_machine(image_file);
windows_data.set_pe_machine(pe);
windows_data.set_unknown_value_10(true);
}
"ios" => {
let ios_data = platform_data.mut_ios();
ios_data.set_user_interface_idiom(0);
ios_data.set_target_iphone_simulator(false);
ios_data.set_hw_machine("iPhone14,5".to_string());
ios_data.set_system_version("15.2.1".to_string());
}
"android" => {
let android_data = platform_data.mut_android();
android_data.set_android_version("12.0.0_r26".to_string());
android_data.set_api_version(31);
android_data.set_device_name("Pixel".to_owned());
android_data.set_model_str("GF5KQ".to_owned());
android_data.set_vendor("Google".to_owned());
}
"macos" => {
let macos_data = platform_data.mut_desktop_macos();
macos_data.set_system_version("Darwin Kernel Version 17.7.0: Fri Oct 30 13:34:27 PDT 2020; root:xnu-4570.71.82.8~1/RELEASE_X86_64".to_string());
macos_data.set_hw_model("iMac21,1".to_string());
macos_data.set_compiled_cpu_type(std::env::consts::ARCH.to_string());
}
_ => {
let linux_data = platform_data.mut_desktop_linux();
linux_data.set_system_name("Linux".to_string());
linux_data.set_system_release("5.4.0-56-generic".to_string());
linux_data
.set_system_version("#62-Ubuntu SMP Mon Nov 23 19:20:19 UTC 2020".to_string());
linux_data.set_hardware(std::env::consts::ARCH.to_string());
}
}
let body = message.write_to_bytes()?;

View file

@ -15,7 +15,8 @@ message PlatformSpecificData {
oneof data {
NativeAndroidData android = 1;
NativeIOSData ios = 2;
NativeWindowsData windows = 4;
NativeDesktopMacOSData desktop_macos = 3;
NativeDesktopWindowsData desktop_windows = 4;
NativeDesktopLinuxData desktop_linux = 5;
}
}
@ -32,6 +33,7 @@ message NativeAndroidData {
}
message NativeIOSData {
// https://developer.apple.com/documentation/uikit/uiuserinterfaceidiom
int32 user_interface_idiom = 1;
bool target_iphone_simulator = 2;
string hw_machine = 3;
@ -39,7 +41,7 @@ message NativeIOSData {
string simulator_model_identifier = 5;
}
message NativeWindowsData {
message NativeDesktopWindowsData {
int32 os_version = 1;
int32 os_build = 3;
// https://docs.microsoft.com/en-us/dotnet/api/system.platformid?view=net-6.0
@ -60,6 +62,12 @@ message NativeDesktopLinuxData {
string hardware = 4; // -i
}
message NativeDesktopMacOSData {
string system_version = 1;
string hw_model = 2;
string compiled_cpu_type = 3;
}
message Screen {
int32 width = 1;
int32 height = 2;