mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-05-08 08:41:50 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0ffb0620e | ||
|
|
c88c939cd9 | ||
|
|
05b53eb2cf |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "obsidian-livesync",
|
"id": "obsidian-livesync",
|
||||||
"name": "Self-hosted LiveSync",
|
"name": "Self-hosted LiveSync",
|
||||||
"version": "0.13.0",
|
"version": "0.13.2",
|
||||||
"minAppVersion": "0.9.12",
|
"minAppVersion": "0.9.12",
|
||||||
"description": "Community implementation of self-hosted livesync. Reflect your vault changes to some other devices immediately. Please make sure to disable other synchronize solutions to avoid content corruption or duplication.",
|
"description": "Community implementation of self-hosted livesync. Reflect your vault changes to some other devices immediately. Please make sure to disable other synchronize solutions to avoid content corruption or duplication.",
|
||||||
"author": "vorotamoroz",
|
"author": "vorotamoroz",
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "obsidian-livesync",
|
"name": "obsidian-livesync",
|
||||||
"version": "0.13.0",
|
"version": "0.13.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "obsidian-livesync",
|
"name": "obsidian-livesync",
|
||||||
"version": "0.13.0",
|
"version": "0.13.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"diff-match-patch": "^1.0.5",
|
"diff-match-patch": "^1.0.5",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "obsidian-livesync",
|
"name": "obsidian-livesync",
|
||||||
"version": "0.13.0",
|
"version": "0.13.2",
|
||||||
"description": "Reflect your vault changes to some other devices immediately. Please make sure to disable other synchronize solutions to avoid content corruption or duplication.",
|
"description": "Reflect your vault changes to some other devices immediately. Please make sure to disable other synchronize solutions to avoid content corruption or duplication.",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -146,6 +146,17 @@ export class DocumentHistoryModal extends Modal {
|
|||||||
Logger(`Old content copied to clipboard`, LOG_LEVEL.NOTICE);
|
Logger(`Old content copied to clipboard`, LOG_LEVEL.NOTICE);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
async function focusFile(path: string) {
|
||||||
|
const targetFile = app.vault
|
||||||
|
.getFiles()
|
||||||
|
.find((f) => f.path === path);
|
||||||
|
if (targetFile) {
|
||||||
|
const leaf = app.workspace.getLeaf(false);
|
||||||
|
await leaf.openFile(targetFile);
|
||||||
|
} else {
|
||||||
|
Logger("The file cound not view on the editor", LOG_LEVEL.NOTICE)
|
||||||
|
}
|
||||||
|
}
|
||||||
buttons.createEl("button", { text: "Back to this revision" }, (e) => {
|
buttons.createEl("button", { text: "Back to this revision" }, (e) => {
|
||||||
e.addClass("mod-cta");
|
e.addClass("mod-cta");
|
||||||
e.addEventListener("click", async () => {
|
e.addEventListener("click", async () => {
|
||||||
@@ -155,9 +166,11 @@ export class DocumentHistoryModal extends Modal {
|
|||||||
}
|
}
|
||||||
if (this.currentDoc?.datatype == "plain") {
|
if (this.currentDoc?.datatype == "plain") {
|
||||||
await this.app.vault.adapter.write(pathToWrite, this.currentDoc.data);
|
await this.app.vault.adapter.write(pathToWrite, this.currentDoc.data);
|
||||||
|
await focusFile(pathToWrite);
|
||||||
this.close();
|
this.close();
|
||||||
} else if (this.currentDoc?.datatype == "newnote") {
|
} else if (this.currentDoc?.datatype == "newnote") {
|
||||||
await this.app.vault.adapter.writeBinary(pathToWrite, base64ToArrayBuffer(this.currentDoc.data));
|
await this.app.vault.adapter.writeBinary(pathToWrite, base64ToArrayBuffer(this.currentDoc.data));
|
||||||
|
await focusFile(pathToWrite);
|
||||||
this.close();
|
this.close();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|||||||
@@ -462,6 +462,7 @@ export class LocalPouchDB {
|
|||||||
} else {
|
} else {
|
||||||
obj = await this.localDatabase.get(id);
|
obj = await this.localDatabase.get(id);
|
||||||
}
|
}
|
||||||
|
const revDeletion = opt && (("rev" in opt ? opt.rev : "") != "");
|
||||||
|
|
||||||
if (obj.type && obj.type == "leaf") {
|
if (obj.type && obj.type == "leaf") {
|
||||||
//do nothing for leaf;
|
//do nothing for leaf;
|
||||||
@@ -479,11 +480,15 @@ export class LocalPouchDB {
|
|||||||
// simple note
|
// simple note
|
||||||
}
|
}
|
||||||
if (obj.type == "newnote" || obj.type == "plain") {
|
if (obj.type == "newnote" || obj.type == "plain") {
|
||||||
obj.deleted = true;
|
if (revDeletion) {
|
||||||
if (this.settings.deleteMetadataOfDeletedFiles) {
|
|
||||||
obj._deleted = true;
|
obj._deleted = true;
|
||||||
|
} else {
|
||||||
|
obj.deleted = true;
|
||||||
|
obj.mtime = Date.now();
|
||||||
|
if (this.settings.deleteMetadataOfDeletedFiles) {
|
||||||
|
obj._deleted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
obj.mtime = Date.now();
|
|
||||||
const r = await this.localDatabase.put(obj);
|
const r = await this.localDatabase.put(obj);
|
||||||
Logger(`entry removed:${obj._id}-${r.rev}`);
|
Logger(`entry removed:${obj._id}-${r.rev}`);
|
||||||
if (typeof this.corruptedEntries[obj._id] != "undefined") {
|
if (typeof this.corruptedEntries[obj._id] != "undefined") {
|
||||||
|
|||||||
@@ -821,7 +821,7 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
try {
|
try {
|
||||||
Logger(`file save ${file.path} into db`);
|
Logger(`file save ${file.path} into db`);
|
||||||
await this.updateIntoDB(file);
|
await this.updateIntoDB(file);
|
||||||
Logger(`deleted ${oldFile} into db`);
|
Logger(`deleted ${oldFile} from db`);
|
||||||
await this.deleteFromDBbyPath(oldFile);
|
await this.deleteFromDBbyPath(oldFile);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
Logger(ex);
|
Logger(ex);
|
||||||
|
|||||||
@@ -5,4 +5,8 @@
|
|||||||
- We can see the history of deleted files.
|
- We can see the history of deleted files.
|
||||||
- `Pick file to show` was renamed to `Pick a file to show.
|
- `Pick file to show` was renamed to `Pick a file to show.
|
||||||
- Files in the `Pick a file to show` are now ordered by their modified date descent.
|
- Files in the `Pick a file to show` are now ordered by their modified date descent.
|
||||||
- Update information became to be shown on the major upgrade.
|
- Update information became to be shown on the major upgrade.
|
||||||
|
|
||||||
|
#### Minors
|
||||||
|
- 0.13.1 Fixed on conflict resolution.
|
||||||
|
- 0.13.2 Fixed file deletion failures.
|
||||||
Reference in New Issue
Block a user