- Now empty file could be decoded.
    - Local files are no longer pre-saved before fetching from a remote database.
    - No longer deadlock while applying customisation sync.
    - Configuration with multiple files is now able to be applied correctly.
    - Deleting folder propagation now works without enabling the use of a trash bin.
This commit is contained in:
vorotamoroz
2023-10-24 09:54:56 +01:00
parent 60eecd7001
commit cb74b5ee93
5 changed files with 10 additions and 7 deletions

View File

@@ -111,6 +111,7 @@ function deserialize2(str: string): PluginDataEx {
data data
} }
) )
tokens.nextLine();
} while (filename); } while (filename);
return result; return result;
} }
@@ -352,11 +353,13 @@ export class ConfigSync extends LiveSyncCommands {
} }
} }
Logger(`All files enumerated`, logLevel, "get-plugins"); Logger(`All files enumerated`, logLevel, "get-plugins");
pluginIsEnumerating.set(false);
this.createMissingConfigurationEntry(); this.createMissingConfigurationEntry();
} finally { } finally {
pluginIsEnumerating.set(false); pluginIsEnumerating.set(false);
} }
}); });
pluginIsEnumerating.set(false);
}); });
// return entries; // return entries;
} }

View File

@@ -207,21 +207,21 @@
const local = list.find((e) => e.term == thisTerm); const local = list.find((e) => e.term == thisTerm);
const selectedItem = list.find((e) => e.term == selected); const selectedItem = list.find((e) => e.term == selected);
if (selectedItem && (await applyData(selectedItem))) { if (selectedItem && (await applyData(selectedItem))) {
scheduleTask("update-plugin-list", 250, () => addOn.updatePluginList(true, local.documentPath)); addOn.updatePluginList(true, local?.documentPath);
} }
} }
async function compareSelected() { async function compareSelected() {
const local = list.find((e) => e.term == thisTerm); const local = list.find((e) => e.term == thisTerm);
const selectedItem = list.find((e) => e.term == selected); const selectedItem = list.find((e) => e.term == selected);
if (local && selectedItem && (await compareData(local, selectedItem))) { if (local && selectedItem && (await compareData(local, selectedItem))) {
scheduleTask("update-plugin-list", 250, () => addOn.updatePluginList(true, local.documentPath)); addOn.updatePluginList(true, local.documentPath);
} }
} }
async function deleteSelected() { async function deleteSelected() {
const selectedItem = list.find((e) => e.term == selected); const selectedItem = list.find((e) => e.term == selected);
// const deletedPath = selectedItem.documentPath; // const deletedPath = selectedItem.documentPath;
if (selectedItem && (await deleteData(selectedItem))) { if (selectedItem && (await deleteData(selectedItem))) {
scheduleTask("update-plugin-list", 250, () => addOn.reloadPluginList(true)); addOn.reloadPluginList(true);
} }
} }
async function duplicateItem() { async function duplicateItem() {

Submodule src/lib updated: 259179be15...89d2707c21

View File

@@ -1327,13 +1327,13 @@ Note: We can always able to read V1 format. It will be progressively converted.
if (this.settings.trashInsteadDelete) { if (this.settings.trashInsteadDelete) {
await this.app.vault.trash(file, false); await this.app.vault.trash(file, false);
} else { } else {
await this.app.vault.delete(file); await this.app.vault.delete(file, true);
} }
Logger(`xxx <- STORAGE (deleted) ${file.path}`); Logger(`xxx <- STORAGE (deleted) ${file.path}`);
Logger(`files: ${dir.children.length}`); Logger(`files: ${dir.children.length}`);
if (dir.children.length == 0) { if (dir.children.length == 0) {
if (!this.settings.doNotDeleteFolder) { if (!this.settings.doNotDeleteFolder) {
Logger(`All files under the parent directory (${dir}) have been deleted, so delete this one.`); Logger(`All files under the parent directory (${dir.path}) have been deleted, so delete this one.`);
await this.deleteVaultItem(dir); await this.deleteVaultItem(dir);
} }
} }

View File

@@ -481,7 +481,7 @@ export const requestToCouchDB = async (baseUri: string, username: string, passwo
export async function performRebuildDB(plugin: ObsidianLiveSyncPlugin, method: "localOnly" | "remoteOnly" | "rebuildBothByThisDevice") { export async function performRebuildDB(plugin: ObsidianLiveSyncPlugin, method: "localOnly" | "remoteOnly" | "rebuildBothByThisDevice") {
if (method == "localOnly") { if (method == "localOnly") {
await plugin.addOnSetup.fetchLocalWithKeepLocal(); await plugin.addOnSetup.fetchLocal();
} }
if (method == "remoteOnly") { if (method == "remoteOnly") {
await plugin.addOnSetup.rebuildRemote(); await plugin.addOnSetup.rebuildRemote();