mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-03-01 07:28:47 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88e61fb41f | ||
|
|
9bf04332bb | ||
|
|
5238dec3f2 | ||
|
|
2b7b411c52 | ||
|
|
04997b84c0 | ||
|
|
41a112cd8a | ||
|
|
294ebf0c31 | ||
|
|
4c260a7d2b | ||
|
|
82f6fefd35 | ||
|
|
ada8001fcb | ||
|
|
d82122de24 |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "obsidian-livesync",
|
||||
"name": "Self-hosted LiveSync",
|
||||
"version": "0.25.24.beta3",
|
||||
"version": "0.25.24",
|
||||
"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.",
|
||||
"author": "vorotamoroz",
|
||||
|
||||
16
package-lock.json
generated
16
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "obsidian-livesync",
|
||||
"version": "0.25.24.beta3",
|
||||
"version": "0.25.24",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "obsidian-livesync",
|
||||
"version": "0.25.24.beta3",
|
||||
"version": "0.25.24",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.808.0",
|
||||
@@ -6717,9 +6717,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-svelte/node_modules/globals": {
|
||||
"version": "16.4.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-16.4.0.tgz",
|
||||
"integrity": "sha512-ob/2LcVVaVGCYN+r14cnwnoDPUufjiYgSqRhiFD0Q1iI4Odora5RE8Iv1D24hAz5oMophRGkGz+yuvQmmUMnMw==",
|
||||
"version": "16.5.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz",
|
||||
"integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -16715,9 +16715,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"globals": {
|
||||
"version": "16.4.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-16.4.0.tgz",
|
||||
"integrity": "sha512-ob/2LcVVaVGCYN+r14cnwnoDPUufjiYgSqRhiFD0Q1iI4Odora5RE8Iv1D24hAz5oMophRGkGz+yuvQmmUMnMw==",
|
||||
"version": "16.5.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz",
|
||||
"integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==",
|
||||
"dev": true
|
||||
},
|
||||
"lilconfig": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "obsidian-livesync",
|
||||
"version": "0.25.24.beta3",
|
||||
"version": "0.25.24",
|
||||
"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",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { normalizePath, type PluginManifest, type ListedFiles } from "../../deps.ts";
|
||||
import { type PluginManifest, type ListedFiles } from "../../deps.ts";
|
||||
import {
|
||||
type LoadedEntry,
|
||||
type FilePathWithPrefix,
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
MODE_PAUSED,
|
||||
type SavingEntry,
|
||||
type DocumentID,
|
||||
type FilePathWithPrefixLC,
|
||||
type UXFileInfo,
|
||||
type UXStat,
|
||||
LOG_LEVEL_DEBUG,
|
||||
@@ -177,24 +176,10 @@ export class HiddenFileSync extends LiveSyncCommands {
|
||||
this.updateSettingCache();
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
updateSettingCache() {
|
||||
const ignorePatterns = getFileRegExp(this.plugin.settings, "syncInternalFilesIgnorePatterns");
|
||||
this.ignorePatterns = ignorePatterns;
|
||||
const targetFilter = getFileRegExp(this.plugin.settings, "syncInternalFilesTargetPatterns");
|
||||
this.targetPatterns = targetFilter;
|
||||
|
||||
this.shouldSkipFile = [] as FilePathWithPrefixLC[];
|
||||
// Exclude files handled by customization sync
|
||||
const configDir = normalizePath(this.app.vault.configDir);
|
||||
const shouldSKip = !this.settings.usePluginSync
|
||||
? []
|
||||
: Object.values(this.settings.pluginSyncExtendedSetting)
|
||||
.filter((e) => e.mode == MODE_SELECTIVE || e.mode == MODE_PAUSED)
|
||||
.map((e) => e.files)
|
||||
.flat()
|
||||
.map((e) => `${configDir}/${e}`.toLowerCase());
|
||||
this.shouldSkipFile = shouldSKip as FilePathWithPrefixLC[];
|
||||
this._log(`Hidden file will skip ${this.shouldSkipFile.length} files`, LOG_LEVEL_INFO);
|
||||
updateSettingCache() {
|
||||
this.cacheCustomisationSyncIgnoredFiles.clear();
|
||||
this.cacheFileRegExps.clear();
|
||||
}
|
||||
|
||||
isReady() {
|
||||
@@ -203,7 +188,6 @@ export class HiddenFileSync extends LiveSyncCommands {
|
||||
if (!this.isThisModuleEnabled()) return false;
|
||||
return true;
|
||||
}
|
||||
shouldSkipFile = [] as FilePathWithPrefixLC[];
|
||||
|
||||
async performStartupScan(showNotice: boolean) {
|
||||
await this.applyOfflineChanges(showNotice);
|
||||
@@ -232,10 +216,11 @@ export class HiddenFileSync extends LiveSyncCommands {
|
||||
? this.settings.syncInternalFilesInterval * 1000
|
||||
: 0
|
||||
);
|
||||
const ignorePatterns = getFileRegExp(this.plugin.settings, "syncInternalFilesIgnorePatterns");
|
||||
this.ignorePatterns = ignorePatterns;
|
||||
const targetFilter = getFileRegExp(this.plugin.settings, "syncInternalFilesTargetPatterns");
|
||||
this.targetPatterns = targetFilter;
|
||||
this.cacheFileRegExps.clear();
|
||||
// const ignorePatterns = getFileRegExp(this.plugin.settings, "syncInternalFilesIgnorePatterns");
|
||||
// this.ignorePatterns = ignorePatterns;
|
||||
// const targetFilter = getFileRegExp(this.plugin.settings, "syncInternalFilesTargetPatterns");
|
||||
// this.targetPatterns = targetFilter;
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
@@ -558,8 +543,11 @@ Offline Changed files: ${processFiles.length}`;
|
||||
forceWrite = false,
|
||||
includeDeleted = true
|
||||
): Promise<boolean | undefined> {
|
||||
if (this.shouldSkipFile.some((e) => e.startsWith(path.toLowerCase()))) {
|
||||
this._log(`Hidden file skipped: ${path} is synchronized in customization sync.`, LOG_LEVEL_VERBOSE);
|
||||
if (!(await this.isTargetFile(path))) {
|
||||
this._log(
|
||||
`Storage file tracking: Hidden file skipped: ${path} is filtered out by the defined patterns.`,
|
||||
LOG_LEVEL_VERBOSE
|
||||
);
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
@@ -862,6 +850,108 @@ Offline Changed files: ${processFiles.length}`;
|
||||
|
||||
// --> Database Event Functions
|
||||
|
||||
cacheFileRegExps = new Map<string, CustomRegExp[][]>();
|
||||
/**
|
||||
* Parses the regular expression settings for hidden file synchronization.
|
||||
* @returns An object containing the ignore and target filters.
|
||||
*/
|
||||
parseRegExpSettings() {
|
||||
const regExpKey = `${this.plugin.settings.syncInternalFilesTargetPatterns}||${this.plugin.settings.syncInternalFilesIgnorePatterns}`;
|
||||
let ignoreFilter: CustomRegExp[];
|
||||
let targetFilter: CustomRegExp[];
|
||||
if (this.cacheFileRegExps.has(regExpKey)) {
|
||||
const cached = this.cacheFileRegExps.get(regExpKey)!;
|
||||
ignoreFilter = cached[1];
|
||||
targetFilter = cached[0];
|
||||
} else {
|
||||
ignoreFilter = getFileRegExp(this.plugin.settings, "syncInternalFilesIgnorePatterns");
|
||||
targetFilter = getFileRegExp(this.plugin.settings, "syncInternalFilesTargetPatterns");
|
||||
this.cacheFileRegExps.clear();
|
||||
this.cacheFileRegExps.set(regExpKey, [targetFilter, ignoreFilter]);
|
||||
}
|
||||
return { ignoreFilter, targetFilter };
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the target file path matches the defined patterns.
|
||||
*/
|
||||
isTargetFileInPatterns(path: string): boolean {
|
||||
const { ignoreFilter, targetFilter } = this.parseRegExpSettings();
|
||||
|
||||
if (ignoreFilter && ignoreFilter.length > 0) {
|
||||
for (const pattern of ignoreFilter) {
|
||||
if (pattern.test(path)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (targetFilter && targetFilter.length > 0) {
|
||||
for (const pattern of targetFilter) {
|
||||
if (pattern.test(path)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// While having target patterns, it effects as an allow-list.
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
cacheCustomisationSyncIgnoredFiles = new Map<string, string[]>();
|
||||
/**
|
||||
* Gets the list of files ignored for customization synchronization.
|
||||
* @returns An array of ignored file paths (lowercase).
|
||||
*/
|
||||
getCustomisationSynchronizationIgnoredFiles(): string[] {
|
||||
const configDir = this.plugin.app.vault.configDir;
|
||||
const key =
|
||||
JSON.stringify(this.settings.pluginSyncExtendedSetting) + `||${this.settings.usePluginSync}||${configDir}`;
|
||||
if (this.cacheCustomisationSyncIgnoredFiles.has(key)) {
|
||||
return this.cacheCustomisationSyncIgnoredFiles.get(key)!;
|
||||
}
|
||||
this.cacheCustomisationSyncIgnoredFiles.clear();
|
||||
const synchronisedInConfigSync = !this.settings.usePluginSync
|
||||
? []
|
||||
: Object.values(this.settings.pluginSyncExtendedSetting)
|
||||
.filter((e) => e.mode == MODE_SELECTIVE || e.mode == MODE_PAUSED)
|
||||
.map((e) => e.files)
|
||||
.flat()
|
||||
.map((e) => `${configDir}/${e}`.toLowerCase());
|
||||
this.cacheCustomisationSyncIgnoredFiles.set(key, synchronisedInConfigSync);
|
||||
return synchronisedInConfigSync;
|
||||
}
|
||||
/**
|
||||
* Checks if the given path is not ignored by customization synchronization.
|
||||
* @param path The file path to check.
|
||||
* @returns True if the path is not ignored; otherwise, false.
|
||||
*/
|
||||
isNotIgnoredByCustomisationSync(path: string): boolean {
|
||||
const ignoredFiles = this.getCustomisationSynchronizationIgnoredFiles();
|
||||
const result = !ignoredFiles.some((e) => path.startsWith(e));
|
||||
// console.warn(`Assertion: isNotIgnoredByCustomisationSync(${path}) = ${result}`);
|
||||
return result;
|
||||
}
|
||||
|
||||
isHiddenFileSyncHandlingPath(path: FilePath): boolean {
|
||||
const result = path.startsWith(".") && !path.startsWith(".trash");
|
||||
// console.warn(`Assertion: isHiddenFileSyncHandlingPath(${path}) = ${result}`);
|
||||
return result;
|
||||
}
|
||||
|
||||
async isTargetFile(path: FilePath): Promise<boolean> {
|
||||
const result =
|
||||
this.isTargetFileInPatterns(path) &&
|
||||
this.isNotIgnoredByCustomisationSync(path) &&
|
||||
this.isHiddenFileSyncHandlingPath(path);
|
||||
// console.warn(`Assertion: isTargetFile(${path}) : ${result ? "✔️" : "❌"}`);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
const resultByFile = await this.services.vault.isIgnoredByIgnoreFile(path);
|
||||
// console.warn(`${path} -> isIgnoredByIgnoreFile: ${resultByFile ? "❌" : "✔️"}`);
|
||||
return !resultByFile;
|
||||
}
|
||||
|
||||
async trackScannedDatabaseChange(
|
||||
processFiles: MetaEntry[],
|
||||
showNotice: boolean = false,
|
||||
@@ -875,14 +965,21 @@ Offline Changed files: ${processFiles.length}`;
|
||||
const processes = processFiles.map(async (file) => {
|
||||
try {
|
||||
const path = stripAllPrefixes(this.getPath(file));
|
||||
await this.trackDatabaseFileModification(
|
||||
path,
|
||||
"[Hidden file scan]",
|
||||
!forceWriteAll,
|
||||
onlyNew,
|
||||
file,
|
||||
includeDeletion
|
||||
);
|
||||
if (!(await this.isTargetFile(path))) {
|
||||
this._log(
|
||||
`Database file tracking: Hidden file skipped: ${path} is filtered out by the defined patterns.`,
|
||||
LOG_LEVEL_VERBOSE
|
||||
);
|
||||
} else {
|
||||
await this.trackDatabaseFileModification(
|
||||
path,
|
||||
"[Hidden file scan]",
|
||||
!forceWriteAll,
|
||||
onlyNew,
|
||||
file,
|
||||
includeDeletion
|
||||
);
|
||||
}
|
||||
notifyProgress();
|
||||
} catch (ex) {
|
||||
this._log(`Failed to process storage change file:${file}`, logLevel);
|
||||
@@ -1215,7 +1312,13 @@ Offline Changed files: ${files.length}`;
|
||||
).rows
|
||||
.filter((e) => isInternalMetadata(e.id as DocumentID))
|
||||
.map((e) => e.doc) as MetaEntry[];
|
||||
return allFiles;
|
||||
const files = [] as MetaEntry[];
|
||||
for (const file of allFiles) {
|
||||
if (await this.isTargetFile(stripAllPrefixes(this.getPath(file)))) {
|
||||
files.push(file);
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
async rebuildFromDatabase(showNotice: boolean, targetFiles: FilePath[] | false = false, onlyNew = false) {
|
||||
@@ -1696,29 +1799,13 @@ ${messageFetch}${messageOverwrite}${messageMerge}
|
||||
// <-- Configuration handling
|
||||
|
||||
// --> Local Storage SubFunctions
|
||||
ignorePatterns: CustomRegExp[] = [];
|
||||
targetPatterns: CustomRegExp[] = [];
|
||||
async scanInternalFileNames() {
|
||||
const configDir = normalizePath(this.app.vault.configDir);
|
||||
const ignoreFilter = getFileRegExp(this.plugin.settings, "syncInternalFilesIgnorePatterns");
|
||||
const targetFilter = getFileRegExp(this.plugin.settings, "syncInternalFilesTargetPatterns");
|
||||
const synchronisedInConfigSync = !this.settings.usePluginSync
|
||||
? []
|
||||
: Object.values(this.settings.pluginSyncExtendedSetting)
|
||||
.filter((e) => e.mode == MODE_SELECTIVE || e.mode == MODE_PAUSED)
|
||||
.map((e) => e.files)
|
||||
.flat()
|
||||
.map((e) => `${configDir}/${e}`.toLowerCase());
|
||||
const root = this.app.vault.getRoot();
|
||||
const findRoot = root.path;
|
||||
|
||||
const filenames = (await this.getFiles(findRoot, [], targetFilter, ignoreFilter))
|
||||
.filter((e) => e.startsWith("."))
|
||||
.filter((e) => !e.startsWith(".trash"));
|
||||
const files = filenames.filter((path) =>
|
||||
synchronisedInConfigSync.every((filterFile) => !path.toLowerCase().startsWith(filterFile))
|
||||
);
|
||||
return files as FilePath[];
|
||||
const filenames = await this.getFiles(findRoot, (path) => this.isTargetFile(path));
|
||||
|
||||
return filenames as FilePath[];
|
||||
}
|
||||
|
||||
async scanInternalFiles(): Promise<InternalFileInfo[]> {
|
||||
@@ -1748,7 +1835,32 @@ ${messageFetch}${messageOverwrite}${messageMerge}
|
||||
return result;
|
||||
}
|
||||
|
||||
async getFiles(path: string, ignoreList: string[], filter?: CustomRegExp[], ignoreFilter?: CustomRegExp[]) {
|
||||
async getFiles(path: string, checkFunction: (path: FilePath) => Promise<boolean> | boolean) {
|
||||
let w: ListedFiles;
|
||||
try {
|
||||
w = await this.app.vault.adapter.list(path);
|
||||
} catch (ex) {
|
||||
this._log(`Could not traverse(HiddenSync):${path}`, LOG_LEVEL_INFO);
|
||||
this._log(ex, LOG_LEVEL_VERBOSE);
|
||||
return [];
|
||||
}
|
||||
let files = [] as string[];
|
||||
for (const file of w.files) {
|
||||
if (!(await checkFunction(file as FilePath))) {
|
||||
continue;
|
||||
}
|
||||
files.push(file);
|
||||
}
|
||||
for (const v of w.folders) {
|
||||
if (!(await checkFunction(v as FilePath))) {
|
||||
continue;
|
||||
}
|
||||
files = files.concat(await this.getFiles(v, checkFunction));
|
||||
}
|
||||
return files;
|
||||
}
|
||||
/*
|
||||
async getFiles_(path: string, ignoreList: string[], filter?: CustomRegExp[], ignoreFilter?: CustomRegExp[]) {
|
||||
let w: ListedFiles;
|
||||
try {
|
||||
w = await this.app.vault.adapter.list(path);
|
||||
@@ -1785,11 +1897,11 @@ ${messageFetch}${messageOverwrite}${messageMerge}
|
||||
if (await this.services.vault.isIgnoredByIgnoreFile(v)) {
|
||||
continue L1;
|
||||
}
|
||||
files = files.concat(await this.getFiles(v, ignoreList, filter, ignoreFilter));
|
||||
files = files.concat(await this.getFiles_(v, ignoreList, filter, ignoreFilter));
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
*/
|
||||
// <-- Local Storage SubFunctions
|
||||
|
||||
onBindFunction(core: LiveSyncCore, services: typeof core.services) {
|
||||
|
||||
2
src/lib
2
src/lib
Submodule src/lib updated: 5e352d3093...08b43da7fb
@@ -26,6 +26,7 @@ export class ModuleTargetFilter extends AbstractModule {
|
||||
this.ignoreFiles = this.settings.ignoreFiles.split(",").map((e) => e.trim());
|
||||
}
|
||||
private _everyOnload(): Promise<boolean> {
|
||||
this.reloadIgnoreFiles();
|
||||
eventHub.onEvent(EVENT_SETTING_SAVED, (evt: ObsidianLiveSyncSettings) => {
|
||||
this.reloadIgnoreFiles();
|
||||
});
|
||||
@@ -132,12 +133,19 @@ export class ModuleTargetFilter extends AbstractModule {
|
||||
ignoreFiles = [] as string[];
|
||||
async readIgnoreFile(path: string) {
|
||||
try {
|
||||
const file = await this.core.storageAccess.readFileText(path);
|
||||
// this._log(`[ignore]Reading ignore file: ${path}`, LOG_LEVEL_VERBOSE);
|
||||
if (!(await this.core.storageAccess.isExistsIncludeHidden(path))) {
|
||||
this.ignoreFileCache.set(path, false);
|
||||
// this._log(`[ignore]Ignore file not found: ${path}`, LOG_LEVEL_VERBOSE);
|
||||
return false;
|
||||
}
|
||||
const file = await this.core.storageAccess.readHiddenFileText(path);
|
||||
const gitignore = file.split(/\r?\n/g);
|
||||
this.ignoreFileCache.set(path, gitignore);
|
||||
this._log(`[ignore]Ignore file loaded: ${path}`, LOG_LEVEL_VERBOSE);
|
||||
return gitignore;
|
||||
} catch (ex) {
|
||||
this._log(`Failed to read ignore file ${path}`);
|
||||
this._log(`[ignore]Failed to read ignore file ${path}`);
|
||||
this._log(ex, LOG_LEVEL_VERBOSE);
|
||||
this.ignoreFileCache.set(path, false);
|
||||
return false;
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
type UXFileInfoStub,
|
||||
type UXInternalFileInfoStub,
|
||||
} from "../../../lib/src/common/types.ts";
|
||||
import { delay, fireAndForget, getFileRegExp } from "../../../lib/src/common/utils.ts";
|
||||
import { delay, fireAndForget } from "../../../lib/src/common/utils.ts";
|
||||
import { type FileEventItem } from "../../../common/types.ts";
|
||||
import { serialized, skipIfDuplicated } from "octagonal-wheels/concurrency/lock";
|
||||
import {
|
||||
@@ -27,6 +27,7 @@ import type { LiveSyncCore } from "../../../main.ts";
|
||||
import { InternalFileToUXFileInfoStub, TFileToUXFileInfoStub } from "./utilObsidian.ts";
|
||||
import ObsidianLiveSyncPlugin from "../../../main.ts";
|
||||
import type { StorageAccess } from "../../interfaces/StorageAccess.ts";
|
||||
import { HiddenFileSync } from "../../../features/HiddenFileSync/CmdHiddenFileSync.ts";
|
||||
// import { InternalFileToUXFileInfo } from "../platforms/obsidian.ts";
|
||||
|
||||
export type FileEvent = {
|
||||
@@ -62,11 +63,15 @@ export class StorageEventManagerObsidian extends StorageEventManager {
|
||||
get batchSaveMaximumDelay(): number {
|
||||
return this.core.settings?.batchSaveMaximumDelay ?? DEFAULT_SETTINGS.batchSaveMaximumDelay;
|
||||
}
|
||||
// Necessary evil.
|
||||
cmdHiddenFileSync: HiddenFileSync;
|
||||
|
||||
constructor(plugin: ObsidianLiveSyncPlugin, core: LiveSyncCore, storageAccess: StorageAccess) {
|
||||
super();
|
||||
this.storageAccess = storageAccess;
|
||||
this.plugin = plugin;
|
||||
this.core = core;
|
||||
this.cmdHiddenFileSync = this.plugin.getAddOn(HiddenFileSync.name) as HiddenFileSync;
|
||||
}
|
||||
beginWatch() {
|
||||
const plugin = this.plugin;
|
||||
@@ -181,22 +186,20 @@ export class StorageEventManagerObsidian extends StorageEventManager {
|
||||
// (Calling$$isTargetFile will refresh the cache)
|
||||
void this.services.vault.isTargetFile(path).then(() => this._watchVaultRawEvents(path));
|
||||
} else {
|
||||
this._watchVaultRawEvents(path);
|
||||
void this._watchVaultRawEvents(path);
|
||||
}
|
||||
}
|
||||
|
||||
_watchVaultRawEvents(path: FilePath) {
|
||||
async _watchVaultRawEvents(path: FilePath) {
|
||||
if (!this.plugin.settings.syncInternalFiles && !this.plugin.settings.usePluginSync) return;
|
||||
if (!this.plugin.settings.watchInternalFileChanges) return;
|
||||
if (!path.startsWith(this.plugin.app.vault.configDir)) return;
|
||||
const ignorePatterns = getFileRegExp(this.plugin.settings, "syncInternalFilesIgnorePatterns");
|
||||
const targetPatterns = getFileRegExp(this.plugin.settings, "syncInternalFilesTargetPatterns");
|
||||
if (ignorePatterns.some((e) => e.test(path))) return;
|
||||
if (!targetPatterns.some((e) => e.test(path))) return;
|
||||
if (path.endsWith("/")) {
|
||||
// Folder
|
||||
return;
|
||||
}
|
||||
const isTargetFile = await this.cmdHiddenFileSync.isTargetFile(path);
|
||||
if (!isTargetFile) return;
|
||||
|
||||
void this.appendQueue(
|
||||
[
|
||||
|
||||
140
updates.md
140
updates.md
@@ -4,9 +4,16 @@ Since 19th July, 2025 (beta1 in 0.25.0-beta1, 13th July, 2025)
|
||||
|
||||
The head note of 0.25 is now in [updates_old.md](https://github.com/vrtmrz/obsidian-livesync/blob/main/updates_old.md). Because 0.25 got a lot of updates, thankfully, compatibility is kept and we do not need breaking changes! In other words, when get enough stabled. The next version will be v1.0.0. Even though it my hope.
|
||||
|
||||
## 0.25.24.beta3
|
||||
## 0.25.24
|
||||
|
||||
31st October, 2025
|
||||
04th November, 2025
|
||||
|
||||
(Beta release notes have been consolidated to this note).
|
||||
|
||||
### Guidance and UI improvements!
|
||||
|
||||
Since several issues were pointed out, our setup procedure had been quite `system-oriented`. This is not good for users. Therefore, I have changed the procedure to be more `goal-oriented`. I have made extensive use of Svelte, resulting in a very straightforward setup.
|
||||
While I would like to accelerate documentation and i18n adoption, I do not want to confuse everyone who's already working on it. Therefore, I have decided to release a Beta version at this stage. Significant changes are not expected from this point onward, so I will proceed to stabilise the codebase. (However, this is significant).
|
||||
|
||||
### TURN server support and important notice
|
||||
|
||||
@@ -18,19 +25,10 @@ servers. Even if your data are encrypted, your existence may be known to them. P
|
||||
server provider before using their services. Also your `network administrator` too. You should consider setting
|
||||
up your own TURN server for your FQDN, if possible.
|
||||
|
||||
### Fixed
|
||||
|
||||
- We can enter the fields in some dialogues correctly on mobile devices now.
|
||||
- The bottom padding is adjusted dynamically according to the keyboard height.
|
||||
|
||||
### New features
|
||||
|
||||
- We can use the TURN server for P2P connections now.
|
||||
|
||||
## ~~0.25.24.beta1~~ 0.25.24.beta2 (For release mistake)
|
||||
|
||||
30th October, 2025
|
||||
|
||||
### Fixed
|
||||
|
||||
- P2P Replication got more robust and stable.
|
||||
@@ -40,39 +38,9 @@ up your own TURN server for your FQDN, if possible.
|
||||
- While in the background, the connection to the signalling server is now disconnected to save resources.
|
||||
- When returning to the foreground, it will not reconnect automatically for safety. Please reconnect manually.
|
||||
- All connection configurations should be edited in each dedicated dialogue now.
|
||||
|
||||
### Breaking changes
|
||||
|
||||
- Sending configuration via Peer-to-Peer connection is not compatible with older versions.
|
||||
- Please upgrade all devices to v0.25.24.beta1 or later to use this feature again.
|
||||
- This is due to security improvements in the encryption scheme.
|
||||
|
||||
## 0.25.23
|
||||
|
||||
26th October, 2025
|
||||
|
||||
The next version we are preparing (you know that as 0.25.23.beta1) is now still on beta, resulting in this rather unfortunate versioning situation. Apologies for the confusion. The next v0.25.23.beta2 will be v0.25.24.beta1. In other words, this is a v0.25.22.patch-1 actually, but possibly not allowed by Obsidian's rule.
|
||||
(Perhaps we ought to declare 1.0.0 with a little more confidence. The current minor part has been effectively a major one for a long time. If it were 1.22.1 and 1.23.0.beta1, no confusion ).
|
||||
|
||||
### Fixed
|
||||
|
||||
- We are now able to enable optional features correctly again (#732).
|
||||
- No longer oversized files have been processed, furthermore.
|
||||
- Before creating a chunk, the file is verified as the target.
|
||||
- The behaviour upon receiving replication has been changed as follows:
|
||||
- If the remote file is oversized, it is ignored.
|
||||
- If not, but while the local file is oversized, it is also ignored.
|
||||
|
||||
## 0.25.23.beta1
|
||||
|
||||
22nd October, 2025
|
||||
|
||||
Since several issues were pointed out, our setup procedure had been quite `system-oriented`. This is not good for users. Therefore, I have changed the procedure to be more `goal-oriented`. I have made extensive use of Svelte, resulting in a very straightforward setup.
|
||||
While I would like to accelerate documentation and i18n adoption, I do not want to confuse everyone who's already working on it. Therefore, I have decided to release a Beta version at this stage. Significant changes are not expected from this point onward, so I will proceed to stabilise the codebase. (However, this is significant).
|
||||
|
||||
### Fixed (This should be backported to 0.25.22 if the beta phase is prolonged)
|
||||
|
||||
- No longer will larger files create chunks during preparing `Reset Synchronisation on This Device`.
|
||||
- Now hidden file synchronisation respects the filters correctly (#631, #735)
|
||||
- And `ignore-files` settings are also respected and surely read during the start-up.
|
||||
|
||||
### Behaviour changes
|
||||
|
||||
@@ -98,42 +66,37 @@ While I would like to accelerate documentation and i18n adoption, I do not want
|
||||
- Many dependencies are updated. Please see `package.json`.
|
||||
- This is the hardest part of this update. I read most of the changes in the dependencies. If you find any extra information, please let me know.
|
||||
- As upgrading TypeScript, Fixed many UInt8Array<ArrayBuffer> and Uint8Array type mismatches.
|
||||
-
|
||||
|
||||
## 0.25.23.beta1
|
||||
### Breaking changes
|
||||
|
||||
22nd October, 2025
|
||||
- Sending configuration via Peer-to-Peer connection is not compatible with older versions.
|
||||
- Please upgrade all devices to v0.25.24.beta1 or later to use this feature again.
|
||||
- This is due to security improvements in the encryption scheme.
|
||||
|
||||
Since several issues pointed, our set-up procedure had been quite `system-oriented`. This is not good for users. Therefore, I have changed the procedure to be more `goal-oriented`. I have made extensive use of Svelte, resulting in a very straightforward setup.
|
||||
While I would like to accelerate documentation and i18n adoption, I do not want to confuse everyone who's already working on it. Therefore, I have decided to release a Beta version at this stage. Significant changes are not expected from this point onward, so I will proceed to stabilise the codebase. (However, this is the significant).
|
||||
## 0.25.23
|
||||
|
||||
### Fixed (This should be backported to 0.25.22 if the beta phase is prolonged)
|
||||
26th October, 2025
|
||||
|
||||
- No longer larger files will not create a chunks during preparing `Reset Synchronisation on This Device`.
|
||||
The next version we are preparing (you know that as 0.25.23.beta1) is now still on beta, resulting in this rather unfortunate versioning situation. Apologies for the confusion. The next v0.25.23.beta2 will be v0.25.24.beta1. In other words, this is a v0.25.22.patch-1 actually, but possibly not allowed by Obsidian's rule.
|
||||
(Perhaps we ought to declare 1.0.0 with a little more confidence. The current minor part has been effectively a major one for a long time. If it were 1.22.1 and 1.23.0.beta1, no confusion ).
|
||||
|
||||
### Behaviour changes
|
||||
### Fixed
|
||||
|
||||
- Setup wizard is now more `goal-oriented`. Brand-new screens are introduced.
|
||||
- `Fetch everything` and `Rebuild everything` is now `Reset Synchronisation on This Device` and `Overwrite Server Data with This Device's Files`.
|
||||
- Remote configuration and E2EE settings are now separated to each modal dialogue.
|
||||
- Remote configuration is now more straightforward. And if we need the rebuild (No... `Overwrite Server Data with This Device's Files`), it is now clearly indicated.
|
||||
- Peer-to-Peer settings is also separated into its own modal dialogue (still in progress, and we need to open a P2P pane, still).
|
||||
- Setup-URI, and Report for the Issue are now not copied to clipboard automatically. Instead, there are copy dialogue and buttons to copy them explicitly.
|
||||
- This is to avoid confusion for users who do not want to use these features.
|
||||
- No longer optional features are introduced during the setup or `Reset Synchronisation on This Device`, `Overwrite Server Data with This Device's Files`.
|
||||
- This is to avoid confusion for users who do not want to use these features. Instead, we will noticed that optional features are available after the setup is completed.
|
||||
- We cannot preform `Fetch everything` and `Rebuild everything` (Removed, so the old name) without restarting Obsidian now.
|
||||
- We are now able to enable optional features correctly again (#732).
|
||||
- No longer oversized files have been processed, furthermore.
|
||||
|
||||
### Miscellaneous
|
||||
- Before creating a chunk, the file is verified as the target.
|
||||
- The behaviour upon receiving replication has been changed as follows:
|
||||
- If the remote file is oversized, it is ignored.
|
||||
- If not, but while the local file is oversized, it is also ignored.
|
||||
|
||||
- Setup QR Code generation is separated into a src/lib/src/API/processSetting.ts file. Please use it as a subrepository if you want to generate QR codes in your own application.
|
||||
- Setup-URI is also separated into a src/lib/src/API/processSetting.ts
|
||||
- Some direct access to web-APIs are now wrapped into the services layer.
|
||||
|
||||
### Dependency updates
|
||||
|
||||
- Many dependencies are updated. Please see `package.json`.
|
||||
- This is the hardest part of this update. I read mostly all changes in the dependencies. If you find any extra information, please let me know.
|
||||
- As upgrading TypeScript, Fixed many UInt8Array<ArrayBuffer> and Uint8Array type mismatches.
|
||||
- We are now able to enable optional features correctly again (#732).
|
||||
- No longer oversized files have been processed, furthermore.
|
||||
- Before creating a chunk, the file is verified as the target.
|
||||
- The behaviour upon receiving replication has been changed as follows:
|
||||
- If the remote file is oversized, it is ignored.
|
||||
- If not, but while the local file is oversized, it is also ignored.
|
||||
|
||||
## 0.25.22
|
||||
|
||||
@@ -158,42 +121,5 @@ While I would like to accelerate documentation and i18n adoption, I do not want
|
||||
- Sync on Editor save seems not to work correctly in some cases.
|
||||
- I am investigating this issue. If you have any information, please let me know.
|
||||
|
||||
## 0.25.21
|
||||
|
||||
13th October, 2025
|
||||
|
||||
This release including 0.25.21.beta1 and 0.25.21.beta2.
|
||||
|
||||
Apologies for taking a little time. I was seriously tackling this.
|
||||
(Of course, being caught up in an unfamiliar structure due to personnel changes on my workplace played a part, but fortunately I have returned to a place where I can do research and development rather than production. Completely beside the point, though).
|
||||
Now then, this time, moving away from 'convention over configuration', I have changed to a mechanism for manually binding events. This makes it much easier to leverage IDE assistance.
|
||||
And, also, we are ready to separate `Features` and `APIs` from `Module`. Features are still in the module, but APIs will be moved to a Service layer. This will make it easier to maintain and extend the codebase in the future.
|
||||
|
||||
If you have found any issues, please let me know. I am now on the following:
|
||||
|
||||
- GitHub [Issues](https://github.com/vrtmrz/obsidian-livesync/issues) Excellent! May the other contributors will help you too.
|
||||
- Twitter [@vorotamoroz](https://twitter.com/vorotamoroz) Quickest!
|
||||
- Matrix [@vrtmrz:matrix.org](https://matrix.to/#/@vrtmrz:matrix.org) Also quick, and if you need to keep it private!
|
||||
I am creating rooms too, but I'm struggling to figure out how to use them effectively because I cannot tell the difference of use-case between them and discussions. However, if you want to use Discord, this is a answer; We should on E2E encrypted platform.
|
||||
|
||||
## 0.25.21.beta2
|
||||
|
||||
8th October, 2025
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed wrong event type bindings (which caused some events not to be handled correctly).
|
||||
- Fixed detected a timing issue in StorageEventManager
|
||||
- When multiple events for the same file are fired in quick succession, metadata has been kept older information. This induces unexpected wrong notifications and write prevention.
|
||||
|
||||
## 0.25.21.beta1
|
||||
|
||||
6th October, 2025
|
||||
|
||||
### Refactored
|
||||
|
||||
- Event handling now does not rely on 'convention over configuration'.
|
||||
- Services.ts now have a proper event handler registration system.
|
||||
|
||||
Older notes are in
|
||||
[updates_old.md](https://github.com/vrtmrz/obsidian-livesync/blob/main/updates_old.md).
|
||||
|
||||
@@ -10,6 +10,43 @@ As a result, this is the first time in a while that forward compatibility has be
|
||||
|
||||
---
|
||||
|
||||
## 0.25.21
|
||||
|
||||
13th October, 2025
|
||||
|
||||
This release including 0.25.21.beta1 and 0.25.21.beta2.
|
||||
|
||||
Apologies for taking a little time. I was seriously tackling this.
|
||||
(Of course, being caught up in an unfamiliar structure due to personnel changes on my workplace played a part, but fortunately I have returned to a place where I can do research and development rather than production. Completely beside the point, though).
|
||||
Now then, this time, moving away from 'convention over configuration', I have changed to a mechanism for manually binding events. This makes it much easier to leverage IDE assistance.
|
||||
And, also, we are ready to separate `Features` and `APIs` from `Module`. Features are still in the module, but APIs will be moved to a Service layer. This will make it easier to maintain and extend the codebase in the future.
|
||||
|
||||
If you have found any issues, please let me know. I am now on the following:
|
||||
|
||||
- GitHub [Issues](https://github.com/vrtmrz/obsidian-livesync/issues) Excellent! May the other contributors will help you too.
|
||||
- Twitter [@vorotamoroz](https://twitter.com/vorotamoroz) Quickest!
|
||||
- Matrix [@vrtmrz:matrix.org](https://matrix.to/#/@vrtmrz:matrix.org) Also quick, and if you need to keep it private!
|
||||
I am creating rooms too, but I'm struggling to figure out how to use them effectively because I cannot tell the difference of use-case between them and discussions. However, if you want to use Discord, this is a answer; We should on E2E encrypted platform.
|
||||
|
||||
## 0.25.21.beta2
|
||||
|
||||
8th October, 2025
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed wrong event type bindings (which caused some events not to be handled correctly).
|
||||
- Fixed detected a timing issue in StorageEventManager
|
||||
- When multiple events for the same file are fired in quick succession, metadata has been kept older information. This induces unexpected wrong notifications and write prevention.
|
||||
|
||||
## 0.25.21.beta1
|
||||
|
||||
6th October, 2025
|
||||
|
||||
### Refactored
|
||||
|
||||
- Event handling now does not rely on 'convention over configuration'.
|
||||
- Services.ts now have a proper event handler registration system.
|
||||
|
||||
## 0.25.20
|
||||
|
||||
26th September, 2025
|
||||
|
||||
@@ -12,18 +12,22 @@ if [[ -z "$password" ]]; then
|
||||
echo "ERROR: Password missing"
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "$node" ]]; then
|
||||
echo "INFO: defaulting to _local"
|
||||
node=_local
|
||||
fi
|
||||
|
||||
echo "-- Configuring CouchDB by REST APIs... -->"
|
||||
|
||||
until (curl -X POST "${hostname}/_cluster_setup" -H "Content-Type: application/json" -d "{\"action\":\"enable_single_node\",\"username\":\"${username}\",\"password\":\"${password}\",\"bind_address\":\"0.0.0.0\",\"port\":5984,\"singlenode\":true}" --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/nonode@nohost/_config/chttpd/require_valid_user" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/nonode@nohost/_config/chttpd_auth/require_valid_user" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/nonode@nohost/_config/httpd/WWW-Authenticate" -H "Content-Type: application/json" -d '"Basic realm=\"couchdb\""' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/nonode@nohost/_config/httpd/enable_cors" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/nonode@nohost/_config/chttpd/enable_cors" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/nonode@nohost/_config/chttpd/max_http_request_size" -H "Content-Type: application/json" -d '"4294967296"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/nonode@nohost/_config/couchdb/max_document_size" -H "Content-Type: application/json" -d '"50000000"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/nonode@nohost/_config/cors/credentials" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/nonode@nohost/_config/cors/origins" -H "Content-Type: application/json" -d '"app://obsidian.md,capacitor://localhost,http://localhost"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/${node}/_config/chttpd/require_valid_user" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/${node}/_config/chttpd_auth/require_valid_user" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/${node}/_config/httpd/WWW-Authenticate" -H "Content-Type: application/json" -d '"Basic realm=\"couchdb\""' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/${node}/_config/httpd/enable_cors" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/${node}/_config/chttpd/enable_cors" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/${node}/_config/chttpd/max_http_request_size" -H "Content-Type: application/json" -d '"4294967296"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/${node}/_config/couchdb/max_document_size" -H "Content-Type: application/json" -d '"50000000"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/${node}/_config/cors/credentials" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
|
||||
until (curl -X PUT "${hostname}/_node/${node}/_config/cors/origins" -H "Content-Type: application/json" -d '"app://obsidian.md,capacitor://localhost,http://localhost"' --user "${username}:${password}"); do sleep 5; done
|
||||
|
||||
echo "<-- Configuring CouchDB by REST APIs Done!"
|
||||
echo "<-- Configuring CouchDB by REST APIs Done!"
|
||||
|
||||
Reference in New Issue
Block a user