2026-04-23 23:40:34 -03:00
|
|
|
#!/bin/bash
|
2026-04-24 23:08:42 -03:00
|
|
|
# Auto-generated by API — do not edit manually
|
2026-04-23 23:40:34 -03:00
|
|
|
# Stream: {{STREAM_ID}}
|
|
|
|
|
|
2026-04-24 23:08:42 -03:00
|
|
|
[ -z "{{USER}}" ] && exit 0
|
|
|
|
|
|
|
|
|
|
sleep {{STREAM_DELAY}}
|
|
|
|
|
|
|
|
|
|
# Query Chrome DevTools Protocol to detect current page URL
|
|
|
|
|
CURRENT_URL=$(node -e "
|
|
|
|
|
const http = require('http');
|
|
|
|
|
http.get('http://localhost:{{DEBUG_PORT}}/json', res => {
|
|
|
|
|
let d = '';
|
|
|
|
|
res.on('data', c => d += c);
|
|
|
|
|
res.on('end', () => {
|
|
|
|
|
try {
|
|
|
|
|
const tabs = JSON.parse(d);
|
|
|
|
|
const page = tabs.find(t => t.type === 'page');
|
|
|
|
|
process.stdout.write(page ? page.url : '');
|
|
|
|
|
} catch { process.stdout.write(''); }
|
|
|
|
|
});
|
|
|
|
|
}).on('error', () => process.stdout.write(''));
|
|
|
|
|
" 2>/dev/null)
|
|
|
|
|
|
|
|
|
|
# If we got a URL and it doesn't look like a login page, skip autologin
|
|
|
|
|
if [ -n "$CURRENT_URL" ] && ! echo "$CURRENT_URL" | grep -qiE '/(login|signin|sign-in|auth|sso|oauth)'; then
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
DISPLAY={{DISPLAY}} xdotool search --sync --onlyvisible --class chromium windowfocus windowraise
|
|
|
|
|
sleep 1
|
|
|
|
|
|
2026-04-23 23:40:34 -03:00
|
|
|
DISPLAY={{DISPLAY}} xdotool type --clearmodifiers --delay 50 "{{USER}}"
|
|
|
|
|
DISPLAY={{DISPLAY}} xdotool key Tab
|
|
|
|
|
sleep 0.3
|
|
|
|
|
DISPLAY={{DISPLAY}} xdotool type --clearmodifiers --delay 50 "{{PASS}}"
|
|
|
|
|
DISPLAY={{DISPLAY}} xdotool key Return
|