diff --git a/src/auth.rs b/src/auth.rs index c184b5b..dfc8865 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -58,7 +58,7 @@ impl AuthCommand { if keys.hosts.get(&user).is_none() { keys.hosts.insert( host, - crate::keys::LoginInfo::Token { + crate::keys::LoginInfo::Application { name: user, token: key, }, diff --git a/src/keys.rs b/src/keys.rs index 90ac0dd..33ac02e 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -67,7 +67,7 @@ impl KeyInfo { #[derive(serde::Serialize, serde::Deserialize, Clone)] #[serde(tag = "type")] pub enum LoginInfo { - Token { + Application { name: String, token: String, }, @@ -82,14 +82,14 @@ pub enum LoginInfo { impl LoginInfo { pub fn username(&self) -> &str { match self { - LoginInfo::Token { name, .. } => name, + LoginInfo::Application { name, .. } => name, LoginInfo::OAuth { name, .. } => name, } } pub async fn api_for(&mut self, url: &Url) -> eyre::Result { match self { - LoginInfo::Token { token, .. } => { + LoginInfo::Application { token, .. } => { let api = forgejo_api::Forgejo::new(forgejo_api::Auth::Token(token), url.clone())?; Ok(api) }