mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2025-12-23 14:41:28 +00:00
- Fixed
- Fixed the issue about fixing the database.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "obsidian-livesync",
|
"id": "obsidian-livesync",
|
||||||
"name": "Self-hosted LiveSync",
|
"name": "Self-hosted LiveSync",
|
||||||
"version": "0.19.9",
|
"version": "0.19.10",
|
||||||
"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.19.9",
|
"version": "0.19.10",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "obsidian-livesync",
|
"name": "obsidian-livesync",
|
||||||
"version": "0.19.9",
|
"version": "0.19.10",
|
||||||
"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.19.9",
|
"version": "0.19.10",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { App, PluginSettingTab, Setting, sanitizeHTMLToDom, TextAreaComponent, MarkdownRenderer, stringifyYaml } from "./deps";
|
import { App, PluginSettingTab, Setting, sanitizeHTMLToDom, TextAreaComponent, MarkdownRenderer, stringifyYaml } from "./deps";
|
||||||
import { DEFAULT_SETTINGS, LOG_LEVEL, type ObsidianLiveSyncSettings, type ConfigPassphraseStore, type RemoteDBSettings, type FilePathWithPrefix } from "./lib/src/types";
|
import { DEFAULT_SETTINGS, LOG_LEVEL, type ObsidianLiveSyncSettings, type ConfigPassphraseStore, type RemoteDBSettings, type FilePathWithPrefix, type DocumentID } from "./lib/src/types";
|
||||||
import { delay } from "./lib/src/utils";
|
import { delay } from "./lib/src/utils";
|
||||||
import { Semaphore } from "./lib/src/semaphore";
|
import { Semaphore } from "./lib/src/semaphore";
|
||||||
import { versionNumberString2Number } from "./lib/src/strbin";
|
import { versionNumberString2Number } from "./lib/src/strbin";
|
||||||
@@ -7,7 +7,8 @@ import { Logger } from "./lib/src/logger";
|
|||||||
import { checkSyncInfo, isCloudantURI } from "./lib/src/utils_couchdb.js";
|
import { checkSyncInfo, isCloudantURI } from "./lib/src/utils_couchdb.js";
|
||||||
import { testCrypt } from "./lib/src/e2ee_v2";
|
import { testCrypt } from "./lib/src/e2ee_v2";
|
||||||
import ObsidianLiveSyncPlugin from "./main";
|
import ObsidianLiveSyncPlugin from "./main";
|
||||||
import { balanceChunks, localDatabaseCleanUp, performRebuildDB, remoteDatabaseCleanup, requestToCouchDB } from "./utils";
|
import { balanceChunks, isChunk, localDatabaseCleanUp, performRebuildDB, remoteDatabaseCleanup, requestToCouchDB } from "./utils";
|
||||||
|
import { stripAllPrefixes } from "./lib/src/path";
|
||||||
|
|
||||||
|
|
||||||
export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
||||||
@@ -1548,22 +1549,29 @@ ${stringifyYaml(pluginConfig)}`;
|
|||||||
for await (const docName of this.plugin.localDatabase.findAllDocNames()) {
|
for await (const docName of this.plugin.localDatabase.findAllDocNames()) {
|
||||||
if (!docName.startsWith("f:")) {
|
if (!docName.startsWith("f:")) {
|
||||||
const idEncoded = await this.plugin.path2id(docName as FilePathWithPrefix);
|
const idEncoded = await this.plugin.path2id(docName as FilePathWithPrefix);
|
||||||
const doc = await this.plugin.localDatabase.getDBEntry(docName as FilePathWithPrefix);
|
const doc = await this.plugin.localDatabase.getRaw(docName as DocumentID);
|
||||||
if (!doc) continue;
|
if (!doc) continue;
|
||||||
if (doc.type != "newnote" && doc.type != "plain") {
|
if (doc.type != "newnote" && doc.type != "plain") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (doc?.deleted ?? false) continue;
|
||||||
const newDoc = { ...doc };
|
const newDoc = { ...doc };
|
||||||
//Prepare converted data
|
//Prepare converted data
|
||||||
newDoc._id = idEncoded;
|
newDoc._id = idEncoded;
|
||||||
newDoc.path = this.plugin.getPath(newDoc);
|
newDoc.path = docName as FilePathWithPrefix;
|
||||||
|
delete newDoc._rev;
|
||||||
try {
|
try {
|
||||||
const obfuscatedDoc = await this.plugin.localDatabase.getRaw(idEncoded, { revs_info: true });
|
const obfuscatedDoc = await this.plugin.localDatabase.getRaw(idEncoded, { revs_info: true });
|
||||||
// Unfortunately we have to delete one of them.
|
// Unfortunately we have to delete one of them.
|
||||||
// Just now, save it as a conflicted document.
|
// Just now, save it as a conflicted document.
|
||||||
obfuscatedDoc._revs_info?.shift(); // Drop latest revision.
|
obfuscatedDoc._revs_info?.shift(); // Drop latest revision.
|
||||||
const previousRev = obfuscatedDoc._revs_info?.shift(); // Use second revision.
|
const previousRev = obfuscatedDoc._revs_info?.shift(); // Use second revision.
|
||||||
|
if (previousRev) {
|
||||||
newDoc._rev = previousRev.rev;
|
newDoc._rev = previousRev.rev;
|
||||||
|
} else {
|
||||||
|
//If there are no revisions, set the possibly unique one
|
||||||
|
newDoc._rev = "1-" + (`00000000000000000000000000000000${~~(Math.random() * 1e9)}${~~(Math.random() * 1e9)}${~~(Math.random() * 1e9)}${~~(Math.random() * 1e9)}`.slice(-32));
|
||||||
|
}
|
||||||
const ret = await this.plugin.localDatabase.putRaw(newDoc, { force: true });
|
const ret = await this.plugin.localDatabase.putRaw(newDoc, { force: true });
|
||||||
if (ret.ok) {
|
if (ret.ok) {
|
||||||
Logger(`${docName} has been converted as conflicted document`, LOG_LEVEL.NOTICE);
|
Logger(`${docName} has been converted as conflicted document`, LOG_LEVEL.NOTICE);
|
||||||
@@ -1594,6 +1602,7 @@ ${stringifyYaml(pluginConfig)}`;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Logger(`Converting finished`, LOG_LEVEL.NOTICE);
|
||||||
}));
|
}));
|
||||||
new Setting(containerHatchEl)
|
new Setting(containerHatchEl)
|
||||||
.setName("Suspend file watching")
|
.setName("Suspend file watching")
|
||||||
|
|||||||
@@ -75,5 +75,8 @@ I hope you will give it a try.
|
|||||||
- We can fix the database obfuscated and plain paths that have been mixed up.
|
- We can fix the database obfuscated and plain paths that have been mixed up.
|
||||||
- Improvements
|
- Improvements
|
||||||
- Customisation Sync performance has been improved.
|
- Customisation Sync performance has been improved.
|
||||||
|
- 0.19.10
|
||||||
|
- Fixed
|
||||||
|
- Fixed the issue about fixing the database.
|
||||||
|
|
||||||
... To continue on to `updates_old.md`.
|
... To continue on to `updates_old.md`.
|
||||||
|
|||||||
Reference in New Issue
Block a user