mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
Fix agent pet overlay permission and GitHub setup (#2548)
This commit is contained in:
1 parent
827ab2d485
commit
1b732c1b65
5 files changed
+28
-35
No files matched your search
+9
-16
@@ -1,24 +1,17 @@
|
||||
#!/bin/bash
|
||||
# GitHub sign-in through Android's browser on the bottom screen, with the one-time code typed in.
|
||||
serial=${ADB_SERIAL:-127.0.0.1:5555}
|
||||
adb connect "$serial" >/dev/null 2>&1
|
||||
# Starts GitHub's device login and opens its approval page in Android.
|
||||
coproc GH { BROWSER=true gh auth login --hostname github.com --git-protocol https --web 2>&1; }
|
||||
gh_pid=$GH_PID
|
||||
typed=
|
||||
while IFS= read -r line <&"${GH[0]}"; do
|
||||
exec {ghout}<&"${GH[0]}" {ghin}>&"${GH[1]}"
|
||||
shown=
|
||||
while IFS= read -r line <&"$ghout"; do
|
||||
printf '%s\n' "$line"
|
||||
code=$(grep -oE '[A-Z0-9]{4}-[A-Z0-9]{4}' <<<"$line" | head -1)
|
||||
if [ -n "$code" ] && [ -z "$typed" ]; then
|
||||
typed=1
|
||||
echo >&"${GH[1]}"
|
||||
adb -s "$serial" shell "am start --display 2 -a android.intent.action.VIEW -d https://github.com/login/device" >/dev/null 2>&1
|
||||
# Chrome drops characters from `input text` and from fast key events on this page.
|
||||
keys=
|
||||
for ((i = 0; i < ${#code}; i++)); do
|
||||
c=${code:i:1}
|
||||
[ "$c" = - ] || keys+="input -d 2 keyevent KEYCODE_$c; sleep 0.4; "
|
||||
done
|
||||
(sleep 7; adb -s "$serial" shell "$keys" >/dev/null 2>&1) &
|
||||
if [ -n "$code" ] && [ -z "$shown" ]; then
|
||||
shown=1
|
||||
echo >&"$ghin"
|
||||
printf 'GitHub device code: %s · github.com/login/device\n' "$code"
|
||||
android-open https://github.com/login/device
|
||||
fi
|
||||
done
|
||||
wait "$gh_pid"
|
||||
Reference in new issue
Block a user