support new tab magic link logic (#3797)

This commit is contained in:
LawyZheng
2025-10-23 14:38:03 +08:00
committed by GitHub
parent b8525ff703
commit 87625d4c0f
10 changed files with 74 additions and 4 deletions

View File

@@ -125,6 +125,10 @@ class Action(BaseModel):
return SolveCaptchaAction.model_validate(value)
elif action_type is ActionType.RELOAD_PAGE:
return ReloadPageAction.model_validate(value)
elif action_type is ActionType.GOTO_URL:
return GotoUrlAction.model_validate(value)
elif action_type is ActionType.CLOSE_PAGE:
return ClosePageAction.model_validate(value)
else:
raise ValueError(f"Unsupported action type: {action_type}")
else:
@@ -153,6 +157,11 @@ class ReloadPageAction(Action):
action_type: ActionType = ActionType.RELOAD_PAGE
# TODO: right now, it's only enabled when there's magic link during login
class ClosePageAction(Action):
action_type: ActionType = ActionType.CLOSE_PAGE
class ClickAction(WebAction):
action_type: ActionType = ActionType.CLICK
file_url: str | None = None
@@ -263,6 +272,7 @@ class KeypressAction(Action):
class GotoUrlAction(Action):
action_type: ActionType = ActionType.GOTO_URL
url: str
is_magic_link: bool = False # if True, shouldn't go to url directly when replaying the cache
class MoveAction(Action):