Compare commits

..

3 Commits

Author SHA1 Message Date
Joseph Montanaro
cb26201506 unproductive flailing 2022-12-28 15:48:25 -08:00
Joseph Montanaro
992e3c8db2 build improvements 2022-12-28 10:16:06 -08:00
Joseph Montanaro
4956b64371 only print incoming requests in debug mode 2022-12-28 08:54:08 -08:00
8 changed files with 43 additions and 7 deletions

View File

@ -0,0 +1,3 @@
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=--ld-path=/usr/bin/mold"]

1
src-tauri/.env Normal file
View File

@ -0,0 +1 @@
DATABASE_URL=sqlite://creddy.db?mode=rwc

25
src-tauri/Cargo.lock generated
View File

@ -78,6 +78,8 @@ dependencies = [
"serde_json",
"sodiumoxide",
"sqlx",
"strum 0.24.1",
"strum_macros 0.24.3",
"sysinfo",
"tauri",
"tauri-build",
@ -3571,9 +3573,15 @@ version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7ac893c7d471c8a21f31cfe213ec4f6d9afeed25537c772e08ef3f005f8729e"
dependencies = [
"strum_macros",
"strum_macros 0.22.0",
]
[[package]]
name = "strum"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f"
[[package]]
name = "strum_macros"
version = "0.22.0"
@ -3586,6 +3594,19 @@ dependencies = [
"syn",
]
[[package]]
name = "strum_macros"
version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59"
dependencies = [
"heck 0.4.0",
"proc-macro2",
"quote",
"rustversion",
"syn",
]
[[package]]
name = "subtle"
version = "2.4.1"
@ -4822,7 +4843,7 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "007a0353840b23e0c6dc73e5b962ff58ed7f6bc9ceff3ce7fe6fbad8d496edf4"
dependencies = [
"strum",
"strum 0.22.0",
"windows 0.24.0",
"xml-rs",
]

View File

@ -29,6 +29,8 @@ aws-smithy-types = "0.52.0"
aws-config = "0.52.0"
thiserror = "1.0.38"
once_cell = "1.16.0"
strum = "0.24"
strum_macros = "0.24"
[features]
# by default Tauri runs in production mode
@ -37,3 +39,6 @@ default = [ "custom-protocol" ]
# this feature is used used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ]
# [profile.dev.build-override]
# opt-level = 3

View File

@ -77,4 +77,4 @@ fn default_listen_addr() -> Ipv4Addr { Ipv4Addr::LOCALHOST }
fn default_rehide_ms() -> u64 { 1000 }
fn default_start_minimized() -> bool { true }
fn default_start_minimized() -> bool { !cfg!(debug_assertions) } // default to start-minimized in production only

View File

@ -10,13 +10,15 @@ use sqlx::{
};
use serde::{Serialize, Serializer, ser::SerializeMap};
use strum_macros::IntoStaticStr;
pub struct SerializeError<E> {
pub err: E
}
impl<E: std::error::Error> Serialize for SerializeError<E> {
impl<E: std::error::Error> Serialize for SerializeError<E>
{
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
let mut map = serializer.serialize_map(None)?;
map.serialize_entry("msg", &format!("{}", self.err))?;
@ -50,7 +52,7 @@ pub enum SetupError {
// error when attempting to tell a request handler whether to release or deny credentials
#[derive(Debug, ThisError)]
#[derive(Debug, ThisError, IntoStaticStr)]
pub enum SendResponseError {
#[error("The specified credentials request was not found")]
NotFound, // no request with the given id

View File

@ -88,7 +88,11 @@ impl Handler {
if n >= 4 && &buf[(n - 4)..n] == b"\r\n\r\n" {break;}
if n == buf.len() {return Err(RequestError::RequestTooLarge);}
}
if cfg!(debug_assertions) {
println!("{}", std::str::from_utf8(&buf).unwrap());
}
Ok(buf)
}

View File

@ -2,7 +2,7 @@
import { createEventDispatcher } from 'svelte';
import { invoke } from '@tauri-apps/api/tauri';
import Icon from '../ui/icon.svelte';
import Icon from '../ui/Icon.svelte';
export let appState;