Skip to content

Commit f6e83b7

Browse files
stalgiaghoward-e
andauthored
ADB proxies (#1451)
* whitelist additional commands * spike on ADB proxy functionality * Spike with working utterance collection via stream * Cleanup, finalize * Setup env variables and remove unused shell scripts * Updates config-sandbox's REACT_APP_EXTERNAL_HOST to aria-at-app-sandbox.bocoup.com * General cleanup of original PR * Summary of changes: * There'll be a need to expose the local proxy out to the internet to get a public URL for this prototype to work as it should (eg. using ngrok or similar) * This supports having users having their own specific proxies * Adds a field to the TestRenderer for a user to provide that public url * Continue using the originally intended debug window on TestRenderer to be an output area that utterances can be copied from to avoid any clipboard management issues * TODOs and many logging messages added * Bundle ngrok into the adb-proxy build process * Additional support for running proxy and adb on windows from built resources * Simplify proxy auto detection * Prefer localtunnel over ngrok to avoid unneeded account creation * Misc * Conditionally include ngrok and build start adb server on server script start * Re-save proxy url on auto-detect * Focus on copy utterances button when utterances process is completed * Announce the clipboard copy happen * Update android testing device section notes * Additional feedback after selecting the open on android button * Better sanitize of output * Don't end start script on fatal error * Allow waking screen if needed * Remove unnecessary fetch to /proxy-url * Add zip files creation to build process * Preserve history of utterances * Remove get-network-ip.js * Standardize auto detect proxy status colors * Only show Android Device Testing section when the at.key is talkback_android --------- Co-authored-by: Howard Edwards <[email protected]>
1 parent aa25b0d commit f6e83b7

31 files changed

+3185
-892
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"no-console": [
3333
"error",
3434
{
35-
"allow": ["warn", "error"]
35+
"allow": ["warn", "error", "info"]
3636
}
3737
],
3838
"no-use-before-define": ["off"],

adb-proxy/README.md

Lines changed: 61 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,79 @@
1-
# adb-proxy
1+
# ADB Proxy - Portable Executable
22

3-
Lightweight local proxy to be packaged and used for working with adb commands.
3+
This ADB proxy creates portable executables that don't require Node.js or ADB to be installed locally.
44

5-
## Prerequisites
5+
## For End Users
66

7-
1. [ADB Tools](https://developer.android.com/tools/releases/platform-tools) are locally available.
8-
2. Ensure Android device has USB Debugging enabled.
7+
### Quick Start
98

10-
## How to use
9+
1. **Download** the appropriate build for your platform from releases
10+
2. **Extract** the archive to any folder
11+
3. **Connect** your Android device with USB debugging enabled
12+
4. **Double-click** the startup script:
13+
- **Windows**: `start.bat`
14+
- **macOS**: `start.command`
15+
- **Linux**: `start.sh`
1116

12-
```sh
13-
cd adb-proxy
17+
The proxy will start on `http://localhost:3080`
18+
19+
## For Developers
20+
21+
### Building Executables
22+
23+
```bash
24+
# Install dependencies
1425
yarn install
15-
yarn start
26+
27+
# Build for specific platforms
28+
yarn build-windows # Creates dist/windows/
29+
yarn build-linux # Creates dist/linux/
30+
yarn build-macos # Creates dist/macos/
31+
32+
# Build for all platforms
33+
yarn build-all
1634
```
1735

18-
Local proxy should now be running on http://localhost:3080.
36+
### How It Works
1937

20-
To confirm it works:
38+
The build process uses [@yao-pkg/pkg](https://github.com/yao-pkg/pkg) (maintained fork) to create standalone executables:
2139

22-
First, connect your Android device to the computer (and allow any relevant permissions related to debugging)
40+
1. **pkg** bundles the Node.js application into a single executable
41+
2. **build-platforms.js** downloads platform-specific ADB binaries
42+
3. **Everything** is packaged together with startup scripts
2343

24-
1. Run the following to display the id(s) of the currently connected Android device(s):
44+
### Distribution
2545

26-
```sh
27-
curl -X POST http://localhost:3080/run-adb \
28-
-H "Content-Type: application/json" \
29-
-d '{ "command": "devices" }'
46+
Each platform build creates a `dist/{platform}/` directory with:
47+
48+
```
49+
📁 dist/windows/ 📁 dist/macos/ 📁 dist/linux/
50+
├── 🟢 start.bat ├── 🟢 start.command ├── 🟢 start.sh
51+
├── 🔧 adb.exe ├── 🔧 adb ├── 🔧 adb
52+
├── ⚙️ adb-proxy.exe ├── ⚙️ adb-proxy ├── ⚙️ adb-proxy
53+
├── 📄 adbwinapi.dll ├── 📄 README.txt ├── 📄 README.txt
54+
├── 📄 adbwinusbapi.dll └── 📚 USER-GUIDE.md └── 📚 USER-GUIDE.md
55+
├── 📄 README.txt
56+
└── 📚 USER-GUIDE.md
3057
```
3158

32-
2. Observe that the connected device(s) is returned in the result.
59+
### File Sizes
3360

34-
OR
61+
- **Windows**: ~52MB
62+
- **macOS**: ~75MB
63+
- **Linux**: ~63MB
3564

36-
1. Navigate to the Test Queue, inspect the page and remove the `display: none` style from the last `<div>` in the `<main>`.
37-
1. That should reveal a 'List Devices' button. Pressing that button displays the device id(s) of the Android device(s) currently connected to the computer.
65+
## Development
3866

39-
TODO:
67+
### Project Structure
4068

41-
1. Whitelist the remaining adb commands currently used in the `aria-at-talkback-capture` scripts
42-
1. Rework the current server's `api/scripts` endpoints and the capture utterances web socket implementation to be usable by this proxy
43-
1. Package this proxy as a portable executable so testers won't have to install node (or adb) locally
44-
1. If the above cannot be easily done for adb, provide an easy way to pull and add ADB to a tester's PATH depending on platform, and easily remove afterwards
45-
1. Tests(?)
69+
```
70+
adb-proxy/
71+
├── adb-proxy.js # Main server application
72+
├── capture-utterances.js # TalkBack capture logic
73+
├── build-platforms.js # Build system for all platforms
74+
├── package.json # Dependencies and build scripts
75+
└── dist/ # Built executables (generated)
76+
├── windows/
77+
├── linux/
78+
└── macos/
79+
```

0 commit comments

Comments
 (0)