Skip to content

WebDAV backend (WIP)#117

Merged
marcelklehr merged 19 commits intofloccusaddon:developfrom
jlbprof:webdav
Jun 6, 2018
Merged

WebDAV backend (WIP)#117
marcelklehr merged 19 commits intofloccusaddon:developfrom
jlbprof:webdav

Conversation

@jlbprof
Copy link
Copy Markdown
Contributor

@jlbprof jlbprof commented Jun 2, 2018

No description provided.

jlbprof added 14 commits June 3, 2018 00:13
commit 8ca8033
Author: Julian Brown <julian@jlbprof.com>
Date:   Mon May 14 09:28:08 2018 -0500

    updated

commit 9d86efe
Author: Julian Brown <julian@jlbprof.com>
Date:   Wed May 9 19:46:56 2018 -0500

    I have the options working

commit 4452106
Author: Julian Brown <julian@jlbprof.com>
Date:   Wed May 9 19:06:17 2018 -0500

    Added renderOptions per Marcel

commit 32286bc
Author: Julian Brown <julian@jlbprof.com>
Date:   Tue May 8 18:17:33 2018 -0500

    Initial commit
    Copied Fake.js adapter to WebDav.js adapter.
    Started moving stuff around.
    Added webdavlib.js - we need to figure out how to satisfy license
    agreement, will deal with that later.
* Getting 503 on a webdav put, not sure why because I can use the exact
   GET and have it pull (using wget).
* will investigate the problem further
* I see no network activity and wonder if there is some restriction on
  it.
Things still to be done:

* Deal with locking of bookmarks file on webdav server
* Deal with converting to xbel format.
* Deal with highest ID and persistance of same
Add attempt at WebDav Lock, but it fails.
I am worried about the fact that I have to html encode the href
url's in the bookmark entities.

This may not reverse parse correctly.  Will investigate more tomorrow.
Here is where I am:

* I download the existing xbel file, parse it and create the bookmarks
in the map.

* I have not dealt with the tabs/spaces issue.

* please consider something like:
https://www.npmjs.com/package/js-beautify
to keep us to a coding style.

* This works except on the 2nd sync I get the following error:
Syncing failed with Trying to create a URL that is already bookmarked.
I do not know what I did wrong.

*This is still based on 2.2.3, after the last rebase causing merge
conflicts I wanted to leave that alonw.

*The parsing (and xml generation) code could just as easily work with
the bookmarks.html file that chrome and probably firefox already work
with. So we can either offer a checkbox for the appropriate format or
change to the html mechanism if we wanted to.

*further, when this gets more solid, we need to think of assigning
folders ids as well, they mean something in xbel and in html formats.
It will also help with bookmark ordering.
@marcelklehr marcelklehr changed the base branch from webdav to develop June 2, 2018 23:08
@marcelklehr marcelklehr changed the title fixed some await problems WebDAV backend (WIP) Jun 2, 2018
* fixed some minor issues.

* Still having problems with 2nd sync
@jlbprof
Copy link
Copy Markdown
Contributor Author

jlbprof commented Jun 3, 2018

Most of the changes are whitespace, I changed indents to 2 spaces.

I fixed the case where if it fails the lock would not be deleted.

I make sure that the db contains only bookmark objects.

Image of my developer tools console

In the test situation where this fails, I have a "test" folder on the bookmarks bar with one bookmark to duckduckgo. The image shows what my db contains. That is what would be returned from getBookmark. I do not know how to proceed to fix this. I have the "remoteId" set, but the "localId" is not set and do not know what to set that too. But in essence the remoteId and localId should be the same, and I even tried that but I keep getting the same error about the 2nd bookmark with the same url. And it is trying to create that 2nd copy of the url. I am going to need help debugging this, because this is probably a dance between your side and my side that is not going well.

When we get this fixed, I will work the "path" problem with slashes.

Thanx

Julian

PS. My editor (vim) does not handle the indents too well with the lack of semicolons. I will have to look for a newer syntax module for javascript for vim.

Comment thread src/lib/adapters/WebDav.js Outdated
}

async updateBookmark (remoteId, newBm) {
console.log('Update bookmark', newBM, remoteId, this.server)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This throws a newBM is not defined Error :)

@marcelklehr
Copy link
Copy Markdown
Member

Ah, I see the problem now. So, when floccus is syncing from scratch without any mappings available yet. It tries to create all bookmarks that are in the local sync folder on the server as well. The bookmarks app has the constraint that every URL may only appear once, so instead of creating a new bookmark it modifies the existing one and returns the existing ID. Floccus relies on this to initialize its mappings.

There are different ways forward from this. We can try to move the code that deals with the peculiarities of the bookmarks app into the Adapter and have floccus work on trees with folder ids and duplicate bookmarks instead of the flat hierarchy of the bookmarks app. Or we can mimick the bookmarks app with the WebDAV adapter and also prevent duplicates.

@TeutonJon78
Copy link
Copy Markdown

TeutonJon78 commented Jun 5, 2018

Seems a more robust way would be keep any backend specific stuff in an Adapter. That way, if you add more backends in the future, they have the solid core of floccus to build off, rather than having to adapt to the Bookmarks app conventions.

@jlbprof
Copy link
Copy Markdown
Contributor Author

jlbprof commented Jun 5, 2018 via email

@marcelklehr
Copy link
Copy Markdown
Member

@TeutonJon78 @jlbprof

My recommendation is that we redesign the adapter to be a "tree" style
adapter.

I agree that's probably the more sustainable option.

@jlbprof I've been working on a UI refactoring which I would like to merge before we refactor the Adapter interface in general, so we spare ourselves some rebasing :D So before that, I'd like to merge this PR as-is once you've fixed the last bits other than the problem I described; then I'll merge my UI refactoring, adjust your adapter code to work with the new UI framework; then we work out the details on how to revamp the adapter interface. Perhaps, while I do the UI stuff, you can already sketch an interface that would suit your adapter as a first draft, on a wiki page or in an issue.

@jlbprof
Copy link
Copy Markdown
Contributor Author

jlbprof commented Jun 5, 2018 via email

jlbprof added 2 commits June 6, 2018 17:16
* Fixed more whitespaces, sorry for the whitespace spam.
* Clean up of many console.log statements.
* Fixed bookmark id's being a string instead of an integer
  from the parsed xbel file.
@marcelklehr marcelklehr merged commit a3a9025 into floccusaddon:develop Jun 6, 2018
@jlbprof
Copy link
Copy Markdown
Contributor Author

jlbprof commented Jun 6, 2018 via email

@jlbprof
Copy link
Copy Markdown
Contributor Author

jlbprof commented Jun 7, 2018 via email

@marcelklehr
Copy link
Copy Markdown
Member

The syncComplete wouldn't necessarily need to be a tree, though, right? It could just be an array of operations with nodes referenced by id, no?

@jlbprof
Copy link
Copy Markdown
Contributor Author

jlbprof commented Jun 8, 2018 via email

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants