bridgev2/login: add wait_for_url_pattern field to cookie logins

This commit is contained in:
Tulir Asokan 2025-05-06 18:49:54 +03:00
commit ba43e615f8
2 changed files with 20 additions and 0 deletions

View file

@ -159,6 +159,12 @@ type LoginCookiesParams struct {
// The snippet will evaluate to a promise that resolves when the relevant fields are found.
// Fields that are not present in the promise result must be extracted another way.
ExtractJS string `json:"extract_js,omitempty"`
// A regex pattern that the URL should match before the client closes the webview.
//
// The client may submit the login if the user closes the webview after all cookies are collected
// even if this URL is not reached, but it should only automatically close the webview after
// both cookies and the URL match.
WaitForURLPattern string `json:"wait_for_url_pattern,omitempty"`
}
type LoginInputFieldType string

View file

@ -671,6 +671,20 @@ components:
user_agent:
type: string
description: An optional user agent that the webview should use.
wait_for_url_pattern:
type: string
description: |
A regex pattern that the URL should match before the client closes the webview.
The client may submit the login if the user closes the webview after all cookies are collected
even if this URL is not reached, but it should only automatically close the webview after
both cookies and the URL match.
extract_js:
type: string
description: |
A JavaScript snippet that can extract some or all of the fields.
The snippet will evaluate to a promise that resolves when the relevant fields are found.
Fields that are not present in the promise result must be extracted another way.
fields:
type: array
description: The list of cookies or other stored data that must be extracted.