Compare commits

...

3 Commits

Author SHA1 Message Date
vorotamoroz
ccb3dd52de Dep update 2025-02-05 01:10:03 +00:00
vorotamoroz
3e5f4c8946 bump 2025-02-05 01:04:21 +00:00
vorotamoroz
54e64c59a9 - Prettified some source.
- Fixed the issue which the filename is shown as `undefined`.
- Fixed the issue where files transferred at short intervals were not reflected.
- Updated dependency (including new translation)
2025-02-05 00:58:51 +00:00
8 changed files with 1656 additions and 1567 deletions

View File

@@ -1,7 +1,7 @@
{ {
"id": "obsidian-livesync", "id": "obsidian-livesync",
"name": "Self-hosted LiveSync", "name": "Self-hosted LiveSync",
"version": "0.24.8", "version": "0.24.9",
"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",

908
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "obsidian-livesync", "name": "obsidian-livesync",
"version": "0.24.8", "version": "0.24.9",
"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",
@@ -32,17 +32,17 @@
"@types/pouchdb-mapreduce": "^6.1.10", "@types/pouchdb-mapreduce": "^6.1.10",
"@types/pouchdb-replication": "^6.4.7", "@types/pouchdb-replication": "^6.4.7",
"@types/transform-pouch": "^1.0.6", "@types/transform-pouch": "^1.0.6",
"@typescript-eslint/eslint-plugin": "^8.4.0", "@typescript-eslint/eslint-plugin": "^8.23.0",
"@typescript-eslint/parser": "^8.4.0", "@typescript-eslint/parser": "^8.23.0",
"builtin-modules": "^4.0.0", "builtin-modules": "^4.0.0",
"esbuild": "0.23.1", "esbuild": "0.24.2",
"esbuild-svelte": "^0.8.1", "esbuild-svelte": "^0.9.0",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0", "eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.30.0", "eslint-plugin-import": "^2.31.0",
"events": "^3.3.0", "events": "^3.3.0",
"obsidian": "^1.6.6", "obsidian": "^1.7.2",
"postcss": "^8.4.45", "postcss": "^8.5.1",
"postcss-load-config": "^6.0.1", "postcss-load-config": "^6.0.1",
"pouchdb-adapter-http": "^9.0.0", "pouchdb-adapter-http": "^9.0.0",
"pouchdb-adapter-idb": "^9.0.0", "pouchdb-adapter-idb": "^9.0.0",
@@ -54,13 +54,13 @@
"pouchdb-merge": "^9.0.0", "pouchdb-merge": "^9.0.0",
"pouchdb-replication": "^9.0.0", "pouchdb-replication": "^9.0.0",
"pouchdb-utils": "^9.0.0", "pouchdb-utils": "^9.0.0",
"prettier": "^3.3.3", "prettier": "^3.4.2",
"svelte": "^4.2.19", "svelte": "^4.2.19",
"svelte-preprocess": "^6.0.2", "svelte-preprocess": "^6.0.2",
"terser": "^5.31.6", "terser": "^5.37.0",
"transform-pouch": "^2.0.0", "transform-pouch": "^2.0.0",
"tslib": "^2.7.0", "tslib": "^2.8.1",
"typescript": "^5.5.4" "typescript": "^5.7.3"
}, },
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "^3.645.0", "@aws-sdk/client-s3": "^3.645.0",
@@ -70,10 +70,10 @@
"diff-match-patch": "^1.0.5", "diff-match-patch": "^1.0.5",
"esbuild-plugin-inline-worker": "^0.1.1", "esbuild-plugin-inline-worker": "^0.1.1",
"fflate": "^0.8.2", "fflate": "^0.8.2",
"idb": "^8.0.0", "idb": "^8.0.2",
"minimatch": "^10.0.1", "minimatch": "^10.0.1",
"octagonal-wheels": "^0.1.22", "octagonal-wheels": "^0.1.22",
"svelte-check": "^4.0.4", "svelte-check": "^4.1.4",
"xxhash-wasm-102": "npm:xxhash-wasm@^1.0.2" "xxhash-wasm-102": "npm:xxhash-wasm@^1.0.2"
} }
} }

Submodule src/lib updated: 6305e8952b...90ace6de16

View File

@@ -205,13 +205,10 @@ export class ModuleFileHandler extends AbstractModule implements ICoreModule {
): Promise<boolean> { ): Promise<boolean> {
const file = typeof info === "string" ? this.storage.getFileStub(info) : info; const file = typeof info === "string" ? this.storage.getFileStub(info) : info;
const mode = file == null ? "create" : "modify"; const mode = file == null ? "create" : "modify";
const pathFromEntryInfo = typeof entryInfo === "string" ? entryInfo : getPath(entryInfo);
const docEntry = const docEntry = await this.db.fetchEntryMeta(pathFromEntryInfo, undefined, true);
typeof entryInfo === "string"
? await this.db.fetchEntryMeta(entryInfo, undefined, true)
: await this.db.fetchEntryMeta(entryInfo.path, undefined, true);
if (!docEntry) { if (!docEntry) {
this._log(`File ${file?.path} is not exist on the database`, LOG_LEVEL_VERBOSE); this._log(`File ${pathFromEntryInfo} is not exist on the database`, LOG_LEVEL_VERBOSE);
return false; return false;
} }
const path = getPath(docEntry); const path = getPath(docEntry);
@@ -275,7 +272,7 @@ export class ModuleFileHandler extends AbstractModule implements ICoreModule {
} }
// 2. if not, the content should be checked. // 2. if not, the content should be checked.
if (shouldApplied) { if (!shouldApplied) {
const readFile = await this.readFileFromStub(existDoc); const readFile = await this.readFileFromStub(existDoc);
if (await isDocContentSame(docData, readFile.body)) { if (await isDocContentSame(docData, readFile.body)) {
// The content is same. So, we do not need to update the file. // The content is same. So, we do not need to update the file.

View File

@@ -119,10 +119,10 @@ function getLevelStr(level: ConfigLevel) {
return level == LEVEL_POWER_USER return level == LEVEL_POWER_USER
? " (Power User)" ? " (Power User)"
: level == LEVEL_ADVANCED : level == LEVEL_ADVANCED
? " (Advanced)" ? " (Advanced)"
: level == LEVEL_EDGE_CASE : level == LEVEL_EDGE_CASE
? " (Edge Case)" ? " (Edge Case)"
: ""; : "";
} }
export function findAttrFromParent(el: HTMLElement, attr: string): string { export function findAttrFromParent(el: HTMLElement, attr: string): string {
@@ -301,8 +301,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
const syncMode = this.editingSettings?.liveSync const syncMode = this.editingSettings?.liveSync
? "LIVESYNC" ? "LIVESYNC"
: this.editingSettings?.periodicReplication : this.editingSettings?.periodicReplication
? "PERIODIC" ? "PERIODIC"
: "ONEVENTS"; : "ONEVENTS";
return { return {
syncMode, syncMode,
}; };
@@ -1652,16 +1652,16 @@ I appreciate you for your great dedication.
const options: Record<string, string> = const options: Record<string, string> =
this.editingSettings.remoteType == REMOTE_COUCHDB this.editingSettings.remoteType == REMOTE_COUCHDB
? { ? {
NONE: "", NONE: "",
LIVESYNC: "LiveSync", LIVESYNC: "LiveSync",
PERIODIC: "Periodic w/ batch", PERIODIC: "Periodic w/ batch",
DISABLE: "Disable all automatic", DISABLE: "Disable all automatic",
} }
: { : {
NONE: "", NONE: "",
PERIODIC: "Periodic w/ batch", PERIODIC: "Periodic w/ batch",
DISABLE: "Disable all automatic", DISABLE: "Disable all automatic",
}; };
new Setting(paneEl) new Setting(paneEl)
.autoWireDropDown("preset", { .autoWireDropDown("preset", {
@@ -1768,10 +1768,10 @@ I appreciate you for your great dedication.
const optionsSyncMode = const optionsSyncMode =
this.editingSettings.remoteType == REMOTE_COUCHDB this.editingSettings.remoteType == REMOTE_COUCHDB
? { ? {
ONEVENTS: "On events", ONEVENTS: "On events",
PERIODIC: "Periodic and on events", PERIODIC: "Periodic and on events",
LIVESYNC: "LiveSync", LIVESYNC: "LiveSync",
} }
: { ONEVENTS: "On events", PERIODIC: "Periodic and on events" }; : { ONEVENTS: "On events", PERIODIC: "Periodic and on events" };
new Setting(paneEl) new Setting(paneEl)
@@ -2050,7 +2050,7 @@ I appreciate you for your great dedication.
text: "Please set device name to identify this device. This name should be unique among your devices. While not configured, we cannot enable this feature.", text: "Please set device name to identify this device. This name should be unique among your devices. While not configured, we cannot enable this feature.",
cls: "op-warn", cls: "op-warn",
}, },
(c) => { }, (c) => {},
visibleOnly(() => this.isConfiguredAs("deviceAndVaultName", "")) visibleOnly(() => this.isConfiguredAs("deviceAndVaultName", ""))
); );
this.createEl( this.createEl(
@@ -2060,7 +2060,7 @@ I appreciate you for your great dedication.
text: "We cannot change the device name while this feature is enabled. Please disable this feature to change the device name.", text: "We cannot change the device name while this feature is enabled. Please disable this feature to change the device name.",
cls: "op-warn-info", cls: "op-warn-info",
}, },
(c) => { }, (c) => {},
visibleOnly(() => this.isConfiguredAs("usePluginSync", true)) visibleOnly(() => this.isConfiguredAs("usePluginSync", true))
); );
@@ -2152,8 +2152,8 @@ I appreciate you for your great dedication.
const scheme = pluginConfig.couchDB_URI.startsWith("http:") const scheme = pluginConfig.couchDB_URI.startsWith("http:")
? "(HTTP)" ? "(HTTP)"
: pluginConfig.couchDB_URI.startsWith("https:") : pluginConfig.couchDB_URI.startsWith("https:")
? "(HTTPS)" ? "(HTTPS)"
: ""; : "";
pluginConfig.couchDB_URI = isCloudantURI(pluginConfig.couchDB_URI) pluginConfig.couchDB_URI = isCloudantURI(pluginConfig.couchDB_URI)
? "cloudant" ? "cloudant"
: `self-hosted${scheme}`; : `self-hosted${scheme}`;
@@ -2173,8 +2173,8 @@ I appreciate you for your great dedication.
const endpointScheme = pluginConfig.endpoint.startsWith("http:") const endpointScheme = pluginConfig.endpoint.startsWith("http:")
? "(HTTP)" ? "(HTTP)"
: pluginConfig.endpoint.startsWith("https:") : pluginConfig.endpoint.startsWith("https:")
? "(HTTPS)" ? "(HTTPS)"
: ""; : "";
pluginConfig.endpoint = `${endpoint.indexOf(".r2.cloudflarestorage.") !== -1 ? "R2" : "self-hosted?"}(${endpointScheme})`; pluginConfig.endpoint = `${endpoint.indexOf(".r2.cloudflarestorage.") !== -1 ? "R2" : "self-hosted?"}(${endpointScheme})`;
} }
const obsidianInfo = `Navigator: ${navigator.userAgent} const obsidianInfo = `Navigator: ${navigator.userAgent}
@@ -2385,10 +2385,10 @@ ${stringifyYaml(pluginConfig)}`;
Logger("Start verifying all files", LOG_LEVEL_NOTICE, "verify"); Logger("Start verifying all files", LOG_LEVEL_NOTICE, "verify");
const files = this.plugin.settings.syncInternalFiles const files = this.plugin.settings.syncInternalFiles
? await this.plugin.storageAccess.getFilesIncludeHidden( ? await this.plugin.storageAccess.getFilesIncludeHidden(
"/", "/",
undefined, undefined,
ignorePatterns ignorePatterns
) )
: await this.plugin.storageAccess.getFileNames(); : await this.plugin.storageAccess.getFileNames();
const documents = [] as FilePath[]; const documents = [] as FilePath[];

View File

@@ -14,6 +14,21 @@ Thank you, and I hope your troubles will be resolved!
--- ---
## 0.24.9
### Fixed
- Fixed the issue which the filename is shown as `undefined`.
- Fixed the issue where files transferred at short intervals were not reflected.
### Improved
- Add more translations: `ja-JP` (Japanese) by @kohki-shikata (Thank you so much)!
### Internal
- Some files have been prettified.
## 0.24.8 ## 0.24.8
### Fixed ### Fixed
@@ -76,118 +91,4 @@ Thank you, and I hope your troubles will be resolved!
- The status line and the log summary are now displayed more smoothly and efficiently. - The status line and the log summary are now displayed more smoothly and efficiently.
- This improvement has also been applied to the logs displayed in the log pane. - This improvement has also been applied to the logs displayed in the log pane.
## 0.24.4
### Fixed
- Fixed so many inefficient and buggy modules inherited from the past.
### Improved
- Tasks are now executed in an efficient asynchronous library.
- On-demand chunk fetching is now more efficient and keeps the interval between requests.
- This will reduce the load on the server and the network.
- And, safe for the Cloudant.
## 0.24.3
### Improved
- Many messages have been improved for better understanding as thanks to the fine works of @Volkor3-16! Thank you so much!
- Documentations also have been updated to reflect the changes in the messages.
- Now the style of In-Editor Status has been solid for some Android devices.
## 0.24.2
### Rewritten
- Hidden File Sync is now respects the file changes on the storage. Not simply comparing modified times.
- This makes hidden file sync more robust and reliable.
### Fixed
- `Scan hidden files before replication` is now configurable again.
- Some unexpected errors are now handled more gracefully.
- Meaningless event passing during boot sequence is now prevented.
- Error handling for non-existing files has been fixed.
- Hidden files will not be batched to avoid the potential error.
- This behaviour had been causing the error in the previous versions in specific situations.
- The log which checking automatic conflict resolution is now in verbose level.
- Replication log (skipping non-targetting files) shows the correct information.
- The dialogue that asking enabling optional feature during `Rebuild Everything` now prevents to show the `overwrite` option.
- The rebuilding device is the first, meaningless.
- Files with different modified time but identical content are no longer processed repeatedly.
- Some unexpected errors which caused after terminating plug-in are now avoided.
-
### Improved
- JSON files are now more transferred efficiently.
- Now the JSON files are transferred in more fine chunks, which makes the transfer more efficient.
## 0.24.1
### Fixed
- Vault History can show the correct information of match-or-not for each file and database even if it is a binary file.
- `Sync settings via markdown` is now hidden during the setup wizard.
- Verify and Fix will ignore the hidden files if the hidden file sync is disabled.
#### New feature
- Now we can fetch the tweaks from the remote database while the setting dialogue and wizard are processing.
### Improved
- More things are moved to the modules.
- Includes the Main codebase. Now `main.ts` is almost stub.
- EventHub is now more robust and typesafe.
## 0.24.0
### Improved
- The welcome message is now more simple to encourage the use of the Setup-URI.
- The secondary message is also simpler to guide users to Minimal Setup.
- But Setup-URI will be recommended again, due to its importance.
- These dialogues contain a link to the documentation which can be clicked.
- The minimal setup is more minimal now. And, the setup is more user-friendly.
- Now the Configuration of the remote database is checked more robustly, but we can ignore the warning and proceed with the setup.
- Before we are asked about each feature, we are asked if we want to use optional features in the first place.
- This is to prevent the user from being overwhelmed by the features.
- And made it clear that it is not recommended for new users.
- Many messages have been improved for better understanding.
- Ridiculous messages have been (carefully) refined.
- Dialogues are more informative and friendly.
- A lot of messages have been mostly rewritten, leveraging Markdown.
- Especially auto-closing dialogues are now explicitly labelled: `To stop the countdown, tap anywhere on the dialogue`.
- Now if the is plugin configured to ignore some events, we will get a chance to fix it, in addition to the warning.
- And why that has happened is also explained in the dialogue.
- A note relating to device names has been added to Customisation Sync on the setting dialogue.
- We can verify and resolve also the hidden files now.
### Fixed
- We can resolve the conflict of the JSON file correctly now.
- Verifying files between the local database and storage is now working correctly.
- While restarting the plug-in, the shown dialogues will be automatically closed to avoid unexpected behaviour.
- Replicated documents that the local device has configured to ignore are now correctly ignored.
- The chunks of the document on the local device during the first transfer will be created correctly.
- And why we should create them is now explained in the dialogue.
- If optional features have been enabled in the wizard, `Enable advanced features` will be toggled correctly.
The hidden file sync is now working correctly. - Now the deletion of hidden files is correctly synchronised.
- Customisation Sync is now working correctly together with hidden file sync.
- No longer database suffix is stored in the setting sharing markdown.
- A fair number of bugs have been fixed.
### Changed
- Some default settings have been changed for an easier new user experience.
- Preventing the meaningless migration of the settings.
### Tiding
- The codebase has been reorganised into clearly defined modules.
- Commented-out codes have been gradually removed.
Older notes are in [updates_old.md](https://github.com/vrtmrz/obsidian-livesync/blob/main/updates_old.md). Older notes are in [updates_old.md](https://github.com/vrtmrz/obsidian-livesync/blob/main/updates_old.md).

File diff suppressed because it is too large Load Diff