feat: v1.4.2, add latest user agent in meta
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1700,7 +1700,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tiny-encrypt"
|
name = "tiny-encrypt"
|
||||||
version = "1.4.1"
|
version = "1.4.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm-stream",
|
"aes-gcm-stream",
|
||||||
"base64",
|
"base64",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tiny-encrypt"
|
name = "tiny-encrypt"
|
||||||
version = "1.4.1"
|
version = "1.4.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
description = "A simple and tiny file encrypt tool"
|
description = "A simple and tiny file encrypt tool"
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ pub fn decrypt_single(config: &Option<TinyEncryptConfig>,
|
|||||||
success!("Temp file is changed, save file ...");
|
success!("Temp file is changed, save file ...");
|
||||||
drop(file_in);
|
drop(file_in);
|
||||||
let mut meta = meta;
|
let mut meta = meta;
|
||||||
|
meta.latest_user_agent = Some(util::get_user_agent());
|
||||||
meta.file_length = temp_file_content.len() as u64;
|
meta.file_length = temp_file_content.len() as u64;
|
||||||
meta.file_last_modified = util_time::get_current_millis() as u64;
|
meta.file_last_modified = util_time::get_current_millis() as u64;
|
||||||
match &mut meta.file_edit_count {
|
match &mut meta.file_edit_count {
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ pub fn info_single(path: &PathBuf, cmd_info: &CmdInfo) -> XResult<()> {
|
|||||||
infos.push(format!("{}: Version: {}, Agent: {}",
|
infos.push(format!("{}: Version: {}, Agent: {}",
|
||||||
header("File summary"), meta.version, meta.user_agent)
|
header("File summary"), meta.version, meta.user_agent)
|
||||||
);
|
);
|
||||||
|
if let Some(latest_user_agent) = meta.latest_user_agent {
|
||||||
|
infos.push(format!("{}: {}", header("Latest user agent"), latest_user_agent))
|
||||||
|
}
|
||||||
|
|
||||||
let now_millis = util_time::get_current_millis() as u64;
|
let now_millis = util_time::get_current_millis() as u64;
|
||||||
let fmt = simpledateformat::fmt(DATE_TIME_FORMAT).unwrap();
|
let fmt = simpledateformat::fmt(DATE_TIME_FORMAT).unwrap();
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
|
use std::fs::Metadata;
|
||||||
|
|
||||||
use rust_util::{opt_result, util_time, XResult};
|
use rust_util::{opt_result, util_time, XResult};
|
||||||
use rust_util::util_time::get_millis;
|
use rust_util::util_time::get_millis;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::fs::Metadata;
|
|
||||||
|
|
||||||
use crate::{compress, crypto_simple};
|
use crate::{compress, crypto_simple};
|
||||||
use crate::consts::SALT_META;
|
use crate::consts::SALT_META;
|
||||||
@@ -19,6 +20,7 @@ pub struct TinyEncryptMeta {
|
|||||||
pub version: String,
|
pub version: String,
|
||||||
pub created: u64,
|
pub created: u64,
|
||||||
pub user_agent: String,
|
pub user_agent: String,
|
||||||
|
pub latest_user_agent: Option<String>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub comment: Option<String>,
|
pub comment: Option<String>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
@@ -170,6 +172,7 @@ impl TinyEncryptMeta {
|
|||||||
version: TINY_ENCRYPT_VERSION_11.to_string(),
|
version: TINY_ENCRYPT_VERSION_11.to_string(),
|
||||||
created: util_time::get_current_millis() as u64,
|
created: util_time::get_current_millis() as u64,
|
||||||
user_agent: get_user_agent(),
|
user_agent: get_user_agent(),
|
||||||
|
latest_user_agent: None,
|
||||||
comment: enc_metadata.comment.to_owned(),
|
comment: enc_metadata.comment.to_owned(),
|
||||||
encrypted_comment: enc_metadata.encrypted_comment.to_owned(),
|
encrypted_comment: enc_metadata.encrypted_comment.to_owned(),
|
||||||
encrypted_meta: enc_metadata.encrypted_meta.to_owned(),
|
encrypted_meta: enc_metadata.encrypted_meta.to_owned(),
|
||||||
|
|||||||
Reference in New Issue
Block a user