- Application LifeCycle has now started in Main, not ServiceHub.

This commit is contained in:
vorotamoroz
2026-02-14 15:21:00 +09:00
parent fb59c4a723
commit 6e9ac6a9f9
10 changed files with 34 additions and 26 deletions

View File

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

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "obsidian-livesync",
"version": "0.25.43-patched-1",
"version": "0.25.43-patched-2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "obsidian-livesync",
"version": "0.25.43-patched-1",
"version": "0.25.43-patched-2",
"license": "MIT",
"dependencies": {
"@aws-sdk/client-s3": "^3.808.0",

View File

@@ -1,6 +1,6 @@
{
"name": "obsidian-livesync",
"version": "0.25.43-patched-1",
"version": "0.25.43-patched-2",
"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",

Submodule src/lib updated: 532f25f947...69e7a510f1

View File

@@ -205,8 +205,13 @@ export default class ObsidianLiveSyncPlugin
syncStatus: "CLOSED" as DatabaseConnectingStatus,
});
private async _startUp() {
await this.services.appLifecycle.onLoad();
const onReady = this.services.appLifecycle.onReady.bind(this.services.appLifecycle);
this.app.workspace.onLayoutReady(onReady);
}
onload() {
void this.services.appLifecycle.onLoad();
void this._startUp();
}
async saveSettings() {
await this.services.setting.saveSettingData();

View File

@@ -78,7 +78,7 @@ export class ModuleInitializerFile extends AbstractModule {
const _filesStorage = [] as typeof filesStorageSrc;
for (const f of filesStorageSrc) {
if (await this.services.vault.isTargetFile(f.path, f != filesStorageSrc[0])) {
if (await this.services.vault.isTargetFile(f.path)) {
_filesStorage.push(f);
}
}
@@ -122,7 +122,7 @@ export class ModuleInitializerFile extends AbstractModule {
);
const path = this.getPath(doc);
if (isValidPath(path) && (await this.services.vault.isTargetFile(path, true))) {
if (isValidPath(path) && (await this.services.vault.isTargetFile(path))) {
if (!isMetaEntry(doc)) {
this._log(`Invalid entry: ${path}`, LOG_LEVEL_INFO);
continue;

View File

@@ -133,7 +133,7 @@ export class ModuleMigration extends AbstractModule {
if (!isValidPath(path)) {
continue;
}
if (!(await this.services.vault.isTargetFile(path, true))) {
if (!(await this.services.vault.isTargetFile(path))) {
continue;
}
if (!isMetaEntry(metaDoc)) {

View File

@@ -69,7 +69,7 @@ export class ModuleObsidianEvents extends AbstractObsidianModule {
//@ts-ignore
window.CodeMirrorAdapter.commands.save = () => {
//@ts-ignore
_this.app.commands.executeCommandById("editor:save-file");
void _this.app.commands.executeCommandById("editor:save-file");
// _this.app.performCommand('editor:save-file');
};
}

View File

@@ -9,12 +9,6 @@ declare module "obsidian" {
}
// InjectableAppLifecycleService
export class ObsidianAppLifecycleService<T extends ObsidianServiceContext> extends AppLifecycleServiceBase<T> {
constructor(context: T) {
super(context);
// The main entry point when Obsidian's workspace is ready
const onReady = this.onReady;
this.context.app.workspace.onLayoutReady(onReady);
}
performRestart(): void {
void this.context.plugin.app.commands.executeCommandById("app:reload");
}

View File

@@ -3,11 +3,21 @@ 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.43-patched-2
14th February, 2026
### Fixed
- Application LifeCycle has now started in Main, not ServiceHub.
- Indeed, ServiceHub cannot be known other things in main have got ready, so it is quite natural to start the lifecycle in main.
## 0.25.43-patched-1
13th February, 2026
You know this is a patch version, is the beta-release practically? Do not worry about the following memos, as they are indeed freaking us out. I trust that you have thought this was too large; you're right.
**NOTE: Hidden File Sync and Customisation Sync may not work in this version.**
Just a heads-up: this is a patch version, which is essentially a beta release. Do not worry about the following memos, as they are indeed freaking us out. I trust that you have thought this was too large; you're right.
If this cannot be stable, I will revert to 0.24.43 and try again.
@@ -16,23 +26,22 @@ If this cannot be stable, I will revert to 0.24.43 and try again.
- Now resolving unexpected and inexplicable dependency order issues...
- The function which is able to implement to the service is now moved to each service.
- AppLifecycleService.performRestart
- VaultService.isTargetFile is now uses separated multiple checkers instead of a single function.
- VaultService.isTargetFile is now using multiple checkers instead of a single function.
- This change allows better separation of concerns and easier extension in the future.
- Application LifeCycle has now started in ServiceHub, not ObsidianMenuModule.
- It was on a QUITE unexpected place..., isn't it?
- It was in a QUITE unexpected place..., isn't it?
- Instead of, we should call `await this.services.appLifecycle.onReady()` in other platforms.
- As in browser platform, it will be called at `DOMContentLoaded` event.
- As in the browser platform, it will be called at `DOMContentLoaded` event.
- ModuleTargetFilter, which is responsible for parsing ignore files has been refined.
- This should be separated to a TargetFilter and a IgnoreFileFilter for better maintainability.
- ModuleTargetFilter, which is responsible for parsing ignore files, has been refined.
- This should be separated to a TargetFilter and an IgnoreFileFilter for better maintainability.
- Using `API.addCommand` or some Obsidian API and shimmer APIs, Many modules have been refactored to be derived to AbstractModule from AbstractObsidianModule, to clarify the dependencies. (we should make `app` usage clearer...)
- Fixed initialising `storageAccess` too late in `FileAccessObsidian` module (I am still wonder why it worked before...).
- Fixed initialising `storageAccess` too late in `FileAccessObsidian` module (I am still wondering why it worked before...).
- Remove some redundant overrides in modules.
### Planned
- Some services have ambiguous name, such as `Injectable`. These will be renamed in the future for better clarity.
- Some services have an ambiguous name, such as `Injectable`. These will be renamed in the future for better clarity.
- Following properties of `ObsidianLiveSyncPlugin` should be initialised more explicitly:
- property : where it is initialised currently
- `localDatabase` : `ModuleLocalDatabaseObsidian`
@@ -44,7 +53,7 @@ If this cannot be stable, I will revert to 0.24.43 and try again.
- `fileHandler` : `ModuleFileHandler`
- `rebuilder` : `ModuleRebuilder`
- `kvDB`: `ModuleKeyValueDB`
- And I think that having feature in modules directly is not good for maintainability, these should be separated to some module (loader) and implementation (not only service, but also independent something).
- And I think that having a feature in modules directly is not good for maintainability, these should be separated to some module (loader) and implementation (not only service, but also independent something).
- Plug-in statuses such as requestCount, responseCount... should be moved to a status service or somewhere for better separation of concerns.
## 0.25.43