aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--src/cache/user.rs2
-rw-r--r--src/ctx.rs4
-rw-r--r--src/deserialize.rs2
-rw-r--r--src/theming/hbs/plain.hbs2
5 files changed, 9 insertions, 6 deletions
diff --git a/README.md b/README.md
index 02c6c4a..5cb7b17 100644
--- a/README.md
+++ b/README.md
@@ -54,9 +54,12 @@ The following are the environment variables which `lfm_embed` understands.
## Core Config
-### `LMFE_API_KEY` (Required)
+### `LMFE_LASTFM_API_KEY` (Required)
Your last.fm API key. You'll need to create one [here](https://www.last.fm/api/account/create) for self-hosting.
+### `LMFE_GOOGLE_API_KEY`
+Your google API key. This is necessary for custom google fonts to work. You can create one [here](https://developers.google.com/fonts/docs/developer_api#APIKey), and you'll need some familiarity with the Google cloud API console
+
### `LFME_PORT` (Default: `9999`)
The port to serve on locally.
diff --git a/src/cache/user.rs b/src/cache/user.rs
index 8d6bf64..6d2d414 100644
--- a/src/cache/user.rs
+++ b/src/cache/user.rs
@@ -54,7 +54,7 @@ fn user_getter(username: &String) -> UserFuture {
if trackreq.status() == StatusCode::NOT_FOUND { return Err((StatusCode::NOT_FOUND, "Track does not exist!")); }
let trackstr = trackreq.text().await.unwrap();
- log::trace!("Got user.getTrackInfo JSON for `{username}`: {trackstr}");
+ log::trace!("Got track.getInfo JSON for `{username}`: {trackstr}");
let trackinfo = serde_json::from_str::<GetTrackInfo>(&trackstr)
.map_err(|e| {log::error!("Couldn't parse track.getInfo for `{}` by `{}` on behalf of {username}: {e}", trackstub.name, trackstub.artist.name); (StatusCode::INTERNAL_SERVER_ERROR, "Couldn't parse track.getInfo!")})?.track;
diff --git a/src/ctx.rs b/src/ctx.rs
index 3d14e4c..1b007ff 100644
--- a/src/ctx.rs
+++ b/src/ctx.rs
@@ -53,7 +53,7 @@ pub mod model {
/// The name of the track.
pub name: Arc<str>,
/// The name of its album.
- pub album: Arc<str>,
+ pub album: Option<Arc<str>>,
/// The artist who made it.
pub artist: Artist,
@@ -126,7 +126,7 @@ pub async fn get_ctx(api_result: Result<UserInfo, (StatusCode, &'static str)>, f
},
scrobble: model::Scrobble {
name: track.name.clone(),
- album: track.album.title.clone(),
+ album: track.album.as_ref().map(|a| a.title.clone()),
artist: model::Artist {
name: track.artist.name.clone(),
// image_url: track.artist.images.iter().max_by(|a, b| a.size.cmp(&b.size)).map(|a| a.url.clone()).unwrap_or_else(|| "".into()),
diff --git a/src/deserialize.rs b/src/deserialize.rs
index b1c4da8..0998cbd 100644
--- a/src/deserialize.rs
+++ b/src/deserialize.rs
@@ -106,7 +106,7 @@ pub struct Track {
#[serde(default)]
pub images: Vec<Image>,
pub mbid: Option<Arc<str>>,
- pub album: Album,
+ pub album: Option<Album>,
pub name: Arc<str>,
pub url: Arc<str>,
#[serde(deserialize_with = "str_num")]
diff --git a/src/theming/hbs/plain.hbs b/src/theming/hbs/plain.hbs
index b3c0abf..040a079 100644
--- a/src/theming/hbs/plain.hbs
+++ b/src/theming/hbs/plain.hbs
@@ -1,5 +1,5 @@
<!doctype html>
-<html lang="en" style="margin: 20px; overflow: hidden;">
+<html lang="en" style="margin: 4px; overflow: hidden;">
<head>
<meta charset="UTF-8"/>
<title>{{#if error}}Error!{{else}}@{{user.name}}'s Last.fm Stats{{/if}}</title>