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="Cache" />
<Block label="LRCLib" /> <Block label="LRCLib" />
<Block label="Genius" /> <Block label="Genius" />
<Block label="Failed" />
</Container> </Container>
); );
} }
var failed = data.failed;
var failed_class = "";
if (data.failed > 0) {
failed_class = "redfail";
}
return ( return (
<Container service={service}> <Container service={service}>
<Block label="Cache" value={t("common.number", { value: data.cache })} /> <Block label="Cache" value={t("common.number", { value: data.cache })} />
<Block label="LRCLib" value={t("common.number", { value: data.lrclib })} /> <Block label="LRCLib" value={t("common.number", { value: data.lrclib })} />
<Block label="Genius" value={t("common.number", { value: data.genius })} /> <Block label="Genius" value={t("common.number", { value: data.genius })} />
<Block label="Failed" value={<span class={ failed_class }>{ data.failed }</span>}/>
</Container> </Container>
); );
} }

View File

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

View File

@ -8,7 +8,7 @@ export default function Component({ service }) {
const { t } = useTranslation(); const { t } = useTranslation();
const { widget } = service; const { widget } = service;
const { data, error } = useWidgetAPI(widget, "widget", { const { data, error } = useWidgetAPI(widget, "widget", {
refreshInterval: 5000, refreshInterval: 2000,
}); });
if (error) { if (error) {
@ -25,7 +25,7 @@ export default function Component({ service }) {
return ( return (
<Container service={service}> <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 } /> <Block label="Now Playing" value={ data.now_playing } />
</Container> </Container>
); );

View File

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

View File

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

View File

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