1
0
mirror of https://github.com/vrtmrz/obsidian-livesync.git synced 2024-12-12 09:04:06 +02:00
- Fix file extension
- Remove GC.
- Remove obsoluted methods.
This commit is contained in:
vorotamoroz 2022-09-11 02:46:29 +09:00
parent de5cdf507d
commit 34791114e5
3 changed files with 11 additions and 38 deletions

View File

@ -1,12 +1,12 @@
import { requestUrl, RequestUrlParam, RequestUrlResponse } from "obsidian";
import { KeyValueDatabase, OpenKeyValueDatabase } from "./KeyValueDB";
import { LocalPouchDBBase } from "./lib/src/LocalPouchDBBase";
import { Logger } from "./lib/src/logger";
import { PouchDB } from "./lib/src/pouchdb-browser";
import { EntryDoc, LOG_LEVEL } from "./lib/src/types";
import { enableEncryption } from "./lib/src/utils";
import { isValidRemoteCouchDBURI } from "./lib/src/utils_couchdb";
import { id2path, path2id } from "./utils";
import { KeyValueDatabase, OpenKeyValueDatabase } from "./KeyValueDB.js";
import { LocalPouchDBBase } from "./lib/src/LocalPouchDBBase.js";
import { Logger } from "./lib/src/logger.js";
import { PouchDB } from "./lib/src/pouchdb-browser.js";
import { EntryDoc, LOG_LEVEL } from "./lib/src/types.js";
import { enableEncryption } from "./lib/src/utils.js";
import { isValidRemoteCouchDBURI } from "./lib/src/utils_couchdb.js";
import { id2path, path2id } from "./utils.js";
export class LocalPouchDB extends LocalPouchDBBase {

@ -1 +1 @@
Subproject commit 57db68352b7d891a29529eb2b26ef4fcbb29bc76
Subproject commit 2c39c1517765c2bbc8da9c203313cd606407ce72

View File

@ -462,13 +462,7 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
await this.showIfConflicted(view.file);
},
});
this.addCommand({
id: "livesync-gc",
name: "Check garbages now",
callback: () => {
this.garbageCheck();
},
});
this.addCommand({
id: "livesync-toggle",
name: "Toggle LiveSync",
@ -614,9 +608,6 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
return await this.localDatabase.initializeDatabase();
}
async garbageCheck() {
await this.localDatabase.garbageCheck();
}
async loadSettings() {
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
@ -656,19 +647,6 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
gcTimerHandler: any = null;
gcHook() {
if (this.settings.gcDelay == 0) return;
if (this.settings.useHistory) return;
const GC_DELAY = this.settings.gcDelay * 1000; // if leaving opening window, try GC,
if (this.gcTimerHandler != null) {
clearTimeout(this.gcTimerHandler);
this.gcTimerHandler = null;
}
this.gcTimerHandler = setTimeout(() => {
this.gcTimerHandler = null;
this.garbageCheck();
}, GC_DELAY);
}
registerWatchEvents() {
this.registerEvent(this.app.vault.on("modify", this.watchVaultChange));
@ -719,7 +697,6 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
this.setPeriodicSync();
}
}
this.gcHook();
}
watchWorkspaceOpen(file: TFile) {
@ -736,7 +713,6 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
await this.replicate();
}
await this.showIfConflicted(file);
this.gcHook();
}
watchVaultCreate(file: TFile, ...args: any[]) {
@ -816,7 +792,6 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
return;
}
await this.updateIntoDB(file);
this.gcHook();
}
}
@ -834,7 +809,6 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
} else if (file instanceof TFolder) {
await this.deleteFolderOnDB(file);
}
this.gcHook();
}
GetAllFilesRecursively(file: TAbstractFile): TFile[] {
@ -904,7 +878,6 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
Logger(ex);
}
}
this.gcHook();
}
addLogHook: () => void = null;
@ -1352,7 +1325,6 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
Logger(`Remote database updated to incompatible version. update your self-hosted-livesync plugin.`, LOG_LEVEL.NOTICE);
}
}
this.gcHook();
}
}
@ -2077,6 +2049,7 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
async resetLocalDatabase() {
clearTouched();
await this.localDatabase.resetDatabase();
await this.localDatabase.resetLocalOldDatabase();
}
async resetLocalOldDatabase() {
clearTouched();