Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
299c93f8d6 | ||
|
|
36cefaab5f | ||
|
|
697f13e13a | ||
|
|
35e560020c | ||
|
|
3a16c76257 | ||
|
|
d0ece263a2 | ||
|
|
a0f89454f9 | ||
|
|
083edf32a2 |
Generated
+1
-1
@@ -445,7 +445,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "call-recorder"
|
||||
version = "0.2.1"
|
||||
version = "0.2.3"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"chrono",
|
||||
|
||||
@@ -28,7 +28,13 @@ pub struct CallListItem {
|
||||
}
|
||||
|
||||
impl CallListItem {
|
||||
pub fn of(call: &Call) -> Self {
|
||||
/// `backend_url` is this build's backend (`crate::backend::BACKEND_URL`
|
||||
/// in the app): an upload recorded for a different one is shown as not
|
||||
/// uploaded at all ([`uploaded_here`]) — e.g. a transcript sent to the
|
||||
/// test backend must not look done to a release build reading the same
|
||||
/// row. Nothing is deleted; the fields are just not shown as set.
|
||||
pub fn of(call: &Call, backend_url: &str) -> Self {
|
||||
let uploaded = uploaded_here(call, backend_url);
|
||||
Self {
|
||||
id: call.id,
|
||||
app: call.app.clone(),
|
||||
@@ -37,8 +43,12 @@ impl CallListItem {
|
||||
status: call.status,
|
||||
interrupted: call.interrupted,
|
||||
title: call.title.clone(),
|
||||
crm_transcript_id: call.crm_transcript_id.clone(),
|
||||
uploaded_at: call.uploaded_at,
|
||||
crm_transcript_id: if uploaded {
|
||||
call.crm_transcript_id.clone()
|
||||
} else {
|
||||
None
|
||||
},
|
||||
uploaded_at: if uploaded { call.uploaded_at } else { None },
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,6 +60,16 @@ pub fn duration_secs(call: &Call) -> i64 {
|
||||
.map_or(0, |end| (end - call.started_at).num_seconds().max(0))
|
||||
}
|
||||
|
||||
/// Whether `call`'s upload belongs to `backend_url`: its
|
||||
/// `crm_transcript_id` is set *and* `crm_base_url` is exactly this
|
||||
/// backend. An upload recorded for a different one (e.g. the test backend,
|
||||
/// read by a release build) counts as not uploaded: the CRM this
|
||||
/// `backend_url` talks to has never seen the transcript, so the UI offers
|
||||
/// the normal upload control again instead of claiming it is done.
|
||||
pub fn uploaded_here(call: &Call, backend_url: &str) -> bool {
|
||||
call.crm_transcript_id.is_some() && call.crm_base_url.as_deref() == Some(backend_url)
|
||||
}
|
||||
|
||||
/// The selected call's header data: its list row plus the error of a
|
||||
/// failed run and when it was transcribed (only a transcribed call can be
|
||||
/// uploaded).
|
||||
@@ -104,12 +124,14 @@ pub struct CallDetail {
|
||||
|
||||
impl CallDetail {
|
||||
/// `segments` are the stored ones; `merges` the stored speaker merges
|
||||
/// (source key → target key).
|
||||
/// (source key → target key); `backend_url` is this build's backend
|
||||
/// (see [`CallListItem::of`]).
|
||||
pub fn of(
|
||||
call: &Call,
|
||||
segments: &[Segment],
|
||||
speaker_names: BTreeMap<String, String>,
|
||||
merges: &BTreeMap<String, String>,
|
||||
backend_url: &str,
|
||||
) -> Self {
|
||||
let segments = merge::apply_merges(segments, merges)
|
||||
.iter()
|
||||
@@ -123,7 +145,7 @@ impl CallDetail {
|
||||
.collect();
|
||||
Self {
|
||||
call: CallHeader {
|
||||
item: CallListItem::of(call),
|
||||
item: CallListItem::of(call, backend_url),
|
||||
error: call.error.clone(),
|
||||
transcribed_at: call.transcribed_at,
|
||||
},
|
||||
@@ -234,6 +256,11 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::model::Speaker;
|
||||
|
||||
/// This build's backend, for `CallListItem::of`/`CallDetail::of`.
|
||||
const BACKEND: &str = "https://backend.example";
|
||||
/// A different backend, for the "uploaded elsewhere" cases.
|
||||
const OTHER_BACKEND: &str = "https://other.example";
|
||||
|
||||
fn at(h: u32, m: u32, s: u32) -> DateTime<Local> {
|
||||
Local.with_ymd_and_hms(2026, 11, 5, h, m, s).unwrap()
|
||||
}
|
||||
@@ -253,6 +280,7 @@ mod tests {
|
||||
audio_deleted: false,
|
||||
title: None,
|
||||
crm_transcript_id: None,
|
||||
crm_base_url: None,
|
||||
uploaded_at: None,
|
||||
}
|
||||
}
|
||||
@@ -283,7 +311,7 @@ mod tests {
|
||||
c.status = CallStatus::AwaitingDecision;
|
||||
c.interrupted = true;
|
||||
assert_eq!(
|
||||
CallListItem::of(&c),
|
||||
CallListItem::of(&c, BACKEND),
|
||||
CallListItem {
|
||||
id: 7,
|
||||
app: "Microsoft Teams".into(),
|
||||
@@ -299,13 +327,51 @@ mod tests {
|
||||
|
||||
c.title = Some("Angebot Rioja".into());
|
||||
c.crm_transcript_id = Some("4711".into());
|
||||
c.crm_base_url = Some(BACKEND.into());
|
||||
c.uploaded_at = Some(at(11, 0, 0));
|
||||
let item = CallListItem::of(&c);
|
||||
let item = CallListItem::of(&c, BACKEND);
|
||||
assert_eq!(item.title.as_deref(), Some("Angebot Rioja"));
|
||||
assert_eq!(item.crm_transcript_id.as_deref(), Some("4711"));
|
||||
assert_eq!(item.uploaded_at, Some(at(11, 0, 0)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn uploaded_here_needs_a_transcript_id_and_a_matching_backend() {
|
||||
let mut c = call(Some(at(10, 15, 0)));
|
||||
assert!(!uploaded_here(&c, BACKEND), "never uploaded");
|
||||
|
||||
c.crm_transcript_id = Some("4711".into());
|
||||
c.crm_base_url = Some(OTHER_BACKEND.into());
|
||||
assert!(
|
||||
!uploaded_here(&c, BACKEND),
|
||||
"uploaded, but to a different backend"
|
||||
);
|
||||
|
||||
c.crm_base_url = Some(BACKEND.into());
|
||||
assert!(uploaded_here(&c, BACKEND));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_upload_to_another_backend_is_hidden_from_the_list_item() {
|
||||
// Uploaded to OTHER_BACKEND; this build's backend is BACKEND: the
|
||||
// row still has crm_transcript_id/uploaded_at, but the view must
|
||||
// not show them, so the UI offers the normal upload control again.
|
||||
let mut c = call(Some(at(10, 15, 0)));
|
||||
c.crm_transcript_id = Some("4711".into());
|
||||
c.crm_base_url = Some(OTHER_BACKEND.into());
|
||||
c.uploaded_at = Some(at(11, 0, 0));
|
||||
|
||||
let item = CallListItem::of(&c, BACKEND);
|
||||
assert_eq!(item.crm_transcript_id, None);
|
||||
assert_eq!(item.uploaded_at, None);
|
||||
|
||||
// The same row, read by a build whose backend actually matches:
|
||||
// shown normally.
|
||||
let item = CallListItem::of(&c, OTHER_BACKEND);
|
||||
assert_eq!(item.crm_transcript_id.as_deref(), Some("4711"));
|
||||
assert_eq!(item.uploaded_at, Some(at(11, 0, 0)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn detail_labels_segments_with_renames_and_defaults() {
|
||||
let segments = [
|
||||
@@ -322,6 +388,7 @@ mod tests {
|
||||
&segments,
|
||||
names.clone(),
|
||||
&BTreeMap::new(),
|
||||
BACKEND,
|
||||
);
|
||||
|
||||
let lines: Vec<_> = detail
|
||||
@@ -366,7 +433,13 @@ mod tests {
|
||||
("remote:10", "remote:4"),
|
||||
]);
|
||||
|
||||
let detail = CallDetail::of(&call(Some(at(10, 15, 0))), &segments, names, &merges);
|
||||
let detail = CallDetail::of(
|
||||
&call(Some(at(10, 15, 0))),
|
||||
&segments,
|
||||
names,
|
||||
&merges,
|
||||
BACKEND,
|
||||
);
|
||||
|
||||
let lines: Vec<_> = detail
|
||||
.segments
|
||||
@@ -418,7 +491,8 @@ mod tests {
|
||||
let merges = keys(&[("remote:2", "remote:1")]);
|
||||
|
||||
let value =
|
||||
serde_json::to_value(CallDetail::of(&c, &[], BTreeMap::new(), &merges)).unwrap();
|
||||
serde_json::to_value(CallDetail::of(&c, &[], BTreeMap::new(), &merges, BACKEND))
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
value,
|
||||
@@ -450,7 +524,13 @@ mod tests {
|
||||
}
|
||||
|
||||
fn detail_with(c: &Call, segments: &[Segment], names: &[(&str, &str)]) -> CallDetail {
|
||||
CallDetail::of(c, segments, keys(names), &keys(&[("remote:2", "remote:1")]))
|
||||
CallDetail::of(
|
||||
c,
|
||||
segments,
|
||||
keys(names),
|
||||
&keys(&[("remote:2", "remote:1")]),
|
||||
BACKEND,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -41,6 +41,11 @@ pub struct Call {
|
||||
pub title: Option<String>,
|
||||
/// The id the CRM gave the transcript at its last upload.
|
||||
pub crm_transcript_id: Option<String>,
|
||||
/// The backend ([`crate::backend`]'s base URL) `crm_transcript_id` was
|
||||
/// uploaded to; `None` if never uploaded. A build whose own backend
|
||||
/// differs (e.g. release reading a row a test build uploaded) does not
|
||||
/// count this as uploaded — see `call_view::uploaded_here`.
|
||||
pub crm_base_url: Option<String>,
|
||||
/// When the transcript was last uploaded.
|
||||
pub uploaded_at: Option<DateTime<Local>>,
|
||||
}
|
||||
|
||||
@@ -90,6 +90,7 @@ mod tests {
|
||||
audio_deleted: false,
|
||||
title: None,
|
||||
crm_transcript_id: None,
|
||||
crm_base_url: None,
|
||||
uploaded_at: None,
|
||||
}
|
||||
}
|
||||
|
||||
+121
-22
@@ -120,9 +120,19 @@ ALTER TABLE calls ADD COLUMN crm_transcript_id TEXT;
|
||||
ALTER TABLE calls ADD COLUMN uploaded_at TEXT;
|
||||
";
|
||||
|
||||
/// Version 4: which backend an upload belongs to, so a build whose own
|
||||
/// backend differs (see `crate::backend`) does not show someone else's
|
||||
/// upload as done (`call_view::uploaded_here`). Every upload before this
|
||||
/// version only ever went to the test backend (production never had the
|
||||
/// API yet): backfilled here, so existing rows keep meaning what they did.
|
||||
const SCHEMA_V4_SQL: &str = "
|
||||
ALTER TABLE calls ADD COLUMN crm_base_url TEXT;
|
||||
UPDATE calls SET crm_base_url = 'https://test.euvinopro.eu' WHERE crm_transcript_id IS NOT NULL;
|
||||
";
|
||||
|
||||
/// Schema steps by `PRAGMA user_version`: entry `i` takes a database from
|
||||
/// version `i` to `i + 1`. A new database runs all of them.
|
||||
const MIGRATIONS: &[&str] = &[SCHEMA_V1_SQL, SCHEMA_V2_SQL, SCHEMA_V3_SQL];
|
||||
const MIGRATIONS: &[&str] = &[SCHEMA_V1_SQL, SCHEMA_V2_SQL, SCHEMA_V3_SQL, SCHEMA_V4_SQL];
|
||||
|
||||
/// SQLite-backed store for calls and everything derived from them.
|
||||
pub struct Store {
|
||||
@@ -361,18 +371,21 @@ impl Store {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Records that the transcript was uploaded to the CRM at `at`, which
|
||||
/// gave it `crm_transcript_id`; replaces an earlier upload's record.
|
||||
/// Records that the transcript was uploaded to `crm_base_url` at `at`,
|
||||
/// which gave it `crm_transcript_id`; replaces an earlier upload's
|
||||
/// record (even one of another backend — one upload slot per call, see
|
||||
/// `call_view::uploaded_here`).
|
||||
pub fn set_uploaded(
|
||||
&self,
|
||||
id: CallId,
|
||||
crm_transcript_id: &str,
|
||||
crm_base_url: &str,
|
||||
at: DateTime<Local>,
|
||||
) -> Result<()> {
|
||||
let conn = self.conn.lock().unwrap();
|
||||
conn.execute(
|
||||
"UPDATE calls SET crm_transcript_id = ?1, uploaded_at = ?2 WHERE id = ?3",
|
||||
params![crm_transcript_id, dt_to_str(at), id],
|
||||
"UPDATE calls SET crm_transcript_id = ?1, crm_base_url = ?2, uploaded_at = ?3 WHERE id = ?4",
|
||||
params![crm_transcript_id, crm_base_url, dt_to_str(at), id],
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -536,9 +549,9 @@ fn ids_with_status(conn: &rusqlite::Connection, status: CallStatus) -> Result<Ve
|
||||
Ok(ids)
|
||||
}
|
||||
|
||||
const SELECT_ALL_CALLS_SQL: &str = "SELECT id, app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, title, crm_transcript_id, uploaded_at FROM calls";
|
||||
const SELECT_ALL_CALLS_SQL: &str = "SELECT id, app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, title, crm_transcript_id, uploaded_at, crm_base_url FROM calls";
|
||||
|
||||
const SELECT_CALL_COLUMNS_SQL: &str = "SELECT id, app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, title, crm_transcript_id, uploaded_at FROM calls WHERE id = ?1";
|
||||
const SELECT_CALL_COLUMNS_SQL: &str = "SELECT id, app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, title, crm_transcript_id, uploaded_at, crm_base_url FROM calls WHERE id = ?1";
|
||||
|
||||
fn row_to_call(row: &Row) -> Result<Call> {
|
||||
let id: CallId = row.get(0)?;
|
||||
@@ -555,6 +568,7 @@ fn row_to_call(row: &Row) -> Result<Call> {
|
||||
let title: Option<String> = row.get(11)?;
|
||||
let crm_transcript_id: Option<String> = row.get(12)?;
|
||||
let uploaded_at: Option<String> = row.get(13)?;
|
||||
let crm_base_url: Option<String> = row.get(14)?;
|
||||
|
||||
Ok(Call {
|
||||
id,
|
||||
@@ -570,6 +584,7 @@ fn row_to_call(row: &Row) -> Result<Call> {
|
||||
audio_deleted,
|
||||
title,
|
||||
crm_transcript_id,
|
||||
crm_base_url,
|
||||
uploaded_at: opt_dt_from_str(uploaded_at)?,
|
||||
})
|
||||
}
|
||||
@@ -692,6 +707,14 @@ CREATE TABLE speaker_merges (
|
||||
into_key TEXT NOT NULL,
|
||||
PRIMARY KEY (call_id, from_key)
|
||||
);
|
||||
";
|
||||
|
||||
/// The schema of user_version 3, exactly as release 0.2.0 created it
|
||||
/// (copied from `SCHEMA_V3_SQL` at `HEAD`): version 2 plus these
|
||||
/// statements.
|
||||
const RELEASED_V3_STEP_SQL: &str = "
|
||||
ALTER TABLE calls ADD COLUMN crm_transcript_id TEXT;
|
||||
ALTER TABLE calls ADD COLUMN uploaded_at TEXT;
|
||||
";
|
||||
|
||||
fn user_version(path: &Path) -> i64 {
|
||||
@@ -715,17 +738,19 @@ CREATE TABLE speaker_merges (
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_new_database_starts_at_version_3() {
|
||||
fn a_new_database_starts_at_version_4() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let path = dir.path().join("calls.sqlite");
|
||||
let store = Store::open(&path).unwrap();
|
||||
let id = new_call(&store);
|
||||
store.set_title(id, Some("Angebot")).unwrap();
|
||||
store.set_speaker_merge(id, "remote:2", "remote:1").unwrap();
|
||||
store.set_uploaded(id, "4711", Local::now()).unwrap();
|
||||
store
|
||||
.set_uploaded(id, "4711", "https://backend.example", Local::now())
|
||||
.unwrap();
|
||||
drop(store);
|
||||
|
||||
assert_eq!(user_version(&path), 3);
|
||||
assert_eq!(user_version(&path), 4);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -782,7 +807,7 @@ CREATE TABLE speaker_merges (
|
||||
store.set_title(1, Some("Lieferung März")).unwrap();
|
||||
store.set_speaker_merge(1, "remote:2", "remote:1").unwrap();
|
||||
drop(store);
|
||||
assert_eq!(user_version(&path), 3);
|
||||
assert_eq!(user_version(&path), 4);
|
||||
let store = Store::open(&path).unwrap();
|
||||
let call = store.get_call(1).unwrap().unwrap();
|
||||
assert_eq!(call.title.as_deref(), Some("Lieferung März"));
|
||||
@@ -832,41 +857,115 @@ CREATE TABLE speaker_merges (
|
||||
|
||||
// The new columns work, and opening again changes nothing.
|
||||
let uploaded = Local::now();
|
||||
store.set_uploaded(1, "crm-1", uploaded).unwrap();
|
||||
store
|
||||
.set_uploaded(1, "crm-1", "https://backend.example", uploaded)
|
||||
.unwrap();
|
||||
drop(store);
|
||||
assert_eq!(user_version(&path), 3);
|
||||
assert_eq!(user_version(&path), 4);
|
||||
let store = Store::open(&path).unwrap();
|
||||
let call = store.get_call(1).unwrap().unwrap();
|
||||
assert_eq!(call.crm_transcript_id.as_deref(), Some("crm-1"));
|
||||
assert_eq!(
|
||||
call.crm_base_url.as_deref(),
|
||||
Some("https://backend.example")
|
||||
);
|
||||
assert_eq!(call.uploaded_at, Some(uploaded));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_upload_is_recorded_and_replaced_by_the_next() {
|
||||
fn a_version_3_database_is_upgraded_backfilling_the_test_backend_for_uploads() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let path = dir.path().join("calls.sqlite");
|
||||
let started = "2026-11-05T10:14:00+01:00";
|
||||
{
|
||||
let conn = rusqlite::Connection::open(&path).unwrap();
|
||||
conn.execute_batch(RELEASED_V1_SCHEMA_SQL).unwrap();
|
||||
conn.execute_batch(RELEASED_V2_STEP_SQL).unwrap();
|
||||
conn.execute_batch(RELEASED_V3_STEP_SQL).unwrap();
|
||||
conn.execute_batch("PRAGMA user_version = 3;").unwrap();
|
||||
// An already-uploaded call (every pre-v4 upload went to the
|
||||
// test backend; production never had the API).
|
||||
conn.execute(
|
||||
"INSERT INTO calls \
|
||||
(app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, account_id, title, crm_transcript_id, uploaded_at) \
|
||||
VALUES ('Microsoft Teams', ?1, ?1, 'done', 0, NULL, '/rec/1-mic.wav', '/rec/1-out.wav', ?1, 0, NULL, NULL, 'crm-1', ?1)",
|
||||
rusqlite::params![started],
|
||||
)
|
||||
.unwrap();
|
||||
// A call that was never uploaded.
|
||||
conn.execute(
|
||||
"INSERT INTO calls \
|
||||
(app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, account_id, title, crm_transcript_id, uploaded_at) \
|
||||
VALUES ('MicroSIP', ?1, NULL, 'awaiting_decision', 0, NULL, '/rec/2-mic.wav', '/rec/2-out.wav', NULL, 0, NULL, NULL, NULL, NULL)",
|
||||
rusqlite::params![started],
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
let store = Store::open(&path).unwrap();
|
||||
|
||||
let uploaded = store.get_call(1).unwrap().expect("call kept");
|
||||
assert_eq!(uploaded.crm_transcript_id.as_deref(), Some("crm-1"));
|
||||
assert_eq!(
|
||||
uploaded.crm_base_url.as_deref(),
|
||||
Some("https://test.euvinopro.eu")
|
||||
);
|
||||
|
||||
let not_uploaded = store.get_call(2).unwrap().expect("call kept");
|
||||
assert_eq!(not_uploaded.crm_transcript_id, None);
|
||||
assert_eq!(not_uploaded.crm_base_url, None);
|
||||
|
||||
assert_eq!(user_version(&path), 4);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_upload_is_recorded_and_replaced_by_the_next_even_for_another_backend() {
|
||||
let store = Store::open_in_memory().unwrap();
|
||||
let id = new_call(&store);
|
||||
let other = new_call(&store);
|
||||
let first = Local::now();
|
||||
let second = first + chrono::Duration::minutes(5);
|
||||
|
||||
store.set_uploaded(id, "4711", first).unwrap();
|
||||
store
|
||||
.set_uploaded(id, "4711", "https://test.euvinopro.eu", first)
|
||||
.unwrap();
|
||||
let call = store.get_call(id).unwrap().unwrap();
|
||||
assert_eq!(
|
||||
(call.crm_transcript_id.as_deref(), call.uploaded_at),
|
||||
(Some("4711"), Some(first))
|
||||
(
|
||||
call.crm_transcript_id.as_deref(),
|
||||
call.crm_base_url.as_deref(),
|
||||
call.uploaded_at
|
||||
),
|
||||
(Some("4711"), Some("https://test.euvinopro.eu"), Some(first))
|
||||
);
|
||||
|
||||
store.set_uploaded(id, "4712", second).unwrap();
|
||||
// One upload slot per call: a later upload, even to a different
|
||||
// backend, replaces it rather than keeping both.
|
||||
store
|
||||
.set_uploaded(id, "4712", "https://backend.euvinopro.eu", second)
|
||||
.unwrap();
|
||||
let listed = store.list_calls().unwrap();
|
||||
let call = listed.iter().find(|c| c.id == id).unwrap();
|
||||
assert_eq!(
|
||||
(call.crm_transcript_id.as_deref(), call.uploaded_at),
|
||||
(Some("4712"), Some(second))
|
||||
(
|
||||
call.crm_transcript_id.as_deref(),
|
||||
call.crm_base_url.as_deref(),
|
||||
call.uploaded_at
|
||||
),
|
||||
(
|
||||
Some("4712"),
|
||||
Some("https://backend.euvinopro.eu"),
|
||||
Some(second)
|
||||
)
|
||||
);
|
||||
let untouched = store.get_call(other).unwrap().unwrap();
|
||||
assert_eq!(
|
||||
(untouched.crm_transcript_id, untouched.uploaded_at),
|
||||
(None, None)
|
||||
(
|
||||
untouched.crm_transcript_id,
|
||||
untouched.crm_base_url,
|
||||
untouched.uploaded_at
|
||||
),
|
||||
(None, None, None)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"pub_date": "2026-11-06T14:19:53Z",
|
||||
"version": "0.2.2",
|
||||
"pub_date": "2026-11-09T11:05:43Z",
|
||||
"platforms": {
|
||||
"windows-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVUdGpRa1ZvalU2SUtlUG9ZajRMcmFHb0dxNG1OM1lWZEExbzhsSjYzdUJxY1NrY2xERmRGbGJEV3c0UWRjdmVuaHFtWXlzYVU2alFJY0k4V1hoZ1FWdDVNV0xkclRQV2c0PQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzkzOTc0NzYxCWZpbGU6R2VzcHLDpGNoc3Jla29yZGVyXzAuMi4wX3g2NC1zZXR1cC5leGUJdmVyc2lvbjowLjIuMApna2tpeVdYMkhDU2d4ZjAwVTJaQjBBMG0yL010V2xIc3Awc0QzOXJsK2lmUi9oM1hwWmlvL2dNdFQzVzQrTys1ZnNmZHpXM0JicTRzd1d2MXp5YjhEQT09Cg==",
|
||||
"url": "https://gitea.euvino.eu/public/call-recorder/releases/download/v0.2.0/Gespraechsrekorder_0.2.0_x64-setup.exe"
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVUdGpRa1ZvalU2SVB0NjJZT09kazJxZlBBWi9tQWZFSUtZVTRaVnNDdnFsSUJZeDc2QWZybytFL2lUR1E5QStWY3k5Tk5xSUMxM1M3TFlhU1A5VUNkNzh0UlBvVDRMcndnPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzk0MjIyMzIxCWZpbGU6R2VzcHLDpGNoc3Jla29yZGVyXzAuMi4yX3g2NC1zZXR1cC5leGUJdmVyc2lvbjowLjIuMgpObWpiWWJKc1hodm1penNPc3BDM244elhiQ0kvUmF2ZUZVKzJSTkZ2aVArQzRTSUIvUXZ6Y0VYSUU1R3k3eFBnU1pid1ZMRHpDak9GYWtzYXdrSmlEZz09Cg==",
|
||||
"url": "https://gitea.euvino.eu/public/call-recorder/releases/download/v0.2.2/Gespraechsrekorder_0.2.2_x64-setup.exe"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "call-recorder"
|
||||
version = "0.2.1"
|
||||
version = "0.2.3"
|
||||
description = "Gesprächsrekorder desktop app"
|
||||
edition = "2021"
|
||||
|
||||
|
||||
@@ -31,11 +31,13 @@ use crate::state::AppState;
|
||||
|
||||
// The backend this build talks to: the one place to change it. It is not a
|
||||
// setting; a key created on one backend is never sent to another.
|
||||
/// Release builds. Switch to "https://backend.euvinopro.eu" here, then
|
||||
/// release, once that backend is live.
|
||||
const RELEASE_BACKEND_URL: &str = "https://test.euvinopro.eu";
|
||||
/// Debug builds (`cargo tauri dev`) always use the test backend.
|
||||
const DEV_BACKEND_URL: &str = "https://test.euvinopro.eu";
|
||||
/// Release builds: the production euvino admin backend.
|
||||
pub(crate) const RELEASE_BACKEND_URL: &str = "https://backend.euvinopro.eu";
|
||||
/// Debug builds (`cargo tauri dev`) always use the test backend, never the
|
||||
/// production one. `pub(crate)`: `state.rs` tests the exact test-backend →
|
||||
/// release-backend transition against this value (a key bound to one must
|
||||
/// never work for the other).
|
||||
pub(crate) const DEV_BACKEND_URL: &str = "https://test.euvinopro.eu";
|
||||
/// The backend of this build (no trailing slash).
|
||||
pub const BACKEND_URL: &str = if cfg!(debug_assertions) {
|
||||
DEV_BACKEND_URL
|
||||
@@ -235,7 +237,22 @@ async fn upload(app: &AppHandle, state: &AppState, id: CallId) -> CmdResult<()>
|
||||
.await
|
||||
.inspect_err(|e| log::warn!("call {id}: upload failed: {e}"))?;
|
||||
log::info!("call {id}: transcript uploaded (CRM id {crm_id})");
|
||||
state.mark_uploaded(id, &crm_id)
|
||||
if let Err(e) = state.mark_uploaded(id, &crm_id) {
|
||||
// The CRM already has it: a retry must never send it again, even
|
||||
// though the row itself still shows no crm_transcript_id.
|
||||
state.note_upload_confirmed_but_unsaved(id);
|
||||
log::error!("call {id}: uploaded (CRM id {crm_id}) but could not save locally: {e}");
|
||||
return Err(unsaved_upload_message(&crm_id, &e));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Message for an upload that reached the CRM (`crm_id`) but whose local
|
||||
/// record (`mark_uploaded`) failed with `e`: names the CRM id so the user
|
||||
/// can find it there, and says plainly not to upload the call again (the
|
||||
/// app also refuses on its own, see `AppState::note_upload_confirmed_but_unsaved`).
|
||||
fn unsaved_upload_message(crm_id: &str, e: &str) -> String {
|
||||
format!("Hochgeladen (ID {crm_id}), aber lokal nicht gespeichert: {e} – nicht erneut hochladen")
|
||||
}
|
||||
|
||||
/// [`Login`] through the login window, for the upload.
|
||||
@@ -446,6 +463,17 @@ mod tests {
|
||||
assert!(!url.ends_with('/'), "{url}");
|
||||
assert!(url.starts_with("https://"), "{url}");
|
||||
}
|
||||
// Release and dev talk to different backends: a key from one must
|
||||
// never be usable on the other (see AppState::backend_key).
|
||||
assert_ne!(RELEASE_BACKEND_URL, DEV_BACKEND_URL);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_unsaved_upload_message_names_the_crm_id_and_warns_against_retrying() {
|
||||
assert_eq!(
|
||||
unsaved_upload_message("4711", "disk full"),
|
||||
"Hochgeladen (ID 4711), aber lokal nicht gespeichert: disk full – nicht erneut hochladen"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
+210
-19
@@ -37,6 +37,7 @@ const MANUAL_APP: &str = "Manuell";
|
||||
const TEST_DURATION: Duration = Duration::from_secs(5);
|
||||
const TEST_POLL: Duration = Duration::from_millis(50);
|
||||
const ALREADY_PROCESSING: &str = "Wird bereits verarbeitet";
|
||||
const ALREADY_UPLOADING: &str = "Wird bereits hochgeladen";
|
||||
|
||||
/// Why [`AppState::discard_call`] refused.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
@@ -164,6 +165,12 @@ pub struct AppState {
|
||||
backend_key_lock: Mutex<()>,
|
||||
/// Calls whose transcript is being uploaded; one upload per call.
|
||||
uploading: Mutex<HashSet<CallId>>,
|
||||
/// Calls whose transcript reached the CRM but could not be recorded
|
||||
/// locally (`mark_uploaded` failed after a successful upload):
|
||||
/// `claim_upload` refuses these for the rest of this run, so a retry
|
||||
/// never creates a second copy at the CRM. In-memory only; a restart
|
||||
/// forgets it (the row's `crm_transcript_id` is still empty then).
|
||||
upload_confirmed_unsaved: Mutex<HashSet<CallId>>,
|
||||
}
|
||||
|
||||
/// An upload reserved with [`AppState::claim_upload`]; released when
|
||||
@@ -217,6 +224,7 @@ impl AppState {
|
||||
.to_string(),
|
||||
backend_key_lock: Mutex::new(()),
|
||||
uploading: Mutex::new(HashSet::new()),
|
||||
upload_confirmed_unsaved: Mutex::new(HashSet::new()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,17 +350,28 @@ impl AppState {
|
||||
}
|
||||
|
||||
/// Reserves call `id` for one upload; released when the claim is
|
||||
/// dropped. A second upload of the same call is refused meanwhile, and a
|
||||
/// call that already carries a CRM transcript id is refused outright:
|
||||
/// the CRM must never get a duplicate. Both checks happen while
|
||||
/// `uploading` is locked, so a second upload can never slip in between
|
||||
/// this check and the one upload it allows.
|
||||
/// dropped. A second upload of the same call is refused meanwhile, and
|
||||
/// so is a call already uploaded to *this build's* backend
|
||||
/// ([`call_view::uploaded_here`]) — or one the CRM confirmed but whose
|
||||
/// id could not be saved locally, see
|
||||
/// [`AppState::note_upload_confirmed_but_unsaved`]: the CRM this build
|
||||
/// talks to must never get a duplicate. An upload recorded for another
|
||||
/// backend (e.g. the test backend, read by a release build) is not
|
||||
/// "uploaded" here and is claimed like any other call. All three checks
|
||||
/// happen while `uploading` is locked, so a second upload can never
|
||||
/// slip in between this check and the one upload it allows.
|
||||
pub fn claim_upload(&self, id: CallId) -> Result<UploadClaim<'_>, String> {
|
||||
let mut uploading = lock(&self.uploading);
|
||||
if uploading.contains(&id) {
|
||||
return Err("Wird bereits hochgeladen".to_string());
|
||||
return Err(ALREADY_UPLOADING.to_string());
|
||||
}
|
||||
if self.find_call(id)?.crm_transcript_id.is_some() {
|
||||
if lock(&self.upload_confirmed_unsaved).contains(&id) {
|
||||
return Err("Bereits hochgeladen".to_string());
|
||||
}
|
||||
// An upload recorded for another backend (e.g. the test backend,
|
||||
// read by a release build) does not count: the CRM this build
|
||||
// talks to has never seen this transcript.
|
||||
if call_view::uploaded_here(&self.find_call(id)?, &self.backend_url) {
|
||||
return Err("Bereits hochgeladen".to_string());
|
||||
}
|
||||
uploading.insert(id);
|
||||
@@ -364,6 +383,14 @@ impl AppState {
|
||||
lock(&self.uploading).contains(&id)
|
||||
}
|
||||
|
||||
/// Records that call `id`'s transcript reached the CRM, but saving that
|
||||
/// locally (`mark_uploaded`) failed: [`AppState::claim_upload`] refuses
|
||||
/// this call for the rest of the run, so a retry can never send the CRM
|
||||
/// a second copy. In-memory only; see the field's doc comment.
|
||||
pub fn note_upload_confirmed_but_unsaved(&self, id: CallId) {
|
||||
lock(&self.upload_confirmed_unsaved).insert(id);
|
||||
}
|
||||
|
||||
/// Changes and saves settings the app manages itself; saves only if
|
||||
/// something changed.
|
||||
fn update_settings(&self, change: impl FnOnce(&mut Settings)) -> Result<(), String> {
|
||||
@@ -607,7 +634,10 @@ impl AppState {
|
||||
/// All calls for the main window's list, newest first.
|
||||
pub fn call_list(&self) -> Result<Vec<CallListItem>, String> {
|
||||
let calls = self.store.list_calls().map_err(|e| e.to_string())?;
|
||||
Ok(calls.iter().map(CallListItem::of).collect())
|
||||
Ok(calls
|
||||
.iter()
|
||||
.map(|call| CallListItem::of(call, &self.backend_url))
|
||||
.collect())
|
||||
}
|
||||
|
||||
/// The selected call with its transcript (speaker merges applied),
|
||||
@@ -617,7 +647,7 @@ impl AppState {
|
||||
let segments = self.store.segments(id).map_err(|e| e.to_string())?;
|
||||
let names = self.store.speaker_names(id).map_err(|e| e.to_string())?;
|
||||
let merges = self.store.speaker_merges(id).map_err(|e| e.to_string())?;
|
||||
let mut detail = CallDetail::of(&call, &segments, names, &merges);
|
||||
let mut detail = CallDetail::of(&call, &segments, names, &merges, &self.backend_url);
|
||||
detail.uploading = self.is_uploading(id);
|
||||
Ok(detail)
|
||||
}
|
||||
@@ -672,7 +702,7 @@ impl AppState {
|
||||
pub fn mark_uploaded(&self, id: CallId, crm_transcript_id: &str) -> Result<(), String> {
|
||||
self.find_call(id)?;
|
||||
self.store
|
||||
.set_uploaded(id, crm_transcript_id, Local::now())
|
||||
.set_uploaded(id, crm_transcript_id, &self.backend_url, Local::now())
|
||||
.map_err(|e| format!("Upload konnte nicht vermerkt werden: {e}"))
|
||||
}
|
||||
|
||||
@@ -683,11 +713,15 @@ impl AppState {
|
||||
.ok_or_else(|| "Gespräch nicht gefunden".to_string())
|
||||
}
|
||||
|
||||
/// Deletes a finished call: both audio files and the row, and takes it
|
||||
/// out of the prompt queue. Returns how many calls still wait for the
|
||||
/// prompt. A call that is being processed, or whose DeepScript jobs
|
||||
/// are still on record ([`DiscardError::CleanupPending`]), is not
|
||||
/// deleted.
|
||||
/// Deletes a finished (or still undecided/failed) call: both audio files
|
||||
/// and the row, cascading to its segments, speaker names, merges and
|
||||
/// recorded remote jobs — this is also how a transcribed (`Done`) call's
|
||||
/// "Löschen" removes it. Takes it out of the prompt queue and returns how
|
||||
/// many calls still wait for it. Refused while the call is being
|
||||
/// recorded, processed ([`AppState::claim_processing`]/
|
||||
/// [`AppState::reserve_processing`] or status `Processing`), uploaded
|
||||
/// ([`AppState::claim_upload`]), or while its DeepScript jobs are still
|
||||
/// on record ([`DiscardError::CleanupPending`]).
|
||||
pub fn discard_call(&self, id: CallId) -> Result<usize, DiscardError> {
|
||||
if lock(&self.current)
|
||||
.as_ref()
|
||||
@@ -695,11 +729,17 @@ impl AppState {
|
||||
{
|
||||
return Err("Das Gespräch wird gerade aufgenommen".to_string().into());
|
||||
}
|
||||
// Held until the call is gone, so no run can claim it meanwhile.
|
||||
// Both held until the call is gone, so neither a pipeline run nor an
|
||||
// upload can claim it meanwhile (same uploading -> store lock order
|
||||
// as `claim_upload`, so this can never deadlock against it).
|
||||
let processing = lock(&self.processing);
|
||||
if processing.contains(&id) {
|
||||
return Err(ALREADY_PROCESSING.to_string().into());
|
||||
}
|
||||
let uploading = lock(&self.uploading);
|
||||
if uploading.contains(&id) {
|
||||
return Err(ALREADY_UPLOADING.to_string().into());
|
||||
}
|
||||
let call = self
|
||||
.store
|
||||
.get_call(id)
|
||||
@@ -713,7 +753,8 @@ impl AppState {
|
||||
return Err(DiscardError::CleanupPending);
|
||||
}
|
||||
// Files first: if one cannot be deleted, the row stays so the user
|
||||
// can try again instead of leaving orphaned audio behind.
|
||||
// can try again instead of leaving orphaned audio behind. Already
|
||||
// gone (e.g. removed by retention) is not an error.
|
||||
for path in [&call.mic_path, &call.out_path] {
|
||||
if path.as_os_str().is_empty() {
|
||||
continue;
|
||||
@@ -739,6 +780,7 @@ impl AppState {
|
||||
}
|
||||
return Err(format!("Gespräch konnte nicht gelöscht werden: {e}").into());
|
||||
}
|
||||
drop(uploading);
|
||||
drop(processing);
|
||||
Ok(self.prompts_waiting())
|
||||
}
|
||||
@@ -1118,6 +1160,60 @@ mod tests {
|
||||
assert!(f.state.reserve_processing(id));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_transcribed_call_is_deleted_like_any_other() {
|
||||
let f = fixture();
|
||||
let (id, mic, out) = finished_call(&f, "a");
|
||||
f.state
|
||||
.store
|
||||
.set_status(id, CallStatus::Done, None)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(f.state.discard_call(id), Ok(0));
|
||||
assert!(!mic.exists());
|
||||
assert!(!out.exists());
|
||||
assert_eq!(f.state.store.get_call(id).unwrap(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_call_being_uploaded_is_not_discarded() {
|
||||
let f = fixture();
|
||||
let (id, mic, out) = finished_call(&f, "a");
|
||||
f.state
|
||||
.store
|
||||
.set_status(id, CallStatus::Done, None)
|
||||
.unwrap();
|
||||
let claim = f.state.claim_upload(id).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
f.state.discard_call(id),
|
||||
Err(DiscardError::Other("Wird bereits hochgeladen".to_string()))
|
||||
);
|
||||
assert!(mic.exists());
|
||||
assert!(out.exists());
|
||||
assert!(f.state.store.get_call(id).unwrap().is_some());
|
||||
|
||||
// Once the upload is done, the delete goes through.
|
||||
drop(claim);
|
||||
assert_eq!(f.state.discard_call(id), Ok(0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_call_already_uploaded_here_is_deleted_without_touching_the_crm() {
|
||||
let f = fixture();
|
||||
let (id, mic, out) = finished_call(&f, "a");
|
||||
f.state
|
||||
.store
|
||||
.set_status(id, CallStatus::Done, None)
|
||||
.unwrap();
|
||||
f.state.mark_uploaded(id, "4711").unwrap();
|
||||
|
||||
assert_eq!(f.state.discard_call(id), Ok(0));
|
||||
assert!(!mic.exists());
|
||||
assert!(!out.exists());
|
||||
assert_eq!(f.state.store.get_call(id).unwrap(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_cleanup_reserves_a_call_of_any_status() {
|
||||
let f = fixture();
|
||||
@@ -1518,6 +1614,42 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// The real transition the review asked to lock in: a key created while
|
||||
/// this install talked to the test backend must not work once the same
|
||||
/// install is a release build talking to the production backend — it is
|
||||
/// discarded and a fresh login is required, exactly like any other
|
||||
/// backend mismatch above, but with the two real build-time constants
|
||||
/// instead of a placeholder domain.
|
||||
#[test]
|
||||
fn a_key_from_the_test_backend_does_not_work_for_a_release_build() {
|
||||
let mut f = fixture();
|
||||
// A build on the test backend (what `cargo tauri dev` is), whatever
|
||||
// profile this test itself runs in.
|
||||
f.state.backend_url = crate::backend::DEV_BACKEND_URL.to_string();
|
||||
f.state
|
||||
.store_backend_key(
|
||||
&new_key("euv_test"),
|
||||
crate::backend::DEV_BACKEND_URL,
|
||||
Some("hinrichs".into()),
|
||||
)
|
||||
.unwrap();
|
||||
assert!(f.state.backend_key().is_some());
|
||||
|
||||
// Same keyring entry and settings file; now read as a release build
|
||||
// would (a different `backend_url`, nothing else changed).
|
||||
f.state.backend_url = crate::backend::RELEASE_BACKEND_URL.to_string();
|
||||
|
||||
assert_eq!(
|
||||
f.state.backend_key(),
|
||||
None,
|
||||
"a test-backend key must not work for the release backend"
|
||||
);
|
||||
assert_eq!(f.state.secrets.get(Service::Backend), None);
|
||||
let settings = f.state.settings();
|
||||
assert_eq!(settings.backend_username, None);
|
||||
assert_eq!(settings.backend_key_base_url, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_backend_login_is_refreshed_from_the_key_info() {
|
||||
let f = fixture();
|
||||
@@ -1602,10 +1734,17 @@ mod tests {
|
||||
#[test]
|
||||
fn the_backend_is_fixed_per_build() {
|
||||
let f = fixture();
|
||||
assert_eq!(f.state.backend_url(), "https://test.euvinopro.eu");
|
||||
// Debug builds (`cargo tauri dev`, `cargo test`) use the test
|
||||
// backend, release builds the production one.
|
||||
let expected = if cfg!(debug_assertions) {
|
||||
"https://test.euvinopro.eu"
|
||||
} else {
|
||||
"https://backend.euvinopro.eu"
|
||||
};
|
||||
assert_eq!(f.state.backend_url(), expected);
|
||||
assert_eq!(
|
||||
f.state.backend_client().login_url(),
|
||||
"https://test.euvinopro.eu/euvadm"
|
||||
format!("{expected}/euvadm")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1643,6 +1782,57 @@ mod tests {
|
||||
assert!(!f.state.is_uploading(id));
|
||||
}
|
||||
|
||||
/// The real case the review asked to lock in: a call uploaded to the
|
||||
/// test backend is refused for upload by a build whose own backend is
|
||||
/// the test backend (the normal case, above), but uploadable again by a
|
||||
/// build whose backend is the production one — the CRM at that backend
|
||||
/// has never seen this transcript.
|
||||
#[test]
|
||||
fn an_upload_to_another_backend_is_not_counted_as_uploaded_here() {
|
||||
let mut f = fixture();
|
||||
let (id, _, _) = finished_call(&f, "a");
|
||||
// A build on the test backend (what `cargo tauri dev` is), whatever
|
||||
// profile this test itself runs in: mark_uploaded records it.
|
||||
f.state.backend_url = crate::backend::DEV_BACKEND_URL.to_string();
|
||||
f.state.mark_uploaded(id, "4711").unwrap();
|
||||
assert_eq!(
|
||||
f.state.find_call(id).unwrap().crm_base_url.as_deref(),
|
||||
Some(crate::backend::DEV_BACKEND_URL)
|
||||
);
|
||||
assert_eq!(
|
||||
f.state.claim_upload(id).err(),
|
||||
Some("Bereits hochgeladen".to_string())
|
||||
);
|
||||
|
||||
// The same row, now read as a release build would be: a different
|
||||
// backend, nothing else changed.
|
||||
f.state.backend_url = crate::backend::RELEASE_BACKEND_URL.to_string();
|
||||
assert!(f.state.claim_upload(id).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_upload_confirmed_but_unsaved_is_never_retried() {
|
||||
// The CRM has the transcript, but mark_uploaded failed: the row
|
||||
// itself still shows no crm_transcript_id.
|
||||
let f = fixture();
|
||||
let (id, _, _) = finished_call(&f, "a");
|
||||
f.state.note_upload_confirmed_but_unsaved(id);
|
||||
|
||||
assert!(f
|
||||
.state
|
||||
.call_detail(id)
|
||||
.unwrap()
|
||||
.call
|
||||
.item
|
||||
.crm_transcript_id
|
||||
.is_none());
|
||||
assert_eq!(
|
||||
f.state.claim_upload(id).err(),
|
||||
Some("Bereits hochgeladen".to_string())
|
||||
);
|
||||
assert!(!f.state.is_uploading(id));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_upload_is_recorded_on_the_call() {
|
||||
let f = fixture();
|
||||
@@ -1652,6 +1842,7 @@ mod tests {
|
||||
|
||||
let call = f.state.store.get_call(id).unwrap().unwrap();
|
||||
assert_eq!(call.crm_transcript_id.as_deref(), Some("4711"));
|
||||
assert_eq!(call.crm_base_url.as_deref(), Some(BASE));
|
||||
assert!(call.uploaded_at.is_some());
|
||||
assert_eq!(
|
||||
f.state.mark_uploaded(id + 1, "1"),
|
||||
|
||||
+162
-22
@@ -13,6 +13,7 @@
|
||||
//! there (see [`can_self_update`]).
|
||||
|
||||
use std::fs;
|
||||
use std::future::Future;
|
||||
use std::path::Path;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Mutex;
|
||||
@@ -47,6 +48,17 @@ const DOWNLOAD_TIMEOUT: Duration = Duration::from_secs(15 * 60);
|
||||
const MIB: u64 = 1024 * 1024;
|
||||
/// Why the banner cannot install yet; the banner shows the same hint.
|
||||
const BUSY: &str = "Nach der laufenden Aufnahme/Verarbeitung möglich";
|
||||
/// The feed's key for the one installable release this app ever builds for
|
||||
/// itself (see `UpdaterBuilder::target`). Asked explicitly on platforms
|
||||
/// that cannot self-update, since the feed has no entry of their own and
|
||||
/// the updater's automatic target lookup would otherwise fail with
|
||||
/// `TargetsNotFound` even when a newer version exists.
|
||||
const WINDOWS_TARGET: &str = "windows-x86_64";
|
||||
/// Why installing is refused outright on this platform (`install_update`'s
|
||||
/// own guard, in case a future feed ever gets a non-Windows entry and
|
||||
/// `check` started finding updates there too).
|
||||
const LINUX_CANNOT_INSTALL: &str =
|
||||
"Updates werden unter Linux nicht automatisch installiert – bitte das .deb neu installieren.";
|
||||
|
||||
/// The newest update found, and whether one is being installed.
|
||||
#[derive(Default)]
|
||||
@@ -64,9 +76,10 @@ pub struct UpdateInfo {
|
||||
}
|
||||
|
||||
/// Answer of `check_for_update_now`: what a check (background or manual)
|
||||
/// found. `Available` leaves the same state `get_update` reads and fires
|
||||
/// the same `update-available` event as the background loop, so the main
|
||||
/// window's banner shows it too.
|
||||
/// found. On Windows, `Available` also leaves the same state `get_update`
|
||||
/// reads and fires the same `update-available` event as the background
|
||||
/// loop, so the main window's banner shows it too; elsewhere it only
|
||||
/// reports the version (see `check_outcome`).
|
||||
#[derive(Serialize, Clone, Debug, PartialEq)]
|
||||
#[serde(tag = "status", rename_all = "lowercase")]
|
||||
pub enum UpdateCheckResult {
|
||||
@@ -116,15 +129,42 @@ impl UpdateSchedule {
|
||||
};
|
||||
}
|
||||
|
||||
/// Runs one check attempt right now: serialized against any other check
|
||||
/// (background or manual) via `running`, and recorded for the
|
||||
/// scheduler exactly like a background attempt.
|
||||
/// Runs one check attempt right now, unconditionally: for a manual
|
||||
/// check, which the user asked for regardless of whether one is due.
|
||||
/// Serialized against any other check (background or manual) via
|
||||
/// `running`, and recorded for the scheduler exactly like a background
|
||||
/// attempt.
|
||||
async fn run(&self, app: &AppHandle) -> UpdateCheckResult {
|
||||
self.attempt(false, || check(app))
|
||||
.await
|
||||
.expect("an unconditional attempt always runs")
|
||||
}
|
||||
|
||||
/// For the background loop: like [`UpdateSchedule::run`], but only if a
|
||||
/// check is still due once `running` is held (see `attempt`).
|
||||
async fn run_if_due(&self, app: &AppHandle) {
|
||||
self.attempt(true, || check(app)).await;
|
||||
}
|
||||
|
||||
/// One serialized, recorded check attempt: takes `running`, then (if
|
||||
/// `only_if_due`) re-checks `is_due` before calling `check`. Without
|
||||
/// that re-check, a background tick that found a check due but then
|
||||
/// had to wait behind a manual check (or another tick) would run its
|
||||
/// own check right after, although the one it waited for just made the
|
||||
/// next one not due any more. `None`: skipped, nothing recorded.
|
||||
async fn attempt<F, Fut>(&self, only_if_due: bool, check: F) -> Option<UpdateCheckResult>
|
||||
where
|
||||
F: FnOnce() -> Fut,
|
||||
Fut: Future<Output = UpdateCheckResult>,
|
||||
{
|
||||
let _serialize = self.running.lock().await;
|
||||
let now = SystemTime::now();
|
||||
let result = check(app).await;
|
||||
if only_if_due && !self.is_due(now) {
|
||||
return None;
|
||||
}
|
||||
let result = check().await;
|
||||
self.record(now, !matches!(result, UpdateCheckResult::Error { .. }));
|
||||
result
|
||||
Some(result)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,8 +186,11 @@ pub fn spawn(app: AppHandle) {
|
||||
}
|
||||
thread::spawn(move || loop {
|
||||
let now = SystemTime::now();
|
||||
// Cheap early exit so most wake-ups never touch `running`; the due
|
||||
// check that decides whether a check actually runs happens again
|
||||
// inside `run_if_due`, once `running` is held (see its doc comment).
|
||||
if app.state::<UpdateSchedule>().is_due(now) {
|
||||
tauri::async_runtime::block_on(app.state::<UpdateSchedule>().run(&app));
|
||||
tauri::async_runtime::block_on(app.state::<UpdateSchedule>().run_if_due(&app));
|
||||
}
|
||||
thread::sleep(WAKE_INTERVAL);
|
||||
});
|
||||
@@ -176,32 +219,62 @@ fn check_due(last_attempt: Option<SystemTime>, failures: u32, now: SystemTime) -
|
||||
/// background loop and a manual check (`check_for_update_now`) both run.
|
||||
/// A failed check (offline, no release yet) is expected; only logged here,
|
||||
/// and shown to the user only by a manual check (via the returned message).
|
||||
///
|
||||
/// The feed only ever has a `windows-x86_64` entry (Debian builds never
|
||||
/// self-update, see `RELEASING.md`). On Windows the automatic target lookup
|
||||
/// finds it on its own; on any other platform it is asked for explicitly
|
||||
/// ([`WINDOWS_TARGET`]), only to learn the version number — see
|
||||
/// [`check_outcome`] for why nothing is stored or announced there.
|
||||
async fn check(app: &AppHandle) -> UpdateCheckResult {
|
||||
let result = match app.updater_builder().timeout(CHECK_TIMEOUT).build() {
|
||||
let is_windows = cfg!(windows);
|
||||
let mut builder = app.updater_builder().timeout(CHECK_TIMEOUT);
|
||||
if !is_windows {
|
||||
builder = builder.target(WINDOWS_TARGET);
|
||||
}
|
||||
let result = match builder.build() {
|
||||
Ok(updater) => updater.check().await,
|
||||
Err(e) => Err(e),
|
||||
};
|
||||
match result {
|
||||
Ok(Some(update)) => {
|
||||
log::info!("update available: {}", update.version);
|
||||
let version = update.version.clone();
|
||||
*lock(&app.state::<PendingUpdate>().update) = Some(update);
|
||||
let _ = app.emit("update-available", info(app, version.clone()));
|
||||
UpdateCheckResult::Available { version }
|
||||
Ok(found) => {
|
||||
let version = found.as_ref().map(|update| update.version.clone());
|
||||
match &version {
|
||||
Some(v) => log::info!("update available: {v}"),
|
||||
None => log::info!("no update available"),
|
||||
}
|
||||
Ok(None) => {
|
||||
log::info!("no update available");
|
||||
UpdateCheckResult::None
|
||||
let (outcome, offer_install) = check_outcome(is_windows, version.clone());
|
||||
if let (Some(update), true) = (found, offer_install) {
|
||||
*lock(&app.state::<PendingUpdate>().update) = Some(update);
|
||||
let _ = app.emit(
|
||||
"update-available",
|
||||
info(app, version.expect("offer_install implies a version")),
|
||||
);
|
||||
}
|
||||
outcome
|
||||
}
|
||||
Err(e) => {
|
||||
log::info!("update check failed: {e}");
|
||||
UpdateCheckResult::Error {
|
||||
message: format!("Update-Server nicht erreichbar: {e}"),
|
||||
message: format!("Update-Prüfung fehlgeschlagen: {e}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// What a feed answer (`version`, if any) means on this platform: the
|
||||
/// result to return either way, and whether to remember the update for
|
||||
/// `install_update` and announce it to the main window's banner. Only
|
||||
/// Windows self-updates, so only there is a found update ever stored or
|
||||
/// announced; elsewhere a manual check still reports the version (the
|
||||
/// settings show it with a "not on this platform" hint instead of an
|
||||
/// install button), but nothing is kept to install.
|
||||
fn check_outcome(is_windows: bool, version: Option<String>) -> (UpdateCheckResult, bool) {
|
||||
match version {
|
||||
Some(version) => (UpdateCheckResult::Available { version }, is_windows),
|
||||
None => (UpdateCheckResult::None, false),
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether this is the first start of `version` (e.g. right after an
|
||||
/// update), going by the version remembered in `path`; remembers `version`
|
||||
/// for the next start.
|
||||
@@ -258,6 +331,11 @@ pub fn get_update(app: AppHandle) -> Option<UpdateInfo> {
|
||||
/// app. Returns only on failure.
|
||||
#[tauri::command]
|
||||
pub async fn install_update(app: AppHandle) -> Result<(), String> {
|
||||
// Defense in depth: `check` only ever stores a pending update on
|
||||
// Windows, but this guard holds even if that ever changes.
|
||||
if !cfg!(windows) {
|
||||
return Err(LINUX_CANNOT_INSTALL.to_string());
|
||||
}
|
||||
let pending = app.state::<PendingUpdate>();
|
||||
if pending.installing.swap(true, Ordering::SeqCst) {
|
||||
return Err("Das Update wird bereits installiert".to_string());
|
||||
@@ -450,13 +528,40 @@ mod tests {
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::to_value(UpdateCheckResult::Error {
|
||||
message: "Update-Server nicht erreichbar: x".into()
|
||||
message: "Update-Prüfung fehlgeschlagen: x".into()
|
||||
})
|
||||
.unwrap(),
|
||||
serde_json::json!({"status": "error", "message": "Update-Server nicht erreichbar: x"})
|
||||
serde_json::json!({"status": "error", "message": "Update-Prüfung fehlgeschlagen: x"})
|
||||
);
|
||||
}
|
||||
|
||||
/// Only Windows self-updates: elsewhere a found update is still
|
||||
/// reported (so the settings can show the version), but never stored
|
||||
/// for `install_update` or announced to the banner.
|
||||
#[test]
|
||||
fn only_windows_offers_to_install_a_found_update() {
|
||||
assert_eq!(
|
||||
check_outcome(true, Some("0.3.0".into())),
|
||||
(
|
||||
UpdateCheckResult::Available {
|
||||
version: "0.3.0".into()
|
||||
},
|
||||
true
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
check_outcome(false, Some("0.3.0".into())),
|
||||
(
|
||||
UpdateCheckResult::Available {
|
||||
version: "0.3.0".into()
|
||||
},
|
||||
false
|
||||
)
|
||||
);
|
||||
assert_eq!(check_outcome(true, None), (UpdateCheckResult::None, false));
|
||||
assert_eq!(check_outcome(false, None), (UpdateCheckResult::None, false));
|
||||
}
|
||||
|
||||
/// A manual check feeds the very scheduler the background loop reads
|
||||
/// (`record` is the one function either kind of attempt calls): a
|
||||
/// failure advances the backoff by exactly the one step a single
|
||||
@@ -485,4 +590,39 @@ mod tests {
|
||||
assert!(!schedule.is_due(t0() + MIN + 6 * HOUR - MIN));
|
||||
assert!(schedule.is_due(t0() + MIN + 6 * HOUR));
|
||||
}
|
||||
|
||||
/// A background tick that found a check due, but only got `running`
|
||||
/// after a manual check finished, must not check again: `is_due` is
|
||||
/// re-checked once the lock is held. Sequential here (the tick's own
|
||||
/// early `is_due` happened before the manual check, so only the
|
||||
/// re-check inside `attempt` can stop it).
|
||||
#[test]
|
||||
fn a_background_attempt_rechecks_due_once_it_holds_the_lock() {
|
||||
let schedule = UpdateSchedule::default();
|
||||
assert!(
|
||||
schedule.is_due(SystemTime::now()),
|
||||
"the tick saw a due check"
|
||||
);
|
||||
|
||||
let manual = tauri::async_runtime::block_on(
|
||||
schedule.attempt(false, || async { UpdateCheckResult::None }),
|
||||
);
|
||||
assert_eq!(manual, Some(UpdateCheckResult::None));
|
||||
|
||||
let mut checked = false;
|
||||
let background = tauri::async_runtime::block_on(schedule.attempt(true, || {
|
||||
checked = true;
|
||||
async { UpdateCheckResult::None }
|
||||
}));
|
||||
assert_eq!(background, None);
|
||||
assert!(!checked, "no second check right after the manual one");
|
||||
|
||||
// A manual check always runs, due or not.
|
||||
let again = tauri::async_runtime::block_on(schedule.attempt(false, || async {
|
||||
UpdateCheckResult::Error {
|
||||
message: "x".into(),
|
||||
}
|
||||
}));
|
||||
assert!(matches!(again, Some(UpdateCheckResult::Error { .. })));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "Gesprächsrekorder",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.3",
|
||||
"identifier": "eu.euvino.callrecorder",
|
||||
"build": {
|
||||
"frontendDist": "../ui/dist",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ui",
|
||||
"private": true,
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.3",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
+129
-1
@@ -45,6 +45,12 @@
|
||||
let actionError = $state('')
|
||||
let busy = $state(false)
|
||||
|
||||
// "Löschen" (transcribed calls): confirmed with a dialog instead of
|
||||
// running straight away like the other actions.
|
||||
let deleteDialogOpen = $state(false)
|
||||
let deleteBusy = $state(false)
|
||||
let deleteError = $state('')
|
||||
|
||||
// Uploads run per call and may outlive the selection (the login can
|
||||
// take a while); their errors are kept per call too.
|
||||
let uploading = $state<CallId[]>([])
|
||||
@@ -105,6 +111,8 @@
|
||||
actionError = ''
|
||||
editingTitle = false
|
||||
titleError = ''
|
||||
deleteDialogOpen = false
|
||||
deleteError = ''
|
||||
refreshDetail()
|
||||
}
|
||||
|
||||
@@ -115,6 +123,8 @@
|
||||
actionError = ''
|
||||
editingTitle = false
|
||||
titleError = ''
|
||||
deleteDialogOpen = false
|
||||
deleteError = ''
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
@@ -189,6 +199,49 @@
|
||||
refreshList()
|
||||
})
|
||||
|
||||
/** "Löschen" on a transcribed call: asks for confirmation first. */
|
||||
function askDelete() {
|
||||
deleteError = ''
|
||||
deleteDialogOpen = true
|
||||
}
|
||||
|
||||
function cancelDelete() {
|
||||
deleteDialogOpen = false
|
||||
deleteError = ''
|
||||
}
|
||||
|
||||
/** Confirmed delete: same backend path as "Verwerfen" (`discard_call`).
|
||||
* On success the selection moves to the next call in the list, or clears
|
||||
* if none is left. */
|
||||
async function confirmDelete() {
|
||||
if (!detail) return
|
||||
const id = detail.call.id
|
||||
deleteBusy = true
|
||||
try {
|
||||
await discardCall(id)
|
||||
deleteDialogOpen = false
|
||||
selectAfterDelete(id)
|
||||
refreshList()
|
||||
} catch (err) {
|
||||
deleteError = errorText(err)
|
||||
} finally {
|
||||
deleteBusy = false
|
||||
}
|
||||
}
|
||||
|
||||
/** Selects the call that took `deletedId`'s place in the list (or the one
|
||||
* before it, if `deletedId` was last), else clears the selection. */
|
||||
function selectAfterDelete(deletedId: CallId) {
|
||||
const index = calls.findIndex((c) => c.id === deletedId)
|
||||
const remaining = calls.filter((c) => c.id !== deletedId)
|
||||
if (remaining.length === 0) {
|
||||
clearSelection()
|
||||
return
|
||||
}
|
||||
const next = remaining[Math.min(Math.max(index, 0), remaining.length - 1)]
|
||||
select(next.id)
|
||||
}
|
||||
|
||||
/** Uploads the shown call's transcript (logging in first if needed). A
|
||||
* call already uploaded has no button any more: the CRM never gets a
|
||||
* duplicate. */
|
||||
@@ -351,7 +404,8 @@
|
||||
{:else if call.status === 'failed'}
|
||||
<button class="btn primary" disabled={busy} onclick={retry}>Erneut versuchen</button>
|
||||
<button class="btn danger" disabled={busy} onclick={discard}>Verwerfen</button>
|
||||
{:else if call.status === 'done' && !call.uploaded_at}
|
||||
{:else if call.status === 'done'}
|
||||
{#if !call.uploaded_at}
|
||||
<button
|
||||
class="btn primary"
|
||||
disabled={!call.transcribed_at || isUploading}
|
||||
@@ -361,6 +415,10 @@
|
||||
{isUploading ? 'wird hochgeladen…' : 'Transkript hochladen'}
|
||||
</button>
|
||||
{/if}
|
||||
<button class="btn danger" disabled={deleteBusy || isUploading} onclick={askDelete}>
|
||||
Löschen
|
||||
</button>
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
{#if shownActionError}
|
||||
@@ -397,6 +455,40 @@
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if deleteDialogOpen}
|
||||
<div
|
||||
class="dialog-backdrop"
|
||||
onclick={cancelDelete}
|
||||
onkeydown={(e) => e.key === 'Escape' && cancelDelete()}
|
||||
role="presentation"
|
||||
>
|
||||
<div
|
||||
class="dialog"
|
||||
role="alertdialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="delete-dialog-title"
|
||||
tabindex="-1"
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
onkeydown={(e) => e.stopPropagation()}
|
||||
>
|
||||
<p class="dialog-title" id="delete-dialog-title">Gespräch löschen?</p>
|
||||
<p>Audio und Transkript werden unwiderruflich von diesem PC gelöscht.</p>
|
||||
{#if call.uploaded_at}
|
||||
<p>Die Kopie im CRM bleibt erhalten.</p>
|
||||
{/if}
|
||||
{#if deleteError}
|
||||
<p class="error">{deleteError}</p>
|
||||
{/if}
|
||||
<div class="dialog-actions">
|
||||
<button class="btn danger" disabled={deleteBusy} onclick={confirmDelete}>
|
||||
Löschen
|
||||
</button>
|
||||
<button class="btn" disabled={deleteBusy} onclick={cancelDelete}>Abbrechen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{:else if detailError}
|
||||
<p class="error pad">{detailError}</p>
|
||||
{:else if loaded && selectedId === null && calls.length > 0}
|
||||
@@ -574,4 +666,40 @@
|
||||
background: var(--rec-soft);
|
||||
color: var(--rec);
|
||||
}
|
||||
|
||||
.dialog-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(29, 35, 48, 0.4);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.dialog {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 12px 32px rgba(29, 35, 48, 0.25);
|
||||
padding: 20px;
|
||||
width: min(420px, calc(100vw - 32px));
|
||||
}
|
||||
|
||||
.dialog-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
.dialog p {
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
.dialog-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -71,6 +71,24 @@
|
||||
let installProgress = $state<UpdateProgress | null>(null)
|
||||
let installError = $state('')
|
||||
|
||||
/** The version to show as "available", if any. On Windows this comes
|
||||
* from `pendingUpdate` (kept in sync with the banner by `get_update`/
|
||||
* `update-available`, so it is current even without a manual check).
|
||||
* Everywhere else the backend never stores `pendingUpdate` for a found
|
||||
* update (see `updater::check_outcome`), so a manual check's own result
|
||||
* is the only source. It is also the fallback whenever `pendingUpdate`
|
||||
* is not known (e.g. the follow-up `getUpdate()` failed, or
|
||||
* `canSelfUpdate()` failed): a found update is never hidden. */
|
||||
let availableVersion = $derived(
|
||||
(selfUpdateCapable === true ? pendingUpdate?.version : undefined) ??
|
||||
(checkResult?.status === 'available' ? checkResult.version : undefined),
|
||||
)
|
||||
/** Whether the install button/progress can be offered for
|
||||
* `availableVersion`: only once this build is confirmed able to
|
||||
* self-update AND `pendingUpdate` (with its `can_install` guard) is
|
||||
* actually known. */
|
||||
let canOfferInstall = $derived(selfUpdateCapable === true && pendingUpdate !== null)
|
||||
|
||||
onMount(() => {
|
||||
load()
|
||||
backendServer()
|
||||
@@ -97,20 +115,22 @@
|
||||
|
||||
/** "Nach Updates suchen": runs the same check as the background loop,
|
||||
* immediately. An available update also arrives via `update-available`
|
||||
* (so the main window's banner shows it too), but is applied here as
|
||||
* well in case that event is missed. */
|
||||
* (so the main window's banner shows it too, on Windows), but is applied
|
||||
* here as well in case that event is missed. That follow-up fetch is
|
||||
* best-effort: if it fails, the "available" result just found still
|
||||
* stands — it must never be replaced by that unrelated failure. */
|
||||
async function checkUpdateNow() {
|
||||
checking = true
|
||||
checkResult = null
|
||||
try {
|
||||
const result = await checkForUpdateNow()
|
||||
checkResult = result
|
||||
if (result.status === 'available') pendingUpdate = await getUpdate()
|
||||
checkResult = await checkForUpdateNow()
|
||||
} catch (err) {
|
||||
checkResult = { status: 'error', message: errorText(err) }
|
||||
} finally {
|
||||
checking = false
|
||||
return
|
||||
}
|
||||
if (checkResult.status === 'available') await refreshPendingUpdate()
|
||||
checking = false
|
||||
}
|
||||
|
||||
async function refreshPendingUpdate() {
|
||||
@@ -470,24 +490,30 @@
|
||||
<span class="error">{checkResult.message}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{#if pendingUpdate && selfUpdateCapable !== null}
|
||||
{#if availableVersion !== undefined}
|
||||
<div class="update-available">
|
||||
<span>Update verfügbar (v{pendingUpdate.version})</span>
|
||||
{#if selfUpdateCapable}
|
||||
<span>Update verfügbar (v{availableVersion})</span>
|
||||
{#if canOfferInstall}
|
||||
{#if installing}
|
||||
<span>{updateProgressText(installProgress)}</span>
|
||||
{:else}
|
||||
<button class="btn primary small" disabled={!pendingUpdate.can_install} onclick={installUpdateNow}>
|
||||
<button
|
||||
class="btn primary small"
|
||||
disabled={!pendingUpdate?.can_install}
|
||||
onclick={installUpdateNow}
|
||||
>
|
||||
Installieren & neu starten
|
||||
</button>
|
||||
{#if !pendingUpdate.can_install}
|
||||
{#if !pendingUpdate?.can_install}
|
||||
<span class="muted">{UPDATE_BUSY_HINT}</span>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if installError}
|
||||
<span class="error">{installError}</span>
|
||||
{/if}
|
||||
{:else}
|
||||
{:else if selfUpdateCapable !== true}
|
||||
<!-- Not able to self-update, or unknown (`canSelfUpdate()`
|
||||
failed): never an install button, just the hint. -->
|
||||
<span class="muted">
|
||||
Updates gibt es unter Windows automatisch; unter Linux bitte das .deb neu installieren.
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user