fix(navigation): implement global trap guards for audio/save/trending and adjust story tap height
This commit is contained in:
@@ -96,7 +96,8 @@ class StoryViewPlugin(BehaviorPlugin):
|
||||
for i in range(count):
|
||||
sleep(random.uniform(2.0, 5.0) * ctx.sleep_mod)
|
||||
if i < count - 1:
|
||||
humanized_click(ctx.device, int(w * 0.9), int(h * 0.5), sleep_mod=ctx.sleep_mod)
|
||||
# Click top-right to avoid 'reply' input fields and most stickers
|
||||
humanized_click(ctx.device, int(w * 0.85), int(h * 0.25), sleep_mod=ctx.sleep_mod)
|
||||
# Atomic state validation after click
|
||||
xml_dump = ctx.device.dump_hierarchy()
|
||||
if not xml_dump:
|
||||
|
||||
@@ -249,20 +249,18 @@ class TelepathicEngine:
|
||||
if "type" not in intent and "reply" not in intent and "message" not in intent and "search" not in intent:
|
||||
return False
|
||||
|
||||
# 0.5 LIKE BUTTON GUARD: Never pick structural traps (audio/trending/share) when trying to like. ZERO-TRUST: NO LOCALIZED STRINGS.
|
||||
if "like" in intent:
|
||||
res_id = (node.resource_id or "").lower()
|
||||
if any(forbidden in res_id for forbidden in [
|
||||
"album_art",
|
||||
"use_in_camera",
|
||||
"share",
|
||||
"options",
|
||||
"menu",
|
||||
"trending",
|
||||
"audio",
|
||||
"add",
|
||||
"save"
|
||||
]):
|
||||
# 0.5 GLOBAL STRUCTURAL TRAP GUARD: Prevent accidental clicks on dangerous/irrelevant UI traps
|
||||
# ZERO-TRUST: NO LOCALIZED STRINGS.
|
||||
res_id = (node.resource_id or "").lower()
|
||||
|
||||
# Avoid clicking on audio/trending/camera elements unless explicitly requested
|
||||
if any(trap in res_id for trap in ["album_art", "use_in_camera", "trending", "audio"]):
|
||||
if not any(word in intent for word in ["audio", "trending", "camera"]):
|
||||
return False
|
||||
|
||||
# Avoid clicking share, save, menu, options unless explicitly requested
|
||||
if any(trap in res_id for trap in ["share", "save", "options", "menu", "add"]):
|
||||
if not any(word in intent for word in ["share", "save", "options", "menu", "add"]):
|
||||
return False
|
||||
|
||||
# 1. Post Username Guard
|
||||
|
||||
Reference in New Issue
Block a user