diff options
Diffstat (limited to 'crates/turtle/src/history')
| -rw-r--r-- | crates/turtle/src/history/builder.rs | 4 | ||||
| -rw-r--r-- | crates/turtle/src/history/mod.rs | 24 |
2 files changed, 4 insertions, 24 deletions
diff --git a/crates/turtle/src/history/builder.rs b/crates/turtle/src/history/builder.rs index 7eca0491..08d26f7f 100644 --- a/crates/turtle/src/history/builder.rs +++ b/crates/turtle/src/history/builder.rs @@ -68,8 +68,8 @@ impl From<HistoryDaemonCapture> for History { captured.cwd, -1, -1, - Some(captured.session), - Some(captured.hostname), + captured.session, + captured.hostname, captured.author, captured.intent, None, diff --git a/crates/turtle/src/history/mod.rs b/crates/turtle/src/history/mod.rs index 10e74d8e..27755bbe 100644 --- a/crates/turtle/src/history/mod.rs +++ b/crates/turtle/src/history/mod.rs @@ -30,22 +30,6 @@ impl From<String> for HistoryId { } } -pub(crate) fn get_hostname() -> String { - env::var("ATUIN_HOST_NAME") - .unwrap_or_else(|_| whoami::hostname().unwrap_or_else(|_| "unknown-host".to_string())) -} - -pub(crate) fn get_username() -> String { - env::var("ATUIN_HOST_USER") - .unwrap_or_else(|_| whoami::username().unwrap_or_else(|_| "unknown-user".to_string())) -} - -/// Returns a pair of the hostname and username, separated by a colon. -#[must_use] -pub fn get_host_user() -> String { - format!("{}:{}", get_hostname(), get_username()) -} - /// Client-side history entry. /// /// Client stores data unencrypted, and only encrypts it before sending to the server. @@ -123,16 +107,12 @@ impl History { cwd: String, exit: i64, duration: i64, - session: Option<String>, - hostname: Option<String>, + session: String, + hostname: String, author: Option<String>, intent: Option<String>, deleted_at: Option<OffsetDateTime>, ) -> Self { - let session = session - .or_else(|| env::var("ATUIN_SESSION").ok()) - .unwrap_or_else(|| uuid_v7().as_simple().to_string()); - let hostname = hostname.unwrap_or_else(get_host_user); let author = Self::normalize_optional_field(author) .or_else(|| Self::normalize_optional_field(env::var(HISTORY_AUTHOR_ENV).ok())) .unwrap_or_else(|| Self::author_from_hostname(hostname.as_str())); |
