Enable link & sync in production
This commit is contained in:
parent
7fb898441b
commit
205c477082
4 changed files with 7 additions and 14 deletions
|
@ -195,10 +195,7 @@ function startInstaller(): ThunkAction<
|
||||||
strictAssert(server, 'Expected a server');
|
strictAssert(server, 'Expected a server');
|
||||||
|
|
||||||
if (!provisioner) {
|
if (!provisioner) {
|
||||||
provisioner = new Provisioner({
|
provisioner = new Provisioner({ server });
|
||||||
server,
|
|
||||||
appVersion: window.getVersion(),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const cancel = provisioner.subscribe(event => {
|
const cancel = provisioner.subscribe(event => {
|
||||||
|
|
|
@ -1116,7 +1116,7 @@ export default class AccountManager extends EventTarget {
|
||||||
|
|
||||||
const shouldDownloadBackup =
|
const shouldDownloadBackup =
|
||||||
isBackupEnabled() ||
|
isBackupEnabled() ||
|
||||||
(isLinkAndSyncEnabled(window.getVersion()) && options.ephemeralBackupKey);
|
(isLinkAndSyncEnabled() && options.ephemeralBackupKey);
|
||||||
|
|
||||||
// Set backup download path before storing credentials to ensure that
|
// Set backup download path before storing credentials to ensure that
|
||||||
// storage service and message receiver are not operating
|
// storage service and message receiver are not operating
|
||||||
|
|
|
@ -50,7 +50,6 @@ export enum EventKind {
|
||||||
|
|
||||||
export type ProvisionerOptionsType = Readonly<{
|
export type ProvisionerOptionsType = Readonly<{
|
||||||
server: WebAPIType;
|
server: WebAPIType;
|
||||||
appVersion: string;
|
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type EnvelopeType = ProvisionDecryptResult;
|
export type EnvelopeType = ProvisionDecryptResult;
|
||||||
|
@ -113,7 +112,6 @@ const QR_CODE_TIMEOUTS = [10 * SECOND, 20 * SECOND, 30 * SECOND, 60 * SECOND];
|
||||||
export class Provisioner {
|
export class Provisioner {
|
||||||
readonly #subscribers = new Set<SubscriberType>();
|
readonly #subscribers = new Set<SubscriberType>();
|
||||||
readonly #server: WebAPIType;
|
readonly #server: WebAPIType;
|
||||||
readonly #appVersion: string;
|
|
||||||
readonly #retryBackOff = new BackOff(FIBONACCI_TIMEOUTS);
|
readonly #retryBackOff = new BackOff(FIBONACCI_TIMEOUTS);
|
||||||
|
|
||||||
#sockets: Array<IWebSocketResource> = [];
|
#sockets: Array<IWebSocketResource> = [];
|
||||||
|
@ -121,9 +119,8 @@ export class Provisioner {
|
||||||
#attemptCount = 0;
|
#attemptCount = 0;
|
||||||
#isRunning = false;
|
#isRunning = false;
|
||||||
|
|
||||||
constructor({ server, appVersion }: ProvisionerOptionsType) {
|
constructor({ server }: ProvisionerOptionsType) {
|
||||||
this.#server = server;
|
this.#server = server;
|
||||||
this.#appVersion = appVersion;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public subscribe(notify: SubscribeNotifierType): UnsubscribeFunctionType {
|
public subscribe(notify: SubscribeNotifierType): UnsubscribeFunctionType {
|
||||||
|
@ -373,7 +370,7 @@ export class Provisioner {
|
||||||
kind: EventKind.Envelope,
|
kind: EventKind.Envelope,
|
||||||
envelope,
|
envelope,
|
||||||
isLinkAndSync:
|
isLinkAndSync:
|
||||||
isLinkAndSyncEnabled(this.#appVersion) &&
|
isLinkAndSyncEnabled() &&
|
||||||
Bytes.isNotEmpty(envelope.ephemeralBackupKey),
|
Bytes.isNotEmpty(envelope.ephemeralBackupKey),
|
||||||
});
|
});
|
||||||
request.respond(200, 'OK');
|
request.respond(200, 'OK');
|
||||||
|
@ -422,7 +419,7 @@ export class Provisioner {
|
||||||
.toAppUrl({
|
.toAppUrl({
|
||||||
uuid,
|
uuid,
|
||||||
pubKey: Bytes.toBase64(cipher.getPublicKey()),
|
pubKey: Bytes.toBase64(cipher.getPublicKey()),
|
||||||
capabilities: isLinkAndSyncEnabled(this.#appVersion) ? ['backup3'] : [],
|
capabilities: isLinkAndSyncEnabled() ? ['backup3'] : [],
|
||||||
})
|
})
|
||||||
.toString();
|
.toString();
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import { isProduction } from './version';
|
|
||||||
import { everDone as wasRegistrationEverDone } from './registration';
|
import { everDone as wasRegistrationEverDone } from './registration';
|
||||||
|
|
||||||
export function isLinkAndSyncEnabled(version: string): boolean {
|
export function isLinkAndSyncEnabled(): boolean {
|
||||||
// Cannot overwrite existing message history
|
// Cannot overwrite existing message history
|
||||||
if (wasRegistrationEverDone()) {
|
if (wasRegistrationEverDone()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !isProduction(version);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue