mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-24 09:48:28 +02:00
Convert UNC paths in more places
This commit is contained in:
@@ -382,17 +382,17 @@ export const PluginRuntimeDefinition = {
|
|||||||
responseStream: false,
|
responseStream: false,
|
||||||
options: {},
|
options: {},
|
||||||
},
|
},
|
||||||
hookResponseFilter: {
|
hookExport: {
|
||||||
name: "hookResponseFilter",
|
name: "hookExport",
|
||||||
requestType: HookResponseFilterRequest,
|
requestType: HookExportRequest,
|
||||||
requestStream: false,
|
requestStream: false,
|
||||||
responseType: HookResponse,
|
responseType: HookResponse,
|
||||||
responseStream: false,
|
responseStream: false,
|
||||||
options: {},
|
options: {},
|
||||||
},
|
},
|
||||||
hookExport: {
|
hookResponseFilter: {
|
||||||
name: "hookExport",
|
name: "hookResponseFilter",
|
||||||
requestType: HookExportRequest,
|
requestType: HookResponseFilterRequest,
|
||||||
requestStream: false,
|
requestStream: false,
|
||||||
responseType: HookResponse,
|
responseType: HookResponse,
|
||||||
responseStream: false,
|
responseStream: false,
|
||||||
@@ -403,20 +403,20 @@ export const PluginRuntimeDefinition = {
|
|||||||
|
|
||||||
export interface PluginRuntimeServiceImplementation<CallContextExt = {}> {
|
export interface PluginRuntimeServiceImplementation<CallContextExt = {}> {
|
||||||
hookImport(request: HookImportRequest, context: CallContext & CallContextExt): Promise<DeepPartial<HookResponse>>;
|
hookImport(request: HookImportRequest, context: CallContext & CallContextExt): Promise<DeepPartial<HookResponse>>;
|
||||||
|
hookExport(request: HookExportRequest, context: CallContext & CallContextExt): Promise<DeepPartial<HookResponse>>;
|
||||||
hookResponseFilter(
|
hookResponseFilter(
|
||||||
request: HookResponseFilterRequest,
|
request: HookResponseFilterRequest,
|
||||||
context: CallContext & CallContextExt,
|
context: CallContext & CallContextExt,
|
||||||
): Promise<DeepPartial<HookResponse>>;
|
): Promise<DeepPartial<HookResponse>>;
|
||||||
hookExport(request: HookExportRequest, context: CallContext & CallContextExt): Promise<DeepPartial<HookResponse>>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PluginRuntimeClient<CallOptionsExt = {}> {
|
export interface PluginRuntimeClient<CallOptionsExt = {}> {
|
||||||
hookImport(request: DeepPartial<HookImportRequest>, options?: CallOptions & CallOptionsExt): Promise<HookResponse>;
|
hookImport(request: DeepPartial<HookImportRequest>, options?: CallOptions & CallOptionsExt): Promise<HookResponse>;
|
||||||
|
hookExport(request: DeepPartial<HookExportRequest>, options?: CallOptions & CallOptionsExt): Promise<HookResponse>;
|
||||||
hookResponseFilter(
|
hookResponseFilter(
|
||||||
request: DeepPartial<HookResponseFilterRequest>,
|
request: DeepPartial<HookResponseFilterRequest>,
|
||||||
options?: CallOptions & CallOptionsExt,
|
options?: CallOptions & CallOptionsExt,
|
||||||
): Promise<HookResponse>;
|
): Promise<HookResponse>;
|
||||||
hookExport(request: DeepPartial<HookExportRequest>, options?: CallOptions & CallOptionsExt): Promise<HookResponse>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||||
|
|||||||
2
src-tauri/Cargo.lock
generated
2
src-tauri/Cargo.lock
generated
@@ -2033,6 +2033,7 @@ name = "grpc"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
"dunce",
|
||||||
"hyper 0.14.29",
|
"hyper 0.14.29",
|
||||||
"hyper-rustls 0.24.2",
|
"hyper-rustls 0.24.2",
|
||||||
"log",
|
"log",
|
||||||
@@ -3874,6 +3875,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"command-group",
|
"command-group",
|
||||||
|
"dunce",
|
||||||
"log",
|
"log",
|
||||||
"prost 0.13.1",
|
"prost 0.13.1",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
|
|||||||
@@ -21,3 +21,4 @@ uuid = { version = "1.7.0", features = ["v4"] }
|
|||||||
tauri = { version = "2.0.0-beta" }
|
tauri = { version = "2.0.0-beta" }
|
||||||
tauri-plugin-shell = "2.0.0-beta"
|
tauri-plugin-shell = "2.0.0-beta"
|
||||||
md5 = "0.7.0"
|
md5 = "0.7.0"
|
||||||
|
dunce = "1.0.4"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::env::temp_dir;
|
use std::env::temp_dir;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::path::PathBuf;
|
use std::path::{Path, PathBuf};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
@@ -35,12 +35,15 @@ pub async fn fill_pool_from_files(
|
|||||||
let global_import_dir = app_handle
|
let global_import_dir = app_handle
|
||||||
.path()
|
.path()
|
||||||
.resolve("protoc-include", BaseDirectory::Resource)
|
.resolve("protoc-include", BaseDirectory::Resource)
|
||||||
.expect("failed to resolve protoc include directory")
|
.expect("failed to resolve protoc include directory");
|
||||||
.to_string_lossy()
|
|
||||||
.to_string();
|
|
||||||
|
|
||||||
// HACK: Remove UNC prefix for Windows paths
|
// HACK: Remove UNC prefix for Windows paths
|
||||||
let global_import_dir = global_import_dir.replace("\\\\?\\", "");
|
let global_import_dir = dunce::simplified(&Path::from(global_import_dir))
|
||||||
|
.to_string_lossy()
|
||||||
|
.to_string();
|
||||||
|
let desc_path = dunce::simplified(&Path::from(desc_path))
|
||||||
|
.to_string_lossy()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
let mut args = vec![
|
let mut args = vec![
|
||||||
"--include_imports".to_string(),
|
"--include_imports".to_string(),
|
||||||
@@ -48,7 +51,7 @@ pub async fn fill_pool_from_files(
|
|||||||
"-I".to_string(),
|
"-I".to_string(),
|
||||||
global_import_dir,
|
global_import_dir,
|
||||||
"-o".to_string(),
|
"-o".to_string(),
|
||||||
desc_path.to_string_lossy().to_string(),
|
desc_path,
|
||||||
];
|
];
|
||||||
|
|
||||||
for p in paths {
|
for p in paths {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.86"
|
anyhow = "1.0.86"
|
||||||
command-group = "5.0.1"
|
command-group = "5.0.1"
|
||||||
|
dunce = "1.0.4"
|
||||||
log = "0.4.21"
|
log = "0.4.21"
|
||||||
prost = "0.13.1"
|
prost = "0.13.1"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::path::PathBuf;
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
@@ -7,8 +7,8 @@ use log::{debug, info};
|
|||||||
use rand::distributions::{Alphanumeric, DistString};
|
use rand::distributions::{Alphanumeric, DistString};
|
||||||
use serde;
|
use serde;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use tauri::{AppHandle, Manager, Runtime};
|
|
||||||
use tauri::path::BaseDirectory;
|
use tauri::path::BaseDirectory;
|
||||||
|
use tauri::{AppHandle, Manager, Runtime};
|
||||||
use tauri_plugin_shell::ShellExt;
|
use tauri_plugin_shell::ShellExt;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
|
|
||||||
@@ -29,23 +29,28 @@ pub async fn node_start<R: Runtime>(app: &AppHandle<R>, temp_dir: &PathBuf) -> S
|
|||||||
let plugins_dir = app
|
let plugins_dir = app
|
||||||
.path()
|
.path()
|
||||||
.resolve("plugins", BaseDirectory::Resource)
|
.resolve("plugins", BaseDirectory::Resource)
|
||||||
.expect("failed to resolve plugin directory resource")
|
.expect("failed to resolve plugin directory resource");
|
||||||
.to_string_lossy()
|
|
||||||
.to_string();
|
|
||||||
|
|
||||||
let plugin_runtime_dir = app
|
let plugin_runtime_main = app
|
||||||
.path()
|
.path()
|
||||||
.resolve("plugin-runtime", BaseDirectory::Resource)
|
.resolve("plugin-runtime", BaseDirectory::Resource)
|
||||||
.expect("failed to resolve plugin runtime resource");
|
.expect("failed to resolve plugin runtime resource")
|
||||||
|
.join("index.cjs");
|
||||||
|
|
||||||
// HACK: Remove UNC prefix for Windows paths
|
// HACK: Remove UNC prefix for Windows paths to pass to sidecar
|
||||||
let plugins_dir = plugins_dir.replace("\\\\?\\", "");
|
|
||||||
|
let plugins_dir = dunce::simplified(&Path::from(plugins_dir))
|
||||||
|
.to_string_lossy()
|
||||||
|
.to_string();
|
||||||
|
let plugin_runtime_main = dunce::simplified(&Path::from(plugin_runtime_main))
|
||||||
|
.to_string_lossy()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
"Starting plugin runtime\n port_file={}\n plugins_dir={}\n runtime_dir={}",
|
"Starting plugin runtime\n port_file={}\n plugins_dir={}\n runtime_dir={}",
|
||||||
port_file_path.to_string_lossy(),
|
port_file_path.to_string_lossy(),
|
||||||
plugins_dir,
|
plugins_dir,
|
||||||
plugin_runtime_dir.to_string_lossy(),
|
plugin_runtime_main,
|
||||||
);
|
);
|
||||||
|
|
||||||
let cmd = app
|
let cmd = app
|
||||||
@@ -54,7 +59,7 @@ pub async fn node_start<R: Runtime>(app: &AppHandle<R>, temp_dir: &PathBuf) -> S
|
|||||||
.expect("yaaknode not found")
|
.expect("yaaknode not found")
|
||||||
.env("YAAK_GRPC_PORT_FILE_PATH", port_file_path.clone())
|
.env("YAAK_GRPC_PORT_FILE_PATH", port_file_path.clone())
|
||||||
.env("YAAK_PLUGINS_DIR", plugins_dir)
|
.env("YAAK_PLUGINS_DIR", plugins_dir)
|
||||||
.args(&[plugin_runtime_dir.join("index.cjs")]);
|
.args(&[plugin_runtime_main]);
|
||||||
|
|
||||||
let child = Command::from(cmd)
|
let child = Command::from(cmd)
|
||||||
.group_spawn()
|
.group_spawn()
|
||||||
|
|||||||
Reference in New Issue
Block a user