1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-26 18:58:21 +02:00

Clipper: Upgraded clipper to support API pagination

This version of the clipper will support both new and old Joplin
clients, so as to ease the transition.
This commit is contained in:
Laurent Cozic 2020-10-27 00:37:22 +00:00
parent 6a068a90b2
commit 0ec3d6ca9d
3 changed files with 8 additions and 4 deletions

View File

@ -55,7 +55,7 @@
}, },
"scripts": { "scripts": {
"start": "node scripts/start.js", "start": "node scripts/start.js",
"build": "SKIP_PREFLIGHT_CHECK=true node scripts/build.js", "build": "node scripts/build.js SKIP_PREFLIGHT_CHECK",
"test": "node scripts/test.js --env=jsdom", "test": "node scripts/test.js --env=jsdom",
"watch": "cra-build-watch", "watch": "cra-build-watch",
"postinstall": "node postinstall.js && npm run build" "postinstall": "node postinstall.js && npm run build"

View File

@ -1,5 +1,9 @@
'use strict'; 'use strict';
if (process.argv && process.argv.indexOf('SKIP_PREFLIGHT_CHECK') >= 0) {
process.env.SKIP_PREFLIGHT_CHECK = 'true';
}
// Do this as the first thing so that any code reading it knows the right env. // Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'production'; process.env.BABEL_ENV = 'production';
process.env.NODE_ENV = 'production'; process.env.NODE_ENV = 'production';

View File

@ -148,10 +148,10 @@ class Bridge {
this.dispatch({ type: 'CLIPPER_SERVER_SET', foundState: 'found', port: state.port }); this.dispatch({ type: 'CLIPPER_SERVER_SET', foundState: 'found', port: state.port });
const folders = await this.folderTree(); const folders = await this.folderTree();
this.dispatch({ type: 'FOLDERS_SET', folders: folders }); this.dispatch({ type: 'FOLDERS_SET', folders: folders.items ? folders.items : folders });
const tags = await this.clipperApiExec('GET', 'tags'); const tags = await this.clipperApiExec('GET', 'tags');
this.dispatch({ type: 'TAGS_SET', tags: tags }); this.dispatch({ type: 'TAGS_SET', tags: tags.items ? tags.items : tags });
bridge().restoreState(); bridge().restoreState();
return; return;
@ -245,7 +245,7 @@ class Bridge {
} }
async folderTree() { async folderTree() {
return this.clipperApiExec('GET', 'folders'); return this.clipperApiExec('GET', 'folders', { as_tree: 1 });
} }
async storageSet(keys) { async storageSet(keys) {