remove "proxy" and run cargo fmt

This commit is contained in:
Huge_Black
2025-03-31 09:33:37 +08:00
parent 0cd08d957d
commit efcaf4b970
4 changed files with 15 additions and 25 deletions

View File

@@ -14,8 +14,8 @@ pub mod process_control;
pub mod provider;
pub mod remote_server;
pub mod remotexpc;
pub mod usbmuxd;
pub mod sbservices;
pub mod usbmuxd;
pub mod util;
pub use errors::*;

View File

@@ -1,4 +1,4 @@
use std::ffi::{c_void, CStr};
use std::ffi::{CStr, c_void};
use idevice::{IdeviceError, IdeviceService, sbservices::SpringBoardServicesClient};
@@ -13,7 +13,7 @@ pub struct SpringBoardServicesClientHandle(pub SpringBoardServicesClient);
pub struct plist_t;
#[unsafe(no_mangle)]
pub unsafe extern "C" fn springboard_services_proxy_connect_tcp(
pub unsafe extern "C" fn springboard_services_connect_tcp(
provider: *mut TcpProviderHandle,
client: *mut *mut SpringBoardServicesClientHandle,
) -> IdeviceErrorCode {
@@ -53,7 +53,7 @@ pub unsafe extern "C" fn springboard_services_proxy_connect_tcp(
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn springboard_services_proxy_connect_usbmuxd(
pub unsafe extern "C" fn springboard_services_connect_usbmuxd(
provider: *mut UsbmuxdProviderHandle,
client: *mut *mut SpringBoardServicesClientHandle,
) -> IdeviceErrorCode {
@@ -88,7 +88,7 @@ pub unsafe extern "C" fn springboard_services_proxy_connect_usbmuxd(
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn springboard_services_proxy_new(
pub unsafe extern "C" fn springboard_services_new(
socket: *mut IdeviceHandle,
client: *mut *mut SpringBoardServicesClientHandle,
) -> IdeviceErrorCode {
@@ -116,7 +116,7 @@ pub unsafe extern "C" fn springboard_services_proxy_new(
/// `client` must be a valid pointer to a handle allocated by this library
/// `out_result` must be a valid, non-null pointer to a location where the result will be stored
#[unsafe(no_mangle)]
pub unsafe extern "C" fn springboard_services_proxy_get_icon(
pub unsafe extern "C" fn springboard_services_get_icon(
client: *mut SpringBoardServicesClientHandle,
bundle_identifier: *const libc::c_char,
out_result: *mut *mut c_void,
@@ -128,16 +128,14 @@ pub unsafe extern "C" fn springboard_services_proxy_get_icon(
}
let client = unsafe { &mut *client };
let name_cstr = unsafe { CStr::from_ptr(bundle_identifier) };
let bundle_id = match name_cstr.to_str() {
Ok(s) => s.to_string(),
Err(_) => return IdeviceErrorCode::InvalidArg,
};
let res: Result<Vec<u8>, IdeviceError> = RUNTIME.block_on(async {
client.0.get_icon_pngdata(bundle_id).await
});
let res: Result<Vec<u8>, IdeviceError> =
RUNTIME.block_on(async { client.0.get_icon_pngdata(bundle_id).await });
match res {
Ok(r) => {
@@ -156,16 +154,10 @@ pub unsafe extern "C" fn springboard_services_proxy_get_icon(
}
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn springboard_services_proxy_free(
handle: *mut SpringBoardServicesClientHandle,
) {
pub unsafe extern "C" fn springboard_services_free(handle: *mut SpringBoardServicesClientHandle) {
if !handle.is_null() {
log::debug!("Freeing springboard_services_proxy_client");
log::debug!("Freeing springboard_services_client");
let _ = unsafe { Box::from_raw(handle) };
}
}

View File

@@ -19,6 +19,8 @@ pub mod misagent;
pub mod mounter;
pub mod pairing_file;
pub mod provider;
#[cfg(feature = "sbservices")]
pub mod sbservices;
#[cfg(feature = "tunnel_tcp_stack")]
pub mod tcp;
#[cfg(feature = "tss")]
@@ -30,8 +32,6 @@ pub mod usbmuxd;
mod util;
#[cfg(feature = "xpc")]
pub mod xpc;
#[cfg(feature = "sbservices")]
pub mod sbservices;
use log::{debug, error, trace};
use openssl::ssl::{SslConnector, SslMethod, SslVerifyMode};

View File

@@ -1,7 +1,7 @@
use crate::{lockdownd::LockdowndClient, Idevice, IdeviceError, IdeviceService};
pub struct SpringBoardServicesClient {
pub idevice: Idevice
pub idevice: Idevice,
}
impl IdeviceService for SpringBoardServicesClient {
@@ -40,7 +40,7 @@ impl SpringBoardServicesClient {
/// `bundle_identifier` - The identifier of the app to get icon
pub async fn get_icon_pngdata(
&mut self,
bundle_identifier: String
bundle_identifier: String,
) -> Result<Vec<u8>, IdeviceError> {
let mut req = plist::Dictionary::new();
req.insert("command".into(), "getIconPNGData".into());
@@ -51,9 +51,7 @@ impl SpringBoardServicesClient {
let mut res = self.idevice.read_plist().await?;
match res.remove("pngData") {
Some(plist::Value::Data(res)) => {
Ok(res)
}
Some(plist::Value::Data(res)) => Ok(res),
_ => Err(IdeviceError::UnexpectedResponse),
}
}