mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-05-21 06:41:33 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02de82af46 | ||
|
|
840e03a2d3 | ||
|
|
96b676caf3 | ||
|
|
a8219de375 | ||
|
|
db3eb7e1a0 | ||
|
|
50f51393fc | ||
|
|
8a04e332d6 | ||
|
|
12ae17aa2f | ||
|
|
657f12f966 | ||
|
|
15a7bed448 | ||
|
|
420c3b94df | ||
|
|
239c087132 |
@@ -10,9 +10,11 @@ But some additional configurations are required in `local.ini` to use from Self-
|
|||||||
```
|
```
|
||||||
[couchdb]
|
[couchdb]
|
||||||
single_node=true
|
single_node=true
|
||||||
|
max_document_size = 50000000
|
||||||
|
|
||||||
[chttpd]
|
[chttpd]
|
||||||
require_valid_user = true
|
require_valid_user = true
|
||||||
|
max_http_request_size = 4294967296
|
||||||
|
|
||||||
[chttpd_auth]
|
[chttpd_auth]
|
||||||
require_valid_user = true
|
require_valid_user = true
|
||||||
|
|||||||
@@ -11,9 +11,11 @@
|
|||||||
```
|
```
|
||||||
[couchdb]
|
[couchdb]
|
||||||
single_node=true
|
single_node=true
|
||||||
|
max_document_size = 50000000
|
||||||
|
|
||||||
[chttpd]
|
[chttpd]
|
||||||
require_valid_user = true
|
require_valid_user = true
|
||||||
|
max_http_request_size = 4294967296
|
||||||
|
|
||||||
[chttpd_auth]
|
[chttpd_auth]
|
||||||
require_valid_user = true
|
require_valid_user = true
|
||||||
|
|||||||
@@ -8,12 +8,14 @@ CouchDBを構築するには、[Dockerのイメージ](https://hub.docker.com/_/
|
|||||||
```
|
```
|
||||||
[couchdb]
|
[couchdb]
|
||||||
single_node=true
|
single_node=true
|
||||||
|
max_document_size = 50000000
|
||||||
|
|
||||||
[chttpd]
|
[chttpd]
|
||||||
require_valid_user = true
|
require_valid_user = true
|
||||||
|
|
||||||
[chttpd_auth]
|
[chttpd_auth]
|
||||||
require_valid_user = true
|
require_valid_user = true
|
||||||
|
max_http_request_size = 4294967296
|
||||||
authentication_redirect = /_utils/session.html
|
authentication_redirect = /_utils/session.html
|
||||||
|
|
||||||
[httpd]
|
[httpd]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "obsidian-livesync",
|
"id": "obsidian-livesync",
|
||||||
"name": "Self-hosted LiveSync",
|
"name": "Self-hosted LiveSync",
|
||||||
"version": "0.16.6",
|
"version": "0.17.1",
|
||||||
"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",
|
||||||
|
|||||||
2713
package-lock.json
generated
2713
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
38
package.json
38
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "obsidian-livesync",
|
"name": "obsidian-livesync",
|
||||||
"version": "0.16.6",
|
"version": "0.17.1",
|
||||||
"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",
|
||||||
@@ -13,34 +13,30 @@
|
|||||||
"author": "vorotamoroz",
|
"author": "vorotamoroz",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-commonjs": "^18.0.0",
|
|
||||||
"@rollup/plugin-node-resolve": "^11.2.1",
|
|
||||||
"@rollup/plugin-typescript": "^8.2.1",
|
|
||||||
"@types/diff-match-patch": "^1.0.32",
|
"@types/diff-match-patch": "^1.0.32",
|
||||||
"@types/pouchdb": "^6.4.0",
|
"@types/pouchdb": "^6.4.0",
|
||||||
"@types/pouchdb-browser": "^6.1.3",
|
"@types/pouchdb-browser": "^6.1.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
"@typescript-eslint/eslint-plugin": "^5.44.0",
|
||||||
"@typescript-eslint/parser": "^5.0.0",
|
"@typescript-eslint/parser": "^5.44.0",
|
||||||
"builtin-modules": "^3.2.0",
|
"builtin-modules": "^3.3.0",
|
||||||
"esbuild": "0.13.12",
|
"esbuild": "0.15.15",
|
||||||
"esbuild-svelte": "^0.7.0",
|
"esbuild-svelte": "^0.7.3",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^8.28.0",
|
||||||
"eslint-config-airbnb-base": "^14.2.1",
|
"eslint-config-airbnb-base": "^15.0.0",
|
||||||
"eslint-plugin-import": "^2.25.2",
|
"eslint-plugin-import": "^2.26.0",
|
||||||
"obsidian": "^0.16.3",
|
"obsidian": "^0.16.3",
|
||||||
"postcss": "^8.4.14",
|
"postcss": "^8.4.19",
|
||||||
"postcss-load-config": "^3.1.4",
|
"postcss-load-config": "^4.0.1",
|
||||||
"rollup": "^2.32.1",
|
"svelte": "^3.53.1",
|
||||||
"svelte": "^3.49.0",
|
|
||||||
"svelte-preprocess": "^4.10.7",
|
"svelte-preprocess": "^4.10.7",
|
||||||
"tslib": "^2.2.0",
|
"tslib": "^2.4.1",
|
||||||
"typescript": "^4.2.4"
|
"typescript": "^4.9.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"diff-match-patch": "^1.0.5",
|
"diff-match-patch": "^1.0.5",
|
||||||
"esbuild": "0.13.12",
|
"esbuild": "0.15.15",
|
||||||
"esbuild-svelte": "^0.7.0",
|
"esbuild-svelte": "^0.7.3",
|
||||||
"idb": "^7.0.2",
|
"idb": "^7.1.1",
|
||||||
"xxhash-wasm": "^0.4.2"
|
"xxhash-wasm": "^0.4.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import typescript from "@rollup/plugin-typescript";
|
|
||||||
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
|
||||||
import commonjs from "@rollup/plugin-commonjs";
|
|
||||||
|
|
||||||
const isProd = process.env.BUILD === "production";
|
|
||||||
|
|
||||||
const banner = `/*
|
|
||||||
THIS IS A GENERATED/BUNDLED FILE BY ROLLUP
|
|
||||||
if you want to view the source visit the plugins github repository
|
|
||||||
*/
|
|
||||||
`;
|
|
||||||
|
|
||||||
export default {
|
|
||||||
input: "./src/main.ts",
|
|
||||||
output: {
|
|
||||||
dir: ".",
|
|
||||||
sourcemap: "inline",
|
|
||||||
sourcemapExcludeSources: isProd,
|
|
||||||
format: "cjs",
|
|
||||||
exports: "default",
|
|
||||||
banner,
|
|
||||||
},
|
|
||||||
external: ["obsidian"],
|
|
||||||
plugins: [
|
|
||||||
typescript({ exclude: ["pouchdb-browser.js", "pouchdb-browser-webpack"] }),
|
|
||||||
nodeResolve({
|
|
||||||
browser: true,
|
|
||||||
}),
|
|
||||||
commonjs(),
|
|
||||||
],
|
|
||||||
};
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { App, PluginSettingTab, Setting, sanitizeHTMLToDom, RequestUrlParam, requestUrl, TextAreaComponent, MarkdownRenderer, stringifyYaml } from "obsidian";
|
import { App, PluginSettingTab, Setting, sanitizeHTMLToDom, RequestUrlParam, requestUrl, TextAreaComponent, MarkdownRenderer, stringifyYaml } from "obsidian";
|
||||||
import { DEFAULT_SETTINGS, LOG_LEVEL, ObsidianLiveSyncSettings, RemoteDBSettings } from "./lib/src/types";
|
import { DEFAULT_SETTINGS, LOG_LEVEL, ObsidianLiveSyncSettings, RemoteDBSettings } from "./lib/src/types";
|
||||||
import { path2id, id2path } from "./utils";
|
import { path2id, id2path } from "./utils";
|
||||||
import { delay, versionNumberString2Number } from "./lib/src/utils";
|
import { delay, Semaphore, versionNumberString2Number } from "./lib/src/utils";
|
||||||
import { Logger } from "./lib/src/logger";
|
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";
|
||||||
@@ -1288,7 +1288,6 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
|
|
||||||
new Setting(containerHatchEl)
|
new Setting(containerHatchEl)
|
||||||
.setName("Make report to inform the issue")
|
.setName("Make report to inform the issue")
|
||||||
.setDesc("Verify and repair all files and update database without restoring")
|
|
||||||
.addButton((button) =>
|
.addButton((button) =>
|
||||||
button
|
button
|
||||||
.setButtonText("Make report")
|
.setButtonText("Make report")
|
||||||
@@ -1368,21 +1367,28 @@ ${stringifyYaml(pluginConfig)}`;
|
|||||||
.setDisabled(false)
|
.setDisabled(false)
|
||||||
.setWarning()
|
.setWarning()
|
||||||
.onClick(async () => {
|
.onClick(async () => {
|
||||||
|
const semaphore = Semaphore(10);
|
||||||
const files = this.app.vault.getFiles();
|
const files = this.app.vault.getFiles();
|
||||||
Logger("Verify and repair all files started", LOG_LEVEL.NOTICE, "verify");
|
|
||||||
// const notice = NewNotice("", 0);
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
for (const file of files) {
|
const processes = files.map(e => (async (file) => {
|
||||||
i++;
|
const releaser = await semaphore.acquire(1, "verifyAndRepair");
|
||||||
Logger(`Update into ${file.path}`);
|
|
||||||
Logger(`${i}/${files.length}\n${file.path}`, LOG_LEVEL.NOTICE, "verify");
|
|
||||||
try {
|
try {
|
||||||
await this.plugin.updateIntoDB(file);
|
Logger(`Update into ${file.path}`);
|
||||||
|
await this.plugin.updateIntoDB(file, false, null, true);
|
||||||
|
i++;
|
||||||
|
Logger(`${i}/${files.length}\n${file.path}`, LOG_LEVEL.NOTICE, "verify");
|
||||||
|
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
Logger("could not update:");
|
i++;
|
||||||
|
Logger(`Error while verifyAndRepair`, LOG_LEVEL.NOTICE);
|
||||||
Logger(ex);
|
Logger(ex);
|
||||||
|
} finally {
|
||||||
|
releaser();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
)(e));
|
||||||
|
await Promise.all(processes);
|
||||||
Logger("done", LOG_LEVEL.NOTICE, "verify");
|
Logger("done", LOG_LEVEL.NOTICE, "verify");
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
2
src/lib
2
src/lib
Submodule src/lib updated: 2734fe9632...a13d921fb7
29
src/main.ts
29
src/main.ts
@@ -709,7 +709,7 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
clearAllPeriodic();
|
clearAllPeriodic();
|
||||||
clearAllTriggers();
|
clearAllTriggers();
|
||||||
window.removeEventListener("visibilitychange", this.watchWindowVisibility);
|
window.removeEventListener("visibilitychange", this.watchWindowVisibility);
|
||||||
window.removeEventListener("online", this.watchOnline)
|
window.removeEventListener("online", this.watchOnline);
|
||||||
Logger("unloading plugin");
|
Logger("unloading plugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2192,7 +2192,7 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateIntoDB(file: TFile, initialScan?: boolean, cache?: CacheData) {
|
async updateIntoDB(file: TFile, initialScan?: boolean, cache?: CacheData, force?: boolean) {
|
||||||
if (!this.isTargetFile(file)) return;
|
if (!this.isTargetFile(file)) return;
|
||||||
if (shouldBeIgnored(file.path)) {
|
if (shouldBeIgnored(file.path)) {
|
||||||
return;
|
return;
|
||||||
@@ -2234,15 +2234,24 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
|||||||
if (recentlyTouched(file)) {
|
if (recentlyTouched(file)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const old = await this.localDatabase.getDBEntry(fullPath, null, false, false);
|
try {
|
||||||
if (old !== false) {
|
const old = await this.localDatabase.getDBEntry(fullPath, null, false, false);
|
||||||
const oldData = { data: old.data, deleted: old._deleted || old.deleted, };
|
if (old !== false) {
|
||||||
const newData = { data: d.data, deleted: d._deleted || d.deleted };
|
const oldData = { data: old.data, deleted: old._deleted || old.deleted, };
|
||||||
if (JSON.stringify(oldData) == JSON.stringify(newData)) {
|
const newData = { data: d.data, deleted: d._deleted || d.deleted };
|
||||||
Logger(msg + "Skipped (not changed) " + fullPath + ((d._deleted || d.deleted) ? " (deleted)" : ""), LOG_LEVEL.VERBOSE);
|
if (JSON.stringify(oldData) == JSON.stringify(newData)) {
|
||||||
return true;
|
Logger(msg + "Skipped (not changed) " + fullPath + ((d._deleted || d.deleted) ? " (deleted)" : ""), LOG_LEVEL.VERBOSE);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// d._rev = old._rev;
|
||||||
}
|
}
|
||||||
// d._rev = old._rev;
|
} catch (ex) {
|
||||||
|
if (force) {
|
||||||
|
Logger(msg + "Error, Could not check the diff for the old one." + (force ? "force writing." : "") + fullPath + ((d._deleted || d.deleted) ? " (deleted)" : ""), LOG_LEVEL.VERBOSE);
|
||||||
|
} else {
|
||||||
|
Logger(msg + "Error, Could not check the diff for the old one." + fullPath + ((d._deleted || d.deleted) ? " (deleted)" : ""), LOG_LEVEL.VERBOSE);
|
||||||
|
}
|
||||||
|
return !force;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|||||||
40
updates.md
40
updates.md
@@ -1,3 +1,19 @@
|
|||||||
|
### 0.17.0
|
||||||
|
- 0.17.0 has no surfaced changes but the design of saving chunks has been changed. They have compatibility but changing files after upgrading makes different chunks than before 0.16.x.
|
||||||
|
Please rebuild databases once if you have been worried about storage usage.
|
||||||
|
|
||||||
|
- Improved:
|
||||||
|
- Splitting markdown
|
||||||
|
- Saving chunks
|
||||||
|
|
||||||
|
- Changed:
|
||||||
|
- Chunk ID numbering rules
|
||||||
|
|
||||||
|
#### Minors
|
||||||
|
- 0.17.1
|
||||||
|
- Fixed: Now we can verify and repair the database.
|
||||||
|
- Refactored inside.
|
||||||
|
|
||||||
### 0.16.0
|
### 0.16.0
|
||||||
- Now hidden files need not be scanned. Changes will be detected automatically.
|
- Now hidden files need not be scanned. Changes will be detected automatically.
|
||||||
- If you want it to back to its previous behaviour, please disable `Monitor changes to internal files`.
|
- If you want it to back to its previous behaviour, please disable `Monitor changes to internal files`.
|
||||||
@@ -26,28 +42,8 @@
|
|||||||
- Improved
|
- Improved
|
||||||
- Corrupted chunks will be detected automatically.
|
- Corrupted chunks will be detected automatically.
|
||||||
- Now on the case-insensitive system, `aaa.md` and `AAA.md` will be treated as the same file or path at applying changesets.
|
- Now on the case-insensitive system, `aaa.md` and `AAA.md` will be treated as the same file or path at applying changesets.
|
||||||
|
- 0.16.7 Nothing has been changed except toolsets, framework library, and as like them. Please inform me if something had been getting strange!
|
||||||
|
- 0.16.8 Now we can synchronise without `bad_request:invalid UTF-8 JSON` even while end-to-end encryption has been disabled.
|
||||||
|
|
||||||
Note:
|
Note:
|
||||||
Before 0.16.5, LiveSync had some issues making chunks. In this case, synchronisation had became been always failing after a corrupted one should be made. After 0.16.6, the corrupted chunk is automatically detected. Sorry for troubling you but please do `rebuild everything` when this plug-in notified so.
|
Before 0.16.5, LiveSync had some issues making chunks. In this case, synchronisation had became been always failing after a corrupted one should be made. After 0.16.6, the corrupted chunk is automatically detected. Sorry for troubling you but please do `rebuild everything` when this plug-in notified so.
|
||||||
|
|
||||||
### 0.15.0
|
|
||||||
- Outdated configuration items have been removed.
|
|
||||||
- Setup wizard has been implemented!
|
|
||||||
|
|
||||||
I appreciate for reviewing and giving me advice @Pouhon158!
|
|
||||||
|
|
||||||
#### Minors
|
|
||||||
- 0.15.1 Missed the stylesheet.
|
|
||||||
- 0.15.2 The wizard has been improved and documented!
|
|
||||||
- 0.15.3 Fixed the issue about locking/unlocking remote database while rebuilding in the wizard.
|
|
||||||
- 0.15.4 Fixed issues about asynchronous processing (e.g., Conflict check or hidden file detection)
|
|
||||||
- 0.15.5 Add new features for setting Self-hosted LiveSync up more easier.
|
|
||||||
- 0.15.6 File tracking logic has been refined.
|
|
||||||
- 0.15.7 Fixed bug about renaming file.
|
|
||||||
- 0.15.8 Fixed bug about deleting empty directory, weird behaviour on boot-sequence on mobile devices.
|
|
||||||
- 0.15.9 Improved chunk retrieving, now chunks are retrieved in batch on continuous requests.
|
|
||||||
- 0.15.10 Fixed:
|
|
||||||
- The boot sequence has been corrected and now boots smoothly.
|
|
||||||
- Auto applying of batch save will be processed earlier than before.
|
|
||||||
|
|
||||||
... To continue on to `updates_old.md`.
|
|
||||||
Reference in New Issue
Block a user