internal: move home server into internal flag

This commit is contained in:
Mo
2023-07-05 10:53:10 -05:00
parent d4db3e055c
commit c9c93d143a
16 changed files with 47 additions and 29 deletions

View File

@@ -4,7 +4,7 @@ import {
HomeServerManagerInterface,
HomeServerEnvironmentConfiguration,
} from '@web/Application/Device/DesktopSnjsExports'
import { HomeServer, HomeServerInterface } from '@standardnotes/home-server'
import { HomeServerInterface } from '@standardnotes/home-server'
import { WebContents } from 'electron'
import { MessageToWebApp } from '../../Shared/IpcMessages'
@@ -127,7 +127,7 @@ export class HomeServerManager implements HomeServerManagerInterface {
}
async startHomeServer(): Promise<string | undefined> {
this.doNotInstantiateHomeServerOnWindowsUntilItIsSupported()
await this.lazyLoadHomeServerOnApplicablePlatforms()
if (!this.homeServer) {
return
@@ -265,9 +265,17 @@ export class HomeServerManager implements HomeServerManagerInterface {
return configuration
}
private doNotInstantiateHomeServerOnWindowsUntilItIsSupported(): void {
if (!isWindows() && !this.homeServer) {
this.homeServer = new HomeServer()
private async lazyLoadHomeServerOnApplicablePlatforms(): Promise<void> {
if (isWindows()) {
return
}
if (this.homeServer) {
return
}
const { HomeServer } = await import('@standardnotes/home-server')
this.homeServer = new HomeServer()
}
}