86 lines
3.6 KiB
Bash
Executable File
86 lines
3.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# V69 Agent Anti-chevauchement UX ENHANCED - detect ALL floating elements on chat zones
|
|
OUT=/var/www/html/api/agent-ux-overlap-report.json
|
|
|
|
python3 << 'PY'
|
|
import os, json, re
|
|
|
|
CRITICAL_PAGES = [
|
|
'/var/www/html/weval-technology-platform.html',
|
|
'/var/www/html/tasks-live-opus5.html',
|
|
'/var/www/html/v63-send-queue.html',
|
|
'/var/www/html/kaouther-compose.html',
|
|
'/var/www/html/wevia-master.html',
|
|
'/var/www/html/wevia-widget.html',
|
|
'/var/www/html/dg-command-center.html',
|
|
'/var/www/html/enterprise-complete.html',
|
|
'/var/www/html/agents-archi.html',
|
|
]
|
|
|
|
def parse_corners(style):
|
|
sl = style.lower()
|
|
has_bottom = re.search(r'bottom\s*:\s*(\d+)', sl)
|
|
has_top = re.search(r'top\s*:\s*(\d+)', sl)
|
|
has_right = re.search(r'right\s*:\s*(\d+)', sl)
|
|
has_left = re.search(r'left\s*:\s*(\d+)', sl)
|
|
vert = 'bottom' if has_bottom else ('top' if has_top else '?')
|
|
horz = 'right' if has_right else ('left' if has_left else '?')
|
|
return f'{vert}-{horz}'
|
|
|
|
issues = []
|
|
pages_scanned = 0
|
|
elements = 0
|
|
|
|
for page in CRITICAL_PAGES:
|
|
if not os.path.exists(page):
|
|
continue
|
|
pages_scanned += 1
|
|
content = open(page).read()
|
|
|
|
# 1. Inline style position:fixed
|
|
for m in re.finditer(r"style\s*=\s*['\"]([^'\"]*position\s*:\s*fixed[^'\"]*)['\"]", content, re.IGNORECASE):
|
|
elements += 1
|
|
style = m.group(1)
|
|
corner = parse_corners(style)
|
|
zi = re.search(r'z-index\s*:\s*(\d+)', style, re.IGNORECASE)
|
|
z = int(zi.group(1)) if zi else 1
|
|
start = max(0, m.start()-300); ctx = content[start:m.start()]
|
|
id_m = re.search(r'id\s*=\s*["\']([^"\']+)["\']', ctx)
|
|
eid = id_m.group(1) if id_m else 'anon'
|
|
if corner == 'bottom-right' and z > 100 and 'chat' not in eid.lower() and 'wevia' not in eid.lower() and 'send' not in eid.lower():
|
|
issues.append({'page': os.path.basename(page), 'element': eid, 'type':'inline', 'corner': corner, 'z': z, 'severity': 'HIGH' if z>9000 else 'MEDIUM'})
|
|
|
|
# 2. CSS rules position:fixed (like #v80-toggle{...})
|
|
for m in re.finditer(r'([#.][\w-]+)\s*\{([^}]*)\}', content):
|
|
selector = m.group(1)
|
|
rule_body = m.group(2)
|
|
if 'position' in rule_body and 'fixed' in rule_body:
|
|
elements += 1
|
|
corner = parse_corners(rule_body)
|
|
zi = re.search(r'z-index\s*:\s*(\d+)', rule_body, re.IGNORECASE)
|
|
z = int(zi.group(1)) if zi else 1
|
|
if corner == 'bottom-right' and z > 100:
|
|
if any(kw in selector.lower() for kw in ['chat', 'wevia', 'widget', 'send']):
|
|
continue
|
|
issues.append({'page': os.path.basename(page), 'element': selector, 'type':'css_rule', 'corner': corner, 'z': z, 'severity': 'HIGH' if z>9000 else 'MEDIUM'})
|
|
|
|
report = {
|
|
'generated_at': __import__('datetime').datetime.now().isoformat(),
|
|
'agent_version': 'V69_enhanced',
|
|
'pages_scanned': pages_scanned,
|
|
'fixed_elements_checked': elements,
|
|
'issues_count': len(issues),
|
|
'status': 'OK' if len(issues) == 0 else ('WARN' if len(issues) < 3 else 'CRITICAL'),
|
|
'doctrine_61': 'bottom-right reserved for chat WEVIA only',
|
|
'issues': issues,
|
|
}
|
|
json.dump(report, open('/var/www/html/api/agent-ux-overlap-report.json', 'w'), indent=2)
|
|
os.chmod('/var/www/html/api/agent-ux-overlap-report.json', 0o644)
|
|
import subprocess
|
|
subprocess.run(['chown','www-data:www-data','/var/www/html/api/agent-ux-overlap-report.json'])
|
|
|
|
print(f"V69 SCAN: {pages_scanned}p {elements}e {len(issues)}i status={report['status']}")
|
|
for i in issues[:5]:
|
|
print(f" {i['severity']} {i['page']} {i['element']} ({i['type']}) {i['corner']} z={i['z']}")
|
|
PY
|