Fix captcha route parsing
This commit is contained in:
parent
fea85d3a99
commit
31d680d194
2 changed files with 7 additions and 4 deletions
|
@ -106,12 +106,14 @@ describe('signalRoutes', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('captcha', () => {
|
it('captcha', () => {
|
||||||
|
const captchaId =
|
||||||
|
'signal-hcaptcha.foo-bar_baz.challenge.foo-bar_baz.foo-bar_baz';
|
||||||
const result: ParsedSignalRoute = {
|
const result: ParsedSignalRoute = {
|
||||||
key: 'captcha',
|
key: 'captcha',
|
||||||
args: { captchaId: 'foobar' },
|
args: { captchaId },
|
||||||
};
|
};
|
||||||
const check = createCheck({ hasWebUrl: false });
|
const check = createCheck({ hasWebUrl: false });
|
||||||
check('signalcaptcha://foobar', result);
|
check(`signalcaptcha://${captchaId}`, result);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('linkCall', () => {
|
it('linkCall', () => {
|
||||||
|
|
|
@ -48,7 +48,7 @@ type AllHostnamePatterns =
|
||||||
| 'start-call-lobby'
|
| 'start-call-lobby'
|
||||||
| 'show-window'
|
| 'show-window'
|
||||||
| 'set-is-presenting'
|
| 'set-is-presenting'
|
||||||
| ':captchaId'
|
| ':captchaId(.+)'
|
||||||
| '';
|
| '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -325,7 +325,8 @@ export const linkDeviceRoute = _route('linkDevice', {
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export const captchaRoute = _route('captcha', {
|
export const captchaRoute = _route('captcha', {
|
||||||
patterns: [_pattern('signalcaptcha:', ':captchaId', '', {})],
|
// needs `(.+)` to capture `.` in hostname
|
||||||
|
patterns: [_pattern('signalcaptcha:', ':captchaId(.+)', '', {})],
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
captchaId: paramSchema, // opaque
|
captchaId: paramSchema, // opaque
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue