You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-09-16 08:56:40 +02:00
Improved sync
This commit is contained in:
16
CliClient/package-lock.json
generated
16
CliClient/package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "joplin",
|
"name": "joplin",
|
||||||
"version": "0.10.55",
|
"version": "0.10.57",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -3892,7 +3892,7 @@
|
|||||||
"boom": "4.3.1",
|
"boom": "4.3.1",
|
||||||
"cryptiles": "3.1.2",
|
"cryptiles": "3.1.2",
|
||||||
"hoek": "4.2.0",
|
"hoek": "4.2.0",
|
||||||
"sntp": "2.0.2"
|
"sntp": "2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"hoek": {
|
"hoek": {
|
||||||
@@ -4896,9 +4896,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sntp": {
|
"sntp": {
|
||||||
"version": "2.0.2",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/sntp/-/sntp-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz",
|
||||||
"integrity": "sha1-UGQRDwr4X3z9t9a2ekACjOUrSys=",
|
"integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"hoek": "4.2.0"
|
"hoek": "4.2.0"
|
||||||
}
|
}
|
||||||
@@ -5771,9 +5771,9 @@
|
|||||||
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
|
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
|
||||||
},
|
},
|
||||||
"tkwidgets": {
|
"tkwidgets": {
|
||||||
"version": "0.5.14",
|
"version": "0.5.15",
|
||||||
"resolved": "https://registry.npmjs.org/tkwidgets/-/tkwidgets-0.5.14.tgz",
|
"resolved": "https://registry.npmjs.org/tkwidgets/-/tkwidgets-0.5.15.tgz",
|
||||||
"integrity": "sha512-VCb6phgm8X684mv3m3+Ylz06XwG3iNSuGgFUyxV+lcz8VU2ZTnXXeitsxCujY5t4EFL7n+Qob33+izt+S84YgA==",
|
"integrity": "sha512-fzxINXVK4f+Rp2fSkVoUVcF097sNQMqCrdCtiqj0Pel1aP1xU1+nQL4HGjqqrUHM30TsOQVyDu38/S70KPdsHg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"chalk": "2.3.0",
|
"chalk": "2.3.0",
|
||||||
"node-emoji": "git+https://github.com/laurent22/node-emoji.git#9fa01eac463e94dde1316ef8c53089eeef4973b5",
|
"node-emoji": "git+https://github.com/laurent22/node-emoji.git#9fa01eac463e94dde1316ef8c53089eeef4973b5",
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
],
|
],
|
||||||
"owner": "Laurent Cozic"
|
"owner": "Laurent Cozic"
|
||||||
},
|
},
|
||||||
"version": "0.10.55",
|
"version": "0.10.57",
|
||||||
"bin": {
|
"bin": {
|
||||||
"joplin": "./main.js"
|
"joplin": "./main.js"
|
||||||
},
|
},
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
"string-to-stream": "^1.1.0",
|
"string-to-stream": "^1.1.0",
|
||||||
"strip-ansi": "^4.0.0",
|
"strip-ansi": "^4.0.0",
|
||||||
"tcp-port-used": "^0.1.2",
|
"tcp-port-used": "^0.1.2",
|
||||||
"tkwidgets": "^0.5.3",
|
"tkwidgets": "^0.5.15",
|
||||||
"uuid": "^3.0.1",
|
"uuid": "^3.0.1",
|
||||||
"word-wrap": "^1.2.3",
|
"word-wrap": "^1.2.3",
|
||||||
"yargs-parser": "^7.0.0"
|
"yargs-parser": "^7.0.0"
|
||||||
|
@@ -79,6 +79,8 @@ class FileApiDriverLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async delta(path, options) {
|
async delta(path, options) {
|
||||||
|
const itemIds = await options.allItemIdsHandler();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let items = await fs.readdir(path);
|
let items = await fs.readdir(path);
|
||||||
let output = [];
|
let output = [];
|
||||||
@@ -89,11 +91,11 @@ class FileApiDriverLocal {
|
|||||||
output.push(stat);
|
output.push(stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Array.isArray(options.itemIds)) throw new Error('Delta API not supported - local IDs must be provided');
|
if (!Array.isArray(itemIds)) throw new Error('Delta API not supported - local IDs must be provided');
|
||||||
|
|
||||||
let deletedItems = [];
|
let deletedItems = [];
|
||||||
for (let i = 0; i < options.itemIds.length; i++) {
|
for (let i = 0; i < itemIds.length; i++) {
|
||||||
const itemId = options.itemIds[i];
|
const itemId = itemIds[i];
|
||||||
let found = false;
|
let found = false;
|
||||||
for (let j = 0; j < output.length; j++) {
|
for (let j = 0; j < output.length; j++) {
|
||||||
const item = output[j];
|
const item = output[j];
|
||||||
|
@@ -358,14 +358,15 @@ class Synchronizer {
|
|||||||
while (true) {
|
while (true) {
|
||||||
if (this.cancelling()) break;
|
if (this.cancelling()) break;
|
||||||
|
|
||||||
let allIds = null;
|
// let allIds = null;
|
||||||
if (!this.api().supportsDelta()) {
|
// if (!this.api().supportsDelta()) {
|
||||||
allIds = await BaseItem.syncedItemIds(syncTargetId);
|
// allIds = await BaseItem.syncedItemIds(syncTargetId);
|
||||||
}
|
// }
|
||||||
|
|
||||||
let listResult = await this.api().delta('', {
|
let listResult = await this.api().delta('', {
|
||||||
context: context,
|
context: context,
|
||||||
itemIds: allIds,
|
// itemIds: allIds,
|
||||||
|
allItemIdsHandler: async () => { return BaseItem.syncedItemIds(syncTargetId); }
|
||||||
});
|
});
|
||||||
|
|
||||||
let remotes = listResult.items;
|
let remotes = listResult.items;
|
||||||
|
Reference in New Issue
Block a user