Skip to content

Commit bf7ac56

Browse files
authored
Prompt for database save if user modifies HOTP counter (#494)
2 parents dbb04c2 + d542a11 commit bf7ac56

File tree

5 files changed

+17
-19
lines changed

5 files changed

+17
-19
lines changed

Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ debug = false
2727
strip = "symbols"
2828

2929
[dependencies]
30-
serde_json = "1.0.127"
31-
serde = { version = "1.0.209", features = ["derive"] }
30+
serde_json = "1.0.128"
31+
serde = { version = "1.0.210", features = ["derive"] }
3232
dirs = "5.0.1"
3333
rpassword = "7.3.1"
3434
data-encoding = "2.6.0"
3535
copypasta-ext = "0.4.4"
3636
zeroize = { version = "1.8.1", features = ["zeroize_derive"] }
37-
clap = { version = "4.5.16", features = ["derive"] }
37+
clap = { version = "4.5.17", features = ["derive"] }
3838
hmac = "0.12.1"
3939
sha1 = "0.10.6"
4040
sha2 = "0.10.8"

src/interface/handlers/main_window.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ fn handle_counter_switch(app: &mut App, increment: bool) {
137137
} else {
138138
Some(counter.saturating_sub(1))
139139
};
140+
app.database.mark_modified();
140141
app.tick(true);
141142
}
142143
}

src/otp/migrations/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
use super::otp_element::OTPDatabase;
2-
3-
pub struct Migration<'a> {
2+
struct Migration<'a> {
43
to_version: u16, // Database version which we are migrating on
54
migration_function: &'a dyn Fn(&mut OTPDatabase) -> color_eyre::Result<()>, // Function to execute the migration
65
}
7-
8-
pub const MIGRATIONS_LIST: [Migration; 1] = [Migration {
6+
const MIGRATIONS_LIST: [Migration; 1] = [Migration {
97
to_version: 2,
108
migration_function: &migrate_to_2,
119
}];

src/path.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn get_default_db_path() -> PathBuf {
3939
data_dir()
4040
.map(PathBuf::from)
4141
.map(|p| p.join(XDG_PATH))
42-
.map(|xdg| {
42+
.inspect(|xdg| {
4343
if !xdg.exists() {
4444
if let Some(home) = &home_path {
4545
if home.exists() {
@@ -49,7 +49,6 @@ fn get_default_db_path() -> PathBuf {
4949
}
5050
}
5151
}
52-
xdg
5352
})
5453
.or(home_path)
5554
.unwrap_or(portable_path)

0 commit comments

Comments
 (0)