braindump: Node.js interface to create kio slaves? (perhaps for gsoc 2015?)

Mark Gaiser markg85 at
Sun Aug 31 16:02:21 UTC 2014


disclaimer: this is just an idea that might be nice to have in the
future. I don't want to make this, i merely had the idea which i want
to put out in the open. Perhaps this can evolve into a nice gsoc
project for 2015?

A few days ago i thought: "hmm, i would like to access my google drive
from dolphin. Can i do that?". Turns out it's not possible yet
although Dan Vratil is working on that [1].

When looking through the code i noticed that it's quite a lot code.
For instance, you have to do account management, oauth2 authentication
and then mapping the relevant cloud storage api calls to stuff that
KIO can handle like listDir and stat among others.

I think defining a minimal KIO SlaveBase interface for node.js isn't
overly complicated. It will take quite a bit of time, but that's only
a one time job for making the right data structures/objects available
in node.js/javascript. Once that's done it can be re-used for every
cloud storage provider that has a public API.

Why node.js? Most API's for cloud storage (google drive, dropbox,
etc..) are very much tailored towards REST url's and json body's. It
all possible to do that in C++/Qt, but javascript does make this a lot
easier to write. It also lowers the barrier for making a cloud storage
implementation. Right now there is a fairly steep learning curve for
making a kio slave. If that curve could be lowered significantly
(which it can with javascript) then it becomes possible for people to
contribute who can't right now due to the steep learning curve or
perhaps even no knowledge of C++/Qt. It would be a win-win for
everyone. I picked node.js specifically because you run it as a system
service just like any other service and because it has all the
fundamentals needed to make something like this a reality. It has
oauth2 available through (and a gazillion other libs). That
allows for easy and fast prototyping.

The area where i see difficulties is account management. We need to
have some central place - on the users computer - where accounts are
managed. Àlex Fiestas has created WebAccounts [2] in recent years. It
looks great and probably needs minor adjustments to handle cloud
storage accounts (or it can do that already?). But even then, it's
still a playground project. It's not shipped with KDE 4.xx or Plasma
5.xx. Once WebAccounts lands in KDE/Plasma then other apps (like
dolphin for example) should probably ask WebAccounts: "Hey, do you
have more cloud storage locations for me?". WebAccounts should then
create the connections and add the available kio "cloud" slaves which
would then pop up in the places menu.

That's where we probably hit another challenge. WebAccounts should
instruct google drive (and dropbox for the sake of this example) to
register the new available protocols. Lets say gdrive:// and
dropbox://. Once the protocols become available (thus the connection
is OK) then those cloud drives should pop up in Dolphin's places menu.
Or more specifically, in KFilePlacesModel. It's easy to say this, but
i don't know if the code paths even exist to do such a thing? I kinda
fear it doesn't exist.

What's your opinion about this?
Would this be a nice project for the 2015 edition of GSoC?



More information about the Kde-frameworks-devel mailing list