Ressurect the extension by using newer API for getting databases #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@marten-de-vries
The chrome extension stopped working in chromium >=60 (it worked but getting databases was not working, which made the extension not really useful).
This happenned because of the use of a deprecated API.
However since ~2018, a new API solving the original issue is now widely supported.
This PR make use of the new API and should work, I have tested it locally successfully.
I hope the original developpers can take a look at this.
minor notes:
I couldn't find documentation for the return type of the old API but anyway: The new API natively return a promise so wrapping it is no longer needed.
Moreover, it return a dictionnary containing db name and version. Hence I use a map to only return (filter) a vector of names, matching old behaviour.
update:
I can get the right node/npm version by using:
nvm install v0.10.10
nvm use v0.10.10
but now after downloading dependencies, I get an npm error:
(I have npm version 1.2.25 set by nvm)
update:
hmm apparently HTTPS can be bypassed:
https://stackoverflow.com/a/22526046/12607379
by setting
npm config set strict-ssl false
there is only one remaining error:
so I removed any ^ charachter found in package.json (unsure how correct is that "fix"..)
and I had to remove ~ from the package async.
and this cause more dependency errors...
I don't know how to fix the dependencies, the build should be reproducible but it isn't even when removing version ranges.
There is a version of the extension online:
https://ma.rtendevri.es/fauxton/
I have no idea how to build the project, maybe that I don't have the exactly right node and npm version, if so what are them??
to be clear the issue is in building fauxton-base
update:
I did fix the dependencies by updating them all and switching back to recent node/npm and deleting phantomjs dependency (what was it used for?)
however I now have a runtime error
I "fixed" it by deleting the app addong test folder.
then I have an ultime issue:
In the gruntfile I have added force
less: {
compile: {
options: {
paths: assets.less.paths,
force: true
},
but this does not seems to enable the force flag..
I have no experience in grunt.
so I went to the less files and fixed the issues found (invalid characters)
new less issue:
hmm there is many annoying less errors and downgrading to the oldest allowed less version do not remove them all, and I can't use the same version than the original one because of grunt dependency.
hmm so I downgraded to the original grunt versions and now there are no less errors.
jshint fail so I removed all jshint tasks (optional passe anyway?)
AND MIRACULOUSLY, THE PROJECT BUILD
then I build fauxton-logic and fauxton-chrome without issues, enabling me to load the resuting extension in chrome.
then on my project which use PouchDB the extension says:
To use the current page with PouchDB-Fauxton, window.PouchDB needs to be set.
so I did
const localPouch = new PouchDB("dbName");
// @ts-ignore
window.PouchDB = localPouch;
now the extension show its UI!
unfortunately no database are shown
is that setting correct?
my bad, the correct fix was:
window.PouchDB = PouchDB;
OMG IT WORKS WELL!
I will publish a separate PR fixing the fauxton-base build later.