Move challenge urls into config
This commit is contained in:
parent
7f772e49b6
commit
3e586be46a
8 changed files with 25 additions and 10 deletions
|
@ -49,6 +49,7 @@
|
||||||
OS: {
|
OS: {
|
||||||
hasCustomTitleBar: () => false,
|
hasCustomTitleBar: () => false,
|
||||||
},
|
},
|
||||||
|
config: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
window.ConversationController = window.ConversationController || {};
|
window.ConversationController = window.ConversationController || {};
|
||||||
|
|
|
@ -424,6 +424,7 @@ async function prepareUrl(
|
||||||
version: app.getVersion(),
|
version: app.getVersion(),
|
||||||
buildCreation: config.get<number>('buildCreation'),
|
buildCreation: config.get<number>('buildCreation'),
|
||||||
buildExpiration: config.get<number>('buildExpiration'),
|
buildExpiration: config.get<number>('buildExpiration'),
|
||||||
|
challengeUrl: config.get<string>('challengeUrl'),
|
||||||
serverUrl: config.get<string>('serverUrl'),
|
serverUrl: config.get<string>('serverUrl'),
|
||||||
storageUrl: config.get<string>('storageUrl'),
|
storageUrl: config.get<string>('storageUrl'),
|
||||||
updatesUrl: config.get<string>('updatesUrl'),
|
updatesUrl: config.get<string>('updatesUrl'),
|
||||||
|
@ -441,6 +442,7 @@ async function prepareUrl(
|
||||||
contentProxyUrl: config.get<string>('contentProxyUrl'),
|
contentProxyUrl: config.get<string>('contentProxyUrl'),
|
||||||
sfuUrl: config.get('sfuUrl'),
|
sfuUrl: config.get('sfuUrl'),
|
||||||
reducedMotionSetting: animationSettings.prefersReducedMotion,
|
reducedMotionSetting: animationSettings.prefersReducedMotion,
|
||||||
|
registrationChallengeUrl: config.get<string>('registrationChallengeUrl'),
|
||||||
serverPublicParams: config.get<string>('serverPublicParams'),
|
serverPublicParams: config.get<string>('serverPublicParams'),
|
||||||
serverTrustRoot: config.get<string>('serverTrustRoot'),
|
serverTrustRoot: config.get<string>('serverTrustRoot'),
|
||||||
theme,
|
theme,
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
"artCreatorUrl": "https://create.staging.signal.art",
|
"artCreatorUrl": "https://create.staging.signal.art",
|
||||||
"updatesPublicKey": "05fd7dd3de7149dc0a127909fee7de0f7620ddd0de061b37a2c303e37de802a401",
|
"updatesPublicKey": "05fd7dd3de7149dc0a127909fee7de0f7620ddd0de061b37a2c303e37de802a401",
|
||||||
"sfuUrl": "https://sfu.voip.signal.org/",
|
"sfuUrl": "https://sfu.voip.signal.org/",
|
||||||
|
"challengeUrl": "https://signalcaptchas.org/staging/challenge/generate.html",
|
||||||
|
"registrationChallengeUrl": "https://signalcaptchas.org/staging/registration/generate.html",
|
||||||
"updatesEnabled": false,
|
"updatesEnabled": false,
|
||||||
"enableCI": false,
|
"enableCI": false,
|
||||||
"forcePreloadBundle": false,
|
"forcePreloadBundle": false,
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
"2": "https://cdn2.signal.org"
|
"2": "https://cdn2.signal.org"
|
||||||
},
|
},
|
||||||
"artCreatorUrl": "https://create.signal.art",
|
"artCreatorUrl": "https://create.signal.art",
|
||||||
|
"challengeUrl": "https://signalcaptchas.org/challenge/generate.html",
|
||||||
|
"registrationChallengeUrl": "https://signalcaptchas.org/registration/generate.html",
|
||||||
"serverPublicParams": "AMhf5ywVwITZMsff/eCyudZx9JDmkkkbV6PInzG4p8x3VqVJSFiMvnvlEKWuRob/1eaIetR31IYeAbm0NdOuHH8Qi+Rexi1wLlpzIo1gstHWBfZzy1+qHRV5A4TqPp15YzBPm0WSggW6PbSn+F4lf57VCnHF7p8SvzAA2ZZJPYJURt8X7bbg+H3i+PEjH9DXItNEqs2sNcug37xZQDLm7X36nOoGPs54XsEGzPdEV+itQNGUFEjY6X9Uv+Acuks7NpyGvCoKxGwgKgE5XyJ+nNKlyHHOLb6N1NuHyBrZrgtY/JYJHRooo5CEqYKBqdFnmbTVGEkCvJKxLnjwKWf+fEPoWeQFj5ObDjcKMZf2Jm2Ae69x+ikU5gBXsRmoF94GXTLfN0/vLt98KDPnxwAQL9j5V1jGOY8jQl6MLxEs56cwXN0dqCnImzVH3TZT1cJ8SW1BRX6qIVxEzjsSGx3yxF3suAilPMqGRp4ffyopjMD1JXiKR2RwLKzizUe5e8XyGOy9fplzhw3jVzTRyUZTRSZKkMLWcQ/gv0E4aONNqs4P",
|
"serverPublicParams": "AMhf5ywVwITZMsff/eCyudZx9JDmkkkbV6PInzG4p8x3VqVJSFiMvnvlEKWuRob/1eaIetR31IYeAbm0NdOuHH8Qi+Rexi1wLlpzIo1gstHWBfZzy1+qHRV5A4TqPp15YzBPm0WSggW6PbSn+F4lf57VCnHF7p8SvzAA2ZZJPYJURt8X7bbg+H3i+PEjH9DXItNEqs2sNcug37xZQDLm7X36nOoGPs54XsEGzPdEV+itQNGUFEjY6X9Uv+Acuks7NpyGvCoKxGwgKgE5XyJ+nNKlyHHOLb6N1NuHyBrZrgtY/JYJHRooo5CEqYKBqdFnmbTVGEkCvJKxLnjwKWf+fEPoWeQFj5ObDjcKMZf2Jm2Ae69x+ikU5gBXsRmoF94GXTLfN0/vLt98KDPnxwAQL9j5V1jGOY8jQl6MLxEs56cwXN0dqCnImzVH3TZT1cJ8SW1BRX6qIVxEzjsSGx3yxF3suAilPMqGRp4ffyopjMD1JXiKR2RwLKzizUe5e8XyGOy9fplzhw3jVzTRyUZTRSZKkMLWcQ/gv0E4aONNqs4P",
|
||||||
"serverTrustRoot": "BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF",
|
"serverTrustRoot": "BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF",
|
||||||
"updatesEnabled": true
|
"updatesEnabled": true
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { assertDev } from './util/assert';
|
||||||
import { isOlderThan } from './util/timestamp';
|
import { isOlderThan } from './util/timestamp';
|
||||||
import { parseRetryAfterWithDefault } from './util/parseRetryAfter';
|
import { parseRetryAfterWithDefault } from './util/parseRetryAfter';
|
||||||
import { clearTimeoutIfNecessary } from './util/clearTimeoutIfNecessary';
|
import { clearTimeoutIfNecessary } from './util/clearTimeoutIfNecessary';
|
||||||
import { getEnvironment, Environment } from './environment';
|
import { missingCaseError } from './util/missingCaseError';
|
||||||
import type { StorageInterface } from './types/Storage.d';
|
import type { StorageInterface } from './types/Storage.d';
|
||||||
import * as Errors from './types/errors';
|
import * as Errors from './types/errors';
|
||||||
import { HTTPError } from './textsecure/Errors';
|
import { HTTPError } from './textsecure/Errors';
|
||||||
|
@ -93,9 +93,6 @@ export type RequestCaptchaOptionsType = Readonly<{
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
const DEFAULT_EXPIRE_AFTER = 24 * 3600 * 1000; // one day
|
const DEFAULT_EXPIRE_AFTER = 24 * 3600 * 1000; // one day
|
||||||
const CAPTCHA_URL = 'https://signalcaptchas.org/challenge/generate.html';
|
|
||||||
const CAPTCHA_STAGING_URL =
|
|
||||||
'https://signalcaptchas.org/staging/challenge/generate.html';
|
|
||||||
|
|
||||||
function shouldStartQueue(registered: RegisteredChallengeType): boolean {
|
function shouldStartQueue(registered: RegisteredChallengeType): boolean {
|
||||||
// No retryAt provided; waiting for user to complete captcha
|
// No retryAt provided; waiting for user to complete captcha
|
||||||
|
@ -110,11 +107,14 @@ function shouldStartQueue(registered: RegisteredChallengeType): boolean {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getChallengeURL(): string {
|
export function getChallengeURL(type: 'chat' | 'registration'): string {
|
||||||
if (getEnvironment() === Environment.Staging) {
|
if (type === 'chat') {
|
||||||
return CAPTCHA_STAGING_URL;
|
return window.SignalContext.config.challengeUrl;
|
||||||
}
|
}
|
||||||
return CAPTCHA_URL;
|
if (type === 'registration') {
|
||||||
|
return window.SignalContext.config.registrationChallengeUrl;
|
||||||
|
}
|
||||||
|
throw missingCaseError(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that even though this is a class - only one instance of
|
// Note that even though this is a class - only one instance of
|
||||||
|
|
|
@ -7,6 +7,7 @@ import type { Plugin } from 'intl-tel-input';
|
||||||
import intlTelInput from 'intl-tel-input';
|
import intlTelInput from 'intl-tel-input';
|
||||||
|
|
||||||
import { strictAssert } from '../util/assert';
|
import { strictAssert } from '../util/assert';
|
||||||
|
import * as log from '../logging/log';
|
||||||
import { parseNumber } from '../util/libphonenumberUtil';
|
import { parseNumber } from '../util/libphonenumberUtil';
|
||||||
import { getChallengeURL } from '../challenge';
|
import { getChallengeURL } from '../challenge';
|
||||||
|
|
||||||
|
@ -128,7 +129,9 @@ export function StandaloneRegistration({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.location.href = getChallengeURL();
|
const url = getChallengeURL('registration');
|
||||||
|
log.info(`StandaloneRegistration: navigating to ${url}`);
|
||||||
|
document.location.href = url;
|
||||||
if (!window.Signal.challengeHandler) {
|
if (!window.Signal.challengeHandler) {
|
||||||
setError('Captcha handler is not ready!');
|
setError('Captcha handler is not ready!');
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import type { StateType } from '../reducer';
|
||||||
import { getIntl } from '../selectors/user';
|
import { getIntl } from '../selectors/user';
|
||||||
import { isChallengePending } from '../selectors/network';
|
import { isChallengePending } from '../selectors/network';
|
||||||
import { getChallengeURL } from '../../challenge';
|
import { getChallengeURL } from '../../challenge';
|
||||||
|
import * as log from '../../logging/log';
|
||||||
|
|
||||||
const mapStateToProps = (state: StateType) => {
|
const mapStateToProps = (state: StateType) => {
|
||||||
return {
|
return {
|
||||||
|
@ -16,7 +17,9 @@ const mapStateToProps = (state: StateType) => {
|
||||||
i18n: getIntl(state),
|
i18n: getIntl(state),
|
||||||
|
|
||||||
onContinue() {
|
onContinue() {
|
||||||
document.location.href = getChallengeURL();
|
const url = getChallengeURL('chat');
|
||||||
|
log.info(`CaptchaDialog: navigating to ${url}`);
|
||||||
|
document.location.href = url;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,6 +31,7 @@ export const rendererConfigSchema = z.object({
|
||||||
buildExpiration: z.number(),
|
buildExpiration: z.number(),
|
||||||
cdnUrl0: configRequiredStringSchema,
|
cdnUrl0: configRequiredStringSchema,
|
||||||
cdnUrl2: configRequiredStringSchema,
|
cdnUrl2: configRequiredStringSchema,
|
||||||
|
challengeUrl: configRequiredStringSchema,
|
||||||
certificateAuthority: configRequiredStringSchema,
|
certificateAuthority: configRequiredStringSchema,
|
||||||
contentProxyUrl: configRequiredStringSchema,
|
contentProxyUrl: configRequiredStringSchema,
|
||||||
crashDumpsPath: configRequiredStringSchema,
|
crashDumpsPath: configRequiredStringSchema,
|
||||||
|
@ -44,6 +45,7 @@ export const rendererConfigSchema = z.object({
|
||||||
nodeVersion: configRequiredStringSchema,
|
nodeVersion: configRequiredStringSchema,
|
||||||
proxyUrl: configOptionalStringSchema,
|
proxyUrl: configOptionalStringSchema,
|
||||||
reducedMotionSetting: z.boolean(),
|
reducedMotionSetting: z.boolean(),
|
||||||
|
registrationChallengeUrl: configRequiredStringSchema,
|
||||||
serverPublicParams: configRequiredStringSchema,
|
serverPublicParams: configRequiredStringSchema,
|
||||||
serverTrustRoot: configRequiredStringSchema,
|
serverTrustRoot: configRequiredStringSchema,
|
||||||
serverUrl: configRequiredStringSchema,
|
serverUrl: configRequiredStringSchema,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue