~aleteoryx/lfm_embed

4424fb9b44c893dc937dc5077be7ef819680ea2c — alyx 8 months ago 27bd2e5
clippy
3 files changed, 5 insertions(+), 5 deletions(-)

M src/cache/user.rs
M src/config.rs
M src/ctx.rs
M src/cache/user.rs => src/cache/user.rs +1 -0
@@ 10,6 10,7 @@ use super::{CacheFuture, CacheGetter, Cache, AsyncCache};
use crate::deserialize::{User, Track, TrackStub};
use crate::CONFIG;

pub type UserInfo = Arc<(User, Track, TrackStub)>;
type UserFuture = CacheFuture<Arc<(User, Track, TrackStub)>>;
type UserGetter = CacheGetter<Arc<(User, Track, TrackStub)>>;
type UserCache  = Cache<Arc<(User, Track, TrackStub)>>;

M src/config.rs => src/config.rs +2 -2
@@ 50,8 50,8 @@ impl Config {

      allowlist: var("LFME_WHITELIST").or_else(|_| var("LFME_ALLOWLIST")).ok().map(|w| w.split(',').map(|s| s.trim().to_string()).collect()).unwrap_or_default(),
      allowlist_mode: var("LFME_WHITELIST_MODE").or_else(|_| var("LFME_ALLOWLIST_MODE")).map(|m| m.to_ascii_lowercase()).unwrap_or_else(|_| "open".into()),
      default_refresh: default_refresh,
      allowlist_refresh: allowlist_refresh
      default_refresh,
      allowlist_refresh
    })
  }


M src/ctx.rs => src/ctx.rs +2 -3
@@ 1,10 1,9 @@
// SPDX-License-Identifier: AGPL-3.0-only
use std::sync::Arc;
use std::collections::BTreeMap;

use reqwest::StatusCode;

use super::deserialize as de;
use super::cache::user::UserInfo;
use super::config::CONFIG;
use crate::cache::font::FontQuery;



@@ 107,7 106,7 @@ pub mod model {
}
pub use model::Root as Ctx;

pub async fn get_ctx(api_result: Result<Arc<(de::User, de::Track, de::TrackStub)>, (StatusCode, &'static str)>, font_query: Option<FontQuery>, query: BTreeMap<String, String>) -> (Ctx, StatusCode) {
pub async fn get_ctx(api_result: Result<UserInfo, (StatusCode, &'static str)>, font_query: Option<FontQuery>, query: BTreeMap<String, String>) -> (Ctx, StatusCode) {
  match api_result {
    Ok(a) => {
      let (user, track, trackstub) = a.as_ref();