gTove icon indicating copy to clipboard operation
gTove copied to clipboard

[Feature Request] Local Files instead of Google Drive

Open sdsalyer opened this issue 4 years ago • 3 comments

Hi there... neat app you've created here. I'm not super familiar with node/js so I'm not sure how tightly integrated this thing is with the Google APIs ... but I'm wondering how much work it would be to use local file access in place of Google Drive (e.g. to run from my own server or intranet without need for internet/Google)? I might be willing to attempt to integrate it myself if it wouldn't be a ton of refactoring? Just thought I would reach out and see your thoughts.

Thanks for listening and keep up the good work!

sdsalyer avatar May 11 '20 14:05 sdsalyer

Thanks, @sdsalyer! A local filesystem mode for gTove shouldn't require a ton of refactoring, because the interactions with Google Drive are done through an interface, the FileAPI, in this file:

https://github.com/RobRendell/gTove/blob/master/src/util/fileUtils.ts

There are currently two implementations of FileAPI, the Google Drive one in https://github.com/RobRendell/gTove/blob/master/src/util/googleAPI.ts and the Offline one in https://github.com/RobRendell/gTove/blob/master/src/util/offlineAPI.ts which stores everything in memory.

It should be possible to add a new localFileAPI or expand the offlineAPI to use the HTML5 FileSystem API.

One thing that would need to be emulated is the fact that Google Drive files can have arbitrary metadata associated with them (user-defined properties), as well as the file contents themselves. A local file implementation would probably need to store a pair of files for each file, one with the file data and one with the metadata. That would all be done in whatever code implemented the FileAPI though.

If you wanted to work on this, I'd be happy to review and take a PR, or I could add it to the TODO list (but it might take a while to bubble to the top).

RobRendell avatar May 11 '20 21:05 RobRendell

Actually, one integration point with Drive that isn't captured by the FileAPI interface is the expectation that remote clients can access the tabletop data directly. A filesystem-only mode for gTove would allow the GM to save maps and minis and templates and create tabletops and scenarios, but wouldn't allow other people to connect to the tabletop (or rather, the could connect P2P if you're online, but wouldn't get the initial tabletop data or the map/mini images).

RobRendell avatar May 11 '20 22:05 RobRendell

You know, rather that faffing around with other API services, it would be far easier just to use WebDAV and be able to hook it up to Nextcloud. The advantage of that is you don't have to worry about file sharing permissions as they can all be built into Nextcloud also allowing restricted public access if needed. Plus, you could even have some automation apps on the server converting file formats for you and tagging it with metadata.

Anyway, it is late here, so I don't have time to look at the code, but depending on how wedded it is to gdrive it should be relatively straight forward to add other transports with standard open source libraries.

It is in interesting project to be sure.

develroo avatar Jul 05 '21 23:07 develroo