renaming helper function

This commit is contained in:
balzack 2024-08-28 19:35:53 -07:00
parent f08e738f9a
commit 0dbc9d542f

View File

@ -77,7 +77,7 @@ export class SettingsModule implements Settings {
await this.store.setSettingsData(guid, config); await this.store.setSettingsData(guid, config);
await this.store.setSettingsRevision(guid, nextRev); await this.store.setSettingsRevision(guid, nextRev);
this.config = config; this.config = config;
this.emitter.emit('config', this.getStatus()); this.emitter.emit('config', this.getConfig());
this.revision = nextRev; this.revision = nextRev;
if (this.nextRevision === nextRev) { if (this.nextRevision === nextRev) {
this.nextRevision = null; this.nextRevision = null;
@ -94,7 +94,7 @@ export class SettingsModule implements Settings {
} }
} }
public getStatus() { public getConfig() {
const { storageUsed, storageAvailable, forwardingAddress, searchable, allowUnsealed, pushEnabled, sealable, seal, enableIce, multiFactorAuth, webPushKey } = this.config; const { storageUsed, storageAvailable, forwardingAddress, searchable, allowUnsealed, pushEnabled, sealable, seal, enableIce, multiFactorAuth, webPushKey } = this.config;
const { passwordSalt, privateKeyIv, privateKeyEncrypted, publicKey } = seal || {}; const { passwordSalt, privateKeyIv, privateKeyEncrypted, publicKey } = seal || {};
const sealSet = Boolean(passwordSalt && privateKeyIv && privateKeyEncrypted && publicKey); const sealSet = Boolean(passwordSalt && privateKeyIv && privateKeyEncrypted && publicKey);
@ -104,7 +104,7 @@ export class SettingsModule implements Settings {
public addConfigListener(ev: (config: Config) => void): void { public addConfigListener(ev: (config: Config) => void): void {
this.emitter.on('config', ev); this.emitter.on('config', ev);
this.emitter.emit('config', this.getStatus()); this.emitter.emit('config', this.getConfig());
} }
public removeConfigListener(ev: (config: Config) => void): void { public removeConfigListener(ev: (config: Config) => void): void {
@ -177,7 +177,7 @@ export class SettingsModule implements Settings {
this.store.setSeal(guid, sealKey); this.store.setSeal(guid, sealKey);
this.sealKey = sealKey; this.sealKey = sealKey;
this.emitter.emit('config', this.getStatus()); this.emitter.emit('config', this.getConfig());
} }
public async clearSeal(): Promise<void> { public async clearSeal(): Promise<void> {
@ -185,7 +185,7 @@ export class SettingsModule implements Settings {
await clearAccountSeal(node, secure, token); await clearAccountSeal(node, secure, token);
await this.store.clearSeal(guid); await this.store.clearSeal(guid);
this.sealKey = null; this.sealKey = null;
this.emitter.emit('config', this.getStatus()); this.emitter.emit('config', this.getConfig());
} }
public async unlockSeal(password: string): Promise<void> { public async unlockSeal(password: string): Promise<void> {
@ -204,14 +204,14 @@ export class SettingsModule implements Settings {
this.store.setSeal(guid, seal); this.store.setSeal(guid, seal);
this.sealKey = seal; this.sealKey = seal;
this.emitter.emit('config', this.getStatus()); this.emitter.emit('config', this.getConfig());
} }
public async forgetSeal(): Promise<void> { public async forgetSeal(): Promise<void> {
const { guid } = this; const { guid } = this;
await this.store.clearSeal(guid); await this.store.clearSeal(guid);
this.sealKey = null; this.sealKey = null;
this.emitter.emit('config', this.getStatus()); this.emitter.emit('config', this.getConfig());
} }
public async getUsernameStatus(username: string): Promise<boolean> { public async getUsernameStatus(username: string): Promise<boolean> {