Home / GitHub Page

Dashboard home page from Joplin

:bulb: Just wanted to have 1 page like a dashboard that get some important notes from Joplin through Joplin API.

  1. Dashboard UI using bootstrap css
  2. Code: HTML and Javascript shared on https://gist.github.com/ramisedhom/47eee0a3e4eb887f02c3730ed5b3c211

Still 4th block “On this day” is not implemented in the javascript file as I can’t filter notes on created_time. I’m trying to find a workaround, any advice?

Update: “On this day” block implemented in revision2.

2 Likes

You could maybe get all the notes, but retrieve only the created_time and id fields (use the fields query parameter), then do the filtering yourself in JavaScript.

I don’t think it should be very slow even with thousands of notes, and of course you can cache the result for 24 hours.

Thanks for the advice, yea, from Joplin it’s okay, the complex part is filtering JSON with such complex dates :slight_smile:

btw @laurent, is there a way to add body_html in the GET api?

I think pseudo code of the logic will look like following:

Get all notes {fields: id,title,created_item} from Joplin into `joplin_json`

Loop on Y in 20 years
  Get date (in unixtimestamp format) of today midnight - Y years 
  Get date (in unixtimestamp format) of tomorrow midnight - Y years 
  filter `joplin_json` on `created_time` between `today - Y` and `tomorrow - Y`
    if notes found, add to `On this day` array
end loop

List "On this day" array items

body_html is not present in the Joplin database, there’s only the Markdown text. In recent version, there’s a service that can export a note to an HTML document, and it wouldn’t be too complicated to expose this to this API but it hasn’t been done yet.

1 Like