fix: Fixes issue where self-hosted accounts may not have loaded correct server

This commit is contained in:
Mo
2024-01-06 15:00:41 -06:00
parent 604f341f8f
commit acd20dcc70
4 changed files with 3 additions and 34 deletions

View File

@@ -1,27 +0,0 @@
import { ApplicationStage, StorageKey } from '@standardnotes/services'
import { Migration } from '@Lib/Migrations/Migration'
export class Migration2_204_8 extends Migration {
static override version(): string {
return '2.204.8'
}
protected registerStageHandlers(): void {
this.registerStageHandler(ApplicationStage.Launched_10, async () => {
await this.migrateHostKeyStoredToWorkspaceIdentified()
this.markDone()
})
}
private async migrateHostKeyStoredToWorkspaceIdentified(): Promise<void> {
const existingHostKeyValue = this.services.storageService.getValue<string | undefined>(StorageKey.ServerHost)
if (existingHostKeyValue === undefined) {
return
}
this.services.storageService.setValue(`${StorageKey.ServerHost}:${this.services.identifier}`, existingHostKeyValue)
await this.services.storageService.removeValue(StorageKey.ServerHost)
}
}