Skip to content

refactor(core): allow custom protocol handler to resolve async #4730

refactor(core): allow custom protocol handler to resolve async

refactor(core): allow custom protocol handler to resolve async #4730

Triggered via push September 5, 2023 19:51
Status Success
Total duration 28s
Artifacts

audit.yml

on: push
Fit to window
Zoom out
Zoom in

Annotations

1 error and 2 warnings
this let-binding has unit value: core/tauri/src/ipc/protocol.rs#L196
error: this let-binding has unit value --> core/tauri/src/ipc/protocol.rs:196:9 | 196 | / let _ = window.on_message( 197 | | InvokeRequest { 198 | | cmd: message.cmd, 199 | | callback: message.callback, ... | 254 | | }), 255 | | ); | |__________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value = note: `-D clippy::let-unit-value` implied by `-D warnings` help: omit the `let` binding | 196 ~ window.on_message( 197 + InvokeRequest { 198 + cmd: message.cmd, 199 + callback: message.callback, 200 + error: message.error, 201 + body: message.payload.into(), 202 + headers: message.options.map(|o| o.headers.0).unwrap_or_default(), 203 + }, 204 + Box::new(move |window, cmd, response, callback, error| { 205 + use crate::ipc::{ 206 + format_callback::{ 207 + format as format_callback, format_result as format_callback_result, 208 + }, 209 + Channel, 210 + }; 211 + use serde_json::Value as JsonValue; 212 + 213 + // the channel data command is the only command that uses a custom protocol on Linux 214 + if window.manager.invoke_responder().is_none() 215 + && cmd != crate::ipc::channel::FETCH_CHANNEL_DATA_COMMAND 216 + { 217 + fn responder_eval<R: Runtime>( 218 + window: &crate::Window<R>, 219 + js: crate::api::Result<String>, 220 + error: CallbackFn, 221 + ) { 222 + let eval_js = match js { 223 + Ok(js) => js, 224 + Err(e) => format_callback(error, &e.to_string()) 225 + .expect("unable to serialize response error string to json"), 226 + }; 227 + 228 + let _ = window.eval(&eval_js); 229 + } 230 + 231 + match &response { 232 + InvokeResponse::Ok(InvokeBody::Json(v)) => { 233 + if matches!(v, JsonValue::Object(_) | JsonValue::Array(_)) { 234 + let _ = Channel::from_ipc(window.clone(), callback).send(v); 235 + } else { 236 + responder_eval( 237 + &window, 238 + format_callback_result(Result::<_, ()>::Ok(v), callback, error), 239 + error, 240 + ) 241 + } 242 + } 243 + InvokeResponse::Ok(InvokeBody::Raw(v)) => { 244 + let _ = 245 + Channel::from_ipc(window.clone(), callback).send(InvokeBody::Raw(v.clone())); 246 + } 247 + InvokeResponse::Err(e) => responder_eval( 248 + &window, 249 + format_callback_result(Result::<(), _>::Err(&e.0), callback, error), 250 + error, 251 + ), 252 + } 253 + } 254 + }), 255 + ); |
audit-js
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
audit-rust
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions-rs/audit-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/