feat: Update typegen enums and the UI
This commit is contained in:
23
src/main.rs
23
src/main.rs
@@ -1,12 +1,8 @@
|
||||
mod errors;
|
||||
mod ui;
|
||||
use api::{JellyfinClient, JellyfinConfig};
|
||||
use errors::*;
|
||||
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, SharedString, Window, WindowBounds, WindowOptions, div,
|
||||
prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
#[tokio::main]
|
||||
pub async fn main() -> Result<()> {
|
||||
dotenvy::dotenv()
|
||||
@@ -22,17 +18,12 @@ pub async fn main() -> Result<()> {
|
||||
"jello".to_string(),
|
||||
);
|
||||
let mut jellyfin = api::JellyfinClient::new(config);
|
||||
authenticate(&mut jellyfin).await?;
|
||||
jellyfin
|
||||
.authenticate_with_cached_token(".session")
|
||||
.await
|
||||
.change_context(Error)?;
|
||||
|
||||
ui::ui(jellyfin);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn authenticate(client: &mut JellyfinClient) -> Result<()> {
|
||||
if std::path::PathBuf::from(".session").exists() {
|
||||
client.load_token(".session").change_context(Error)?;
|
||||
} else {
|
||||
client.authenticate().await.change_context(Error)?;
|
||||
client.save_token(".session").change_context(Error)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user