5 Commits

5 changed files with 12 additions and 13 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "creddy", "name": "creddy",
"version": "0.3.4", "version": "0.4.0",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",

2
src-tauri/Cargo.lock generated
View File

@ -1035,7 +1035,7 @@ dependencies = [
[[package]] [[package]]
name = "creddy" name = "creddy"
version = "0.3.4" version = "0.4.0"
dependencies = [ dependencies = [
"argon2", "argon2",
"auto-launch", "auto-launch",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "creddy" name = "creddy"
version = "0.3.4" version = "0.4.0"
description = "A friendly AWS credentials manager" description = "A friendly AWS credentials manager"
authors = ["Joseph Montanaro"] authors = ["Joseph Montanaro"]
license = "" license = ""

View File

@ -1,11 +1,10 @@
use tokio::{ use tokio::net::windows::named_pipe::{
net::windows::named_pipe::{ NamedPipeServer,
NamedPipeServer, ServerOptions,
ServerOptions,
},
sync::oneshot,
}; };
use tauri::{AppHandle, Manager};
use windows::Win32:: { use windows::Win32:: {
Foundation::HANDLE, Foundation::HANDLE,
System::Pipes::GetNamedPipeClientProcessId, System::Pipes::GetNamedPipeClientProcessId,
@ -52,11 +51,11 @@ impl Server {
// create a new pipe instance to listen for the next client, and swap it in // create a new pipe instance to listen for the next client, and swap it in
let new_listener = ServerOptions::new().create(r"\\.\pipe\creddy-requests")?; let new_listener = ServerOptions::new().create(r"\\.\pipe\creddy-requests")?;
let mut stream = std::mem::replace(&mut self.listener, new_listener); let stream = std::mem::replace(&mut self.listener, new_listener);
let new_handle = self.app_handle.app_handle(); let new_handle = self.app_handle.app_handle();
let client_pid = get_client_pid(&stream)?; let client_pid = get_client_pid(&stream)?;
rt::spawn(async move { rt::spawn(async move {
super::handle(stream, app_handle) super::handle(stream, new_handle, client_pid)
.await .await
.error_print_prefix("Error responding to request: "); .error_print_prefix("Error responding to request: ");
}); });
@ -71,5 +70,5 @@ fn get_client_pid(pipe: &NamedPipeServer) -> Result<u32, ClientInfoError> {
let mut pid = 0u32; let mut pid = 0u32;
let handle = HANDLE(raw_handle as _); let handle = HANDLE(raw_handle as _);
unsafe { GetNamedPipeClientProcessId(handle, &mut pid as *mut u32)? }; unsafe { GetNamedPipeClientProcessId(handle, &mut pid as *mut u32)? };
pid Ok(pid)
} }

View File

@ -8,7 +8,7 @@
}, },
"package": { "package": {
"productName": "creddy", "productName": "creddy",
"version": "0.3.4" "version": "0.4.0"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {