walterpg / google-drive-sync

A KeePass Password Safe v2 plugin for synchronizing passwords to Google Drive files.
GNU General Public License v3.0
198 stars 10 forks source link

GDrive File Scope implementation with file picker #51

Open Hoffs opened 3 years ago

Hoffs commented 3 years ago

As per #42 I finally got around trying to implement this. As per my testing everything more or less works and the file scope seems to work as expected, only giving files that were picked. Adding this bit to somewhere will print out only 1 or how many files were picked.

var available = service.Files.List();
available.Fields = "files(id,name)";
var result = await available.ExecuteAsync();
foreach (var item in result.Files)
{
    Log.Info("Got {0}/{1}", item.Id, item.Name);
}

Some difficult parts:

I don't expect this to be merged, a lot of parts are quite rough around the edges, data flow is a bit incorrect IMO at some parts, but it's a good POC that it's not that hard to use file scope. This should have no issues working with any other apps as long as they don't completely delete the file and upload new one in gdrive.

walterpg commented 3 years ago

Thanks for this. As discussed in #42, the proposed scheme faces significant challenges in a non-SAAS, open source platform project. But as you claim that it can be done, it should be seriously considered. When I get a chance I will look at the PR and I hope others interested in this will too.