mirror of
https://github.com/NotAShelf/stash.git
synced 2026-04-23 18:35:04 +00:00
various: validate lower and upper boundaries before storing; add CLI flags
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I6484f9579a8799d952b15adcb47c8eec6a6a6964
This commit is contained in:
parent
02ba05dc95
commit
3a14860ae1
4 changed files with 68 additions and 33 deletions
|
|
@ -2,6 +2,7 @@ use std::io::Read;
|
|||
|
||||
use crate::db::{ClipboardDb, SqliteClipboardDb};
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub trait StoreCommand {
|
||||
fn store(
|
||||
&self,
|
||||
|
|
@ -10,6 +11,8 @@ pub trait StoreCommand {
|
|||
max_items: u64,
|
||||
state: Option<String>,
|
||||
excluded_apps: &[String],
|
||||
min_size: Option<usize>,
|
||||
max_size: usize,
|
||||
) -> Result<(), crate::db::StashError>;
|
||||
}
|
||||
|
||||
|
|
@ -21,6 +24,8 @@ impl StoreCommand for SqliteClipboardDb {
|
|||
max_items: u64,
|
||||
state: Option<String>,
|
||||
excluded_apps: &[String],
|
||||
min_size: Option<usize>,
|
||||
max_size: usize,
|
||||
) -> Result<(), crate::db::StashError> {
|
||||
if let Some("sensitive" | "clear") = state.as_deref() {
|
||||
self.delete_last()?;
|
||||
|
|
@ -31,6 +36,8 @@ impl StoreCommand for SqliteClipboardDb {
|
|||
max_dedupe_search,
|
||||
max_items,
|
||||
Some(excluded_apps),
|
||||
min_size,
|
||||
max_size,
|
||||
)?;
|
||||
log::info!("Entry stored");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue