This commit is contained in:
Bianca Fürstenau 2025-02-12 04:35:23 +01:00
parent ce3a2850ce
commit d7d6a32334
6 changed files with 72 additions and 35 deletions

38
src-tauri/Cargo.lock generated
View file

@ -2,6 +2,25 @@
# It is not intended for manual editing.
version = 4
[[package]]
name = "NEIN"
version = "0.1.0"
dependencies = [
"chrono",
"curl",
"openssl",
"rand 0.8.5",
"ring-compat",
"rusqlite",
"serde",
"serde_json",
"tauri",
"tauri-build",
"tauri-plugin-fs",
"tauri-plugin-opener",
"tokio",
]
[[package]]
name = "addr2line"
version = "0.24.2"
@ -304,25 +323,6 @@ dependencies = [
"serde",
]
[[package]]
name = "bkbh"
version = "0.1.0"
dependencies = [
"chrono",
"curl",
"openssl",
"rand 0.8.5",
"ring-compat",
"rusqlite",
"serde",
"serde_json",
"tauri",
"tauri-build",
"tauri-plugin-fs",
"tauri-plugin-opener",
"tokio",
]
[[package]]
name = "block"
version = "0.1.6"

View file

@ -1,7 +1,7 @@
[package]
name = "bkbh"
name = "NEIN"
version = "0.1.0"
description = "A Tauri App"
description = "Buchhaltung für „Darmstadt sagt Nein zur Bezahlkarte!“"
authors = ["Bianca Fürstenau"]
edition = "2021"

View file

@ -101,13 +101,15 @@ async fn push_key(id: &u64, key: &SigningKey) -> Result<(), ()> {
Ok(())
}
fn push_db(id: &u64, db: &Connection) -> Result<(), ()> {
let file = format!("{:016X}.sqlite", id);
db.backup(DatabaseName::Main, "tmp.sqlite", None)
fn push_db(id: &u64, db: &Connection, app: tauri::AppHandle) -> Result<(), ()> {
let filename = format!("{:016X}.sqlite", id);
let path = app.path().resolve(&filename, tauri::path::BaseDirectory::Temp)
.map_err(|e| println!("{:?}", e))?;
let buf = std::fs::read("tmp.sqlite")
db.backup(DatabaseName::Main, &path, None)
.map_err(|e| println!("{:?}", e))?;
let mut client = put_client(&file, buf.as_ref())?;
let buf = std::fs::read(&path)
.map_err(|e| println!("{:?}", e))?;
let mut client = put_client(&filename, buf.as_ref())?;
let perf = client.perform()
.map_err(|e| println!("{:?}", e))?;
Ok(())
@ -115,10 +117,11 @@ fn push_db(id: &u64, db: &Connection) -> Result<(), ()> {
#[tauri::command]
pub async fn push_data(
app: tauri::AppHandle,
state: State<'_, Mutex<AppState>>,
) -> Result<(), ()> {
let state = state.lock().await;
push_key(&state.id, &state.key).await?;
push_db(&state.id, &state.db);
push_db(&state.id, &state.db, app);
Ok(())
}

Binary file not shown.

View file

@ -9,7 +9,8 @@
</head>
<body>
<main class="container">
<main class="v-container">
<div class="h-container">
<form class="column" id="aldi-form">
<button type="submit">
<img
@ -64,19 +65,32 @@
/>
</button>
</form>
</main>
<p id="cnt-msg"></p>
<main class="container">
<form class="column" id="push-form">
</div>
<div class="h-container">
<form class="column" id="storno-form">
<button type="submit" id="storno-button">
Storno
</button>
</form>
<form class="column" id="tara-form">
<button type="submit">
Tara
</button>
</form>
</div>
<p id="cnt-msg"></p>
<div class="h-container">
<form class="column" id="push-form">
<button type="submit" class="shout">
</button>
</form>
<form class="column" id="pull-form">
<button type="submit">
<button type="submit" class="shout">
</button>
</form>
</div>
</main>
<p id="pull-msg"></p>
</body>

View file

@ -1,5 +1,10 @@
@font-face {
font-family: hessenSagtNein;
src: url(assets/hessen_sagt_nein.otf);
}
:root {
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
font-family: Noto Sans, sans-serif;
font-size: 16px;
line-height: 24px;
font-weight: 400;
@ -14,7 +19,7 @@
-webkit-text-size-adjust: 100%;
}
.container {
.h-container {
margin: auto;
display: flex;
flex-direction: row;
@ -24,6 +29,16 @@
gap: 3mm;
}
.v-container {
margin: auto;
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: space-around;
text-align: center;
gap: 3mm;
}
.logo {
margin: auto;
padding: 0em 0em;
@ -76,6 +91,11 @@ button {
cursor: pointer;
}
.shout {
font-size: 1.2cm;
font-family: hessenSagtNein;
}
button:hover {
border-color: #396cd8;
}