Trilium: Extending trilium

Created on 17 Jan 2019  路  12Comments  路  Source: zadam/trilium

Trilium is inspiring, but frustrating. I love the book review and weight tracker ideas. I want to extend those, perhaps to add movie reviews, or track walking or other things. Normally I'd just copy them out of the demo and alter a few things, but so far all I can do is clone, which I want to not do in this case.

The only other alternative seems to be crafting some new module by hand. Unfortunately I'm a hack, not a javascript programmer.

Am I missing an easy way to do this?

Most helpful comment

@zadam if we had a way to view the tree as json (maybe a local window variable on startup, pulled from fancytree), that would be amazing for something like this.

@dixonge lucky for you I'm a JS dev who is currently working on plugins for Trilium. :) I'll see what I can do. When you say track walking, do you mean how much? The weight tracker uses chartjs which has pretty good docs if you want to try your hand at modifying a copy of weight tracker.


For now, I'll make my own tree2json with some js and DOM parsing, so that something like this can be attempted

All 12 comments

There's no in-app way to really duplicate a note sub tree, but if I wanted to do that I would export that subtree to .tar file and then import it where I want the duplicate ...

Having said that - if you just want to experiment and play with the demo - you can. The demo are just notes and you can do whatever you want with them - you can pull them out of "Trilium Demo" subtree by drag & drop etc.

I was more interested in creating my own templates, but I don't even see how to edit an existing one.

@zadam if we had a way to view the tree as json (maybe a local window variable on startup, pulled from fancytree), that would be amazing for something like this.

@dixonge lucky for you I'm a JS dev who is currently working on plugins for Trilium. :) I'll see what I can do. When you say track walking, do you mean how much? The weight tracker uses chartjs which has pretty good docs if you want to try your hand at modifying a copy of weight tracker.


For now, I'll make my own tree2json with some js and DOM parsing, so that something like this can be attempted

The whole tree is usually not even loaded (mainly for scalability reasons) so JSON representation is not possible.

But have you seen the frontend and backend APIs? The entities you get from them provide easy access to the whole tree so you can do stuff like:

const rootNote = await api.getNote('root');

for (const childNote of await rootNote.getChildNotes()) {
    await childNote.getChildNotes() ....
}

This way you can "walk" the tree as you wish ...

sweeet! I'll play with it today.

@dixonge lucky for you I'm a JS dev who is currently working on plugins for Trilium. :) I'll see what I can do. When you say track walking, do you mean how much? The weight tracker uses chartjs which has pretty good docs if you want to try your hand at modifying a copy of weight tracker.

For now, I'll make my own tree2json with some js and DOM parsing, so that something like this can be attempted

Yes, track walking (or any similar thing). I already tried copying/modifying the weight tracker, but quickly hit a roadblock. I've decided to use something besides trilium for tracking. I have no desire to learn javascript.

I am a bit confused about the APIs.. what exactly is the conceptual difference between the backend and frontend APIs? And how do I authenticated against them from my client?

Trilium is a web application (which can be wrapped in the electron build) so there is a frontend running in the browser (or electron renderer process) and backend running on the server (or node process in electron). When you call backend script from frontend script then the authentication is transparent.

I'm not sure what your client is, if it's external component then you might want to use custom request which also briefly discusses authentication.

Custom Requests look much more like what I was looking for. I want to create an xbrowsersync compatible REST API (it looks like this: https://api.xbrowsersync.org) so I can have my bookmark syncs in trilium.

Is there some collections of custom requests other users created and shared? I can imagine more usecases than mine..

I do wonder how easy it would be to make a caldav/webdav integration as well...

Yeah, I think custom requests is a way to go for your bookmark sync.

So far there isn't any collection, I don't think many users use this feature anyway ...

Not sure about the webdav/caldav since those are HTTP extensions and custom requests currently work with standard HTTP only.

Well, I'll happily share my result if there is any interest.
My dream is that all the Apps I use pipe back into one common backend that has all the data..
eg:

  • Email
  • task list / todo list app (using webdav currently)
  • calendar app
  • bookmarks

Email will probably be the hardest

I'm definitely interested in your efforts. Your goals are ambitious so they will probably push the limits ...

BTW, this is an old issue so I'll close it. Please open a new issue in case you have more questions/comments.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gerroon picture gerroon  路  5Comments

wwalc picture wwalc  路  3Comments

sambbaron picture sambbaron  路  3Comments

gerroon picture gerroon  路  6Comments

The-Inamati picture The-Inamati  路  3Comments