mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-26 21:41:48 +02:00
chore: edition 2024
This commit is contained in:
@@ -7,16 +7,16 @@ use std::{collections::HashMap, future::Future, path::PathBuf, pin::Pin, string:
|
||||
use encoding_rs::Encoding;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tauri::{
|
||||
ipc::{Channel, CommandScope, GlobalScope},
|
||||
Manager, Runtime, State, Window,
|
||||
ipc::{Channel, CommandScope, GlobalScope},
|
||||
};
|
||||
|
||||
#[allow(deprecated)]
|
||||
use crate::open::Program;
|
||||
use crate::{
|
||||
Shell,
|
||||
process::{CommandEvent, TerminatedPayload},
|
||||
scope::ExecuteArgs,
|
||||
Shell,
|
||||
};
|
||||
|
||||
type ChildId = u32;
|
||||
|
||||
@@ -19,8 +19,8 @@ use std::{
|
||||
use process::{Command, CommandChild};
|
||||
use regex::Regex;
|
||||
use tauri::{
|
||||
plugin::{Builder, TauriPlugin},
|
||||
AppHandle, Manager, RunEvent, Runtime,
|
||||
plugin::{Builder, TauriPlugin},
|
||||
};
|
||||
|
||||
mod commands;
|
||||
|
||||
@@ -20,10 +20,10 @@ use std::os::windows::process::CommandExt;
|
||||
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
|
||||
const NEWLINE_BYTE: u8 = b'\n';
|
||||
|
||||
use tauri::async_runtime::{block_on as block_on_task, channel, Receiver, Sender};
|
||||
use tauri::async_runtime::{Receiver, Sender, block_on as block_on_task, channel};
|
||||
|
||||
pub use encoding_rs::Encoding;
|
||||
use os_pipe::{pipe, PipeReader, PipeWriter};
|
||||
use os_pipe::{PipeReader, PipeWriter, pipe};
|
||||
use serde::Serialize;
|
||||
use shared_child::SharedChild;
|
||||
use tauri::utils::platform;
|
||||
|
||||
@@ -9,8 +9,8 @@ use crate::open::Program;
|
||||
use crate::process::Command;
|
||||
|
||||
use regex::Regex;
|
||||
use tauri::ipc::ScopeObject;
|
||||
use tauri::Manager;
|
||||
use tauri::ipc::ScopeObject;
|
||||
|
||||
/// Allowed representation of `Execute` command arguments.
|
||||
#[derive(Debug, Clone, serde::Deserialize)]
|
||||
@@ -162,8 +162,8 @@ pub enum Error {
|
||||
|
||||
/// The sidecar program validated but failed to find the sidecar path.
|
||||
#[error(
|
||||
"The scoped sidecar command was validated, but failed to create the path to the command: {0}"
|
||||
)]
|
||||
"The scoped sidecar command was validated, but failed to create the path to the command: {0}"
|
||||
)]
|
||||
Sidecar(String),
|
||||
|
||||
/// The named command was not found in the scoped config.
|
||||
@@ -172,12 +172,14 @@ pub enum Error {
|
||||
|
||||
/// A command variable has no value set in the arguments.
|
||||
#[error(
|
||||
"Scoped command argument at position {0} must match regex validation {1} but it was not found"
|
||||
)]
|
||||
"Scoped command argument at position {0} must match regex validation {1} but it was not found"
|
||||
)]
|
||||
MissingVar(usize, String),
|
||||
|
||||
/// At least one argument did not pass input validation.
|
||||
#[error("Scoped command argument at position {index} was found, but failed regex validation {validation}")]
|
||||
#[error(
|
||||
"Scoped command argument at position {index} was found, but failed regex validation {validation}"
|
||||
)]
|
||||
Validation {
|
||||
/// Index of the variable.
|
||||
index: usize,
|
||||
@@ -214,7 +216,9 @@ impl OpenScope {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
log::warn!("open() command called but the plugin configuration denies calls from JavaScript; set `tauri.conf.json > plugins > shell > open` to true or a validation regex string");
|
||||
log::warn!(
|
||||
"open() command called but the plugin configuration denies calls from JavaScript; set `tauri.conf.json > plugins > shell > open` to true or a validation regex string"
|
||||
);
|
||||
return Err(Error::Validation {
|
||||
index: 0,
|
||||
validation: "tauri^".to_string(), // purposefully impossible regex
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use serde::{de::Error as DeError, Deserialize, Deserializer};
|
||||
use serde::{Deserialize, Deserializer, de::Error as DeError};
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user