Just wanted to have 1 page like a dashboard that get some important notes from Joplin through Joplin API.
- Dashboard UI using bootstrap css
- Code: HTML and Javascript shared on Dashboard home page from Joplin notes · GitHub
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.
3 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
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