This commit is contained in:
codey 2025-02-12 10:58:38 -05:00
parent a22fe38f7d
commit b18f134ca4
6 changed files with 21 additions and 6 deletions

View File

@ -21,15 +21,27 @@ export default function Component({ service }) {
<Block label="Cache" />
<Block label="LRCLib" />
<Block label="Genius" />
<Block label="Failed" />
</Container>
);
}
var failed = data.failed;
var failed_class = "";
if (data.failed > 0) {
failed_class = "redfail";
}
return (
<Container service={service}>
<Block label="Cache" value={t("common.number", { value: data.cache })} />
<Block label="LRCLib" value={t("common.number", { value: data.lrclib })} />
<Block label="Genius" value={t("common.number", { value: data.genius })} />
<Block label="Failed" value={<span class={ failed_class }>{ data.failed }</span>}/>
</Container>
);
}

View File

@ -6,7 +6,7 @@ const widget = {
mappings: {
"widget": {
endpoint: "widget/lyrics/",
endpoint: "widget/lyrics",
method: "GET",
headers: {
"Accept": "application/json",
@ -16,4 +16,7 @@ const widget = {
},
};
// test
export default widget;

View File

@ -8,7 +8,7 @@ export default function Component({ service }) {
const { t } = useTranslation();
const { widget } = service;
const { data, error } = useWidgetAPI(widget, "widget", {
refreshInterval: 5000,
refreshInterval: 2000,
});
if (error) {
@ -25,7 +25,7 @@ export default function Component({ service }) {
return (
<Container service={service}>
<img src={`https://codey.lol/images/radio_art.jpg?${Date.now()}`} height={85} width={85}></img>
<img src={`https://api.codey.lol/radio/album_art?${Date.now()}`} height={85} width={85}></img>
<Block label="Now Playing" value={ data.now_playing } />
</Container>
);

View File

@ -6,7 +6,7 @@ const widget = {
mappings: {
"widget": {
endpoint: "widget/radio/",
endpoint: "widget/radio",
method: "GET",
headers: {
"Accept": "application/json",

View File

@ -6,7 +6,7 @@ const widget = {
mappings: {
"widget": {
endpoint: "widget/redis/",
endpoint: "widget/redis",
method: "GET",
headers: {
"Accept": "application/json",

View File

@ -6,7 +6,7 @@ const widget = {
mappings: {
"widget": {
endpoint: "widget/sqlite/",
endpoint: "widget/sqlite",
method: "GET",
headers: {
"Accept": "application/json",