bastienwirtz / homer

A very simple static homepage for your server.
https://homer-demo.netlify.app/
Apache License 2.0
9.35k stars 788 forks source link

Optional message #750

Open johnkmoore opened 9 months ago

johnkmoore commented 9 months ago

Describe the bug 1) The Optional message option is a great option I'd like to use. I can kind of get it to work with the example API (https://api.chucknorris.io/jokes/random) but I'm a big Simpson's fan and would like some Simpson's quotes (https://thesimpsonsquoteapi.glitch.me/quotes) but it doesn't seem to parse correctly. I tried with dad jokes as well (https://icanhazdadjoke.com/slack) 2) the refresInterval attribute doesn't seem to work either.

Expected behavior Using the YAML configuration below I'd expect to see a Simpson quotes every 10 seconds

Actual behavior Performs default behavior of displaying failover with specified title, icon and content

Logs & errors No Docker errors or Browser console errors. The difference I see in the APIs I'm trying to use is the both start and end with brackets [] Works:

{"categories":[],"created_at":"2020-01-05 13:42:22.089095","icon_url":"https://assets.chucknorris.host/img/avatar/chuck-norris.png","id":"yCqxDiEkRFaZuSibv79z_w","updated_at":"2020-01-05 13:42:22.089095","url":"https://api.chucknorris.io/jokes/yCqxDiEkRFaZuSibv79z_w","value":"Chuck Norris is the only person who can divide by 0."}

Doesn't work:

[{"quote":"Eat my shorts","character":"Bart Simpson","image":"https://cdn.glitch.com/3c3ffadc-3406-4440-bb95-d40ec8fcde72%2FBartSimpson.png?1497567511638","characterDirection":"Right"}]

{"attachments":[{"fallback":"Today, my son asked \"Can I have a book mark?\" and I burst into tears. 11 years old and he still doesn't know my name is Brian.","footer":"https://icanhazdadjoke.com/j/fii3Tv4hFd|permalink - https://icanhazdadjoke.com|icanhazdadjoke.com","text":"Today, my son asked \"Can I have a book mark?\" and I burst into tears. 11 years old and he still doesn't know my name is Brian."}],"response_type":"in_channel","username":"icanhazdadjoke"}

Configuration

message: url: https://thesimpsonsquoteapi.glitch.me/quotes mapping: title: 'character' content: 'quote'

ghost commented 7 months ago

Looking at the API responses.

Chuck Norris returns an object Dad Jokes, Simpsons return an array.

I’m trying to use Zenquotes at https://zenquotes.io/api/random/

which also returns an array, I suspect that’s the issue?