rename LoginInfo::Token to Application

This commit is contained in:
Cyborus 2024-06-03 13:08:59 -04:00
parent 3ff6a86e8e
commit 349c6ad0d6
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View file

@ -58,7 +58,7 @@ impl AuthCommand {
if keys.hosts.get(&user).is_none() { if keys.hosts.get(&user).is_none() {
keys.hosts.insert( keys.hosts.insert(
host, host,
crate::keys::LoginInfo::Token { crate::keys::LoginInfo::Application {
name: user, name: user,
token: key, token: key,
}, },

View file

@ -67,7 +67,7 @@ impl KeyInfo {
#[derive(serde::Serialize, serde::Deserialize, Clone)] #[derive(serde::Serialize, serde::Deserialize, Clone)]
#[serde(tag = "type")] #[serde(tag = "type")]
pub enum LoginInfo { pub enum LoginInfo {
Token { Application {
name: String, name: String,
token: String, token: String,
}, },
@ -82,14 +82,14 @@ pub enum LoginInfo {
impl LoginInfo { impl LoginInfo {
pub fn username(&self) -> &str { pub fn username(&self) -> &str {
match self { match self {
LoginInfo::Token { name, .. } => name, LoginInfo::Application { name, .. } => name,
LoginInfo::OAuth { name, .. } => name, LoginInfo::OAuth { name, .. } => name,
} }
} }
pub async fn api_for(&mut self, url: &Url) -> eyre::Result<forgejo_api::Forgejo> { pub async fn api_for(&mut self, url: &Url) -> eyre::Result<forgejo_api::Forgejo> {
match self { match self {
LoginInfo::Token { token, .. } => { LoginInfo::Application { token, .. } => {
let api = forgejo_api::Forgejo::new(forgejo_api::Auth::Token(token), url.clone())?; let api = forgejo_api::Forgejo::new(forgejo_api::Auth::Token(token), url.clone())?;
Ok(api) Ok(api)
} }