|
@@ -1,4 +1,4 @@
|
1
|
|
-use chrono::NaiveDateTime;
|
|
1
|
+use chrono::{Local, NaiveDateTime};
|
2
|
2
|
use crypto::digest::Digest;
|
3
|
3
|
use crypto::sha2::Sha256;
|
4
|
4
|
use diesel::pg::PgConnection as PGC;
|
|
@@ -60,8 +60,12 @@ fn format_snippet(filetype: Option<String>, body: String) -> String {
|
60
|
60
|
}
|
61
|
61
|
|
62
|
62
|
fn generate_uuid(snippet: &ApiSnippet) -> String {
|
|
63
|
+ let current_timestamp = Local::now().to_string();
|
63
|
64
|
let mut hasher = Sha256::new();
|
64
|
|
- hasher.input_str(&format!("{}{}", snippet.title, snippet.body));
|
|
65
|
+ hasher.input_str(&format!(
|
|
66
|
+ "{}{}{}",
|
|
67
|
+ snippet.title, snippet.body, current_timestamp
|
|
68
|
+ ));
|
65
|
69
|
hasher.result_str().to_string()
|
66
|
70
|
}
|
67
|
71
|
|