# AD GUI Remote Access

This starts the AD browser GUI so another computer on the same LAN/VPN can open it.

## Start

Double-click from the project root:

```text
run_ad_gui_remote.bat
```

or run:

```powershell
AD_Keil_Project\tools\run_ad_gui_remote.bat
```

The bat asks for a password before the server starts. Remote users enter:

```text
User: ad
Password: the password you entered at startup
```

To start without the password prompt, set it in the same terminal first:

```powershell
$env:AD_GUI_PASSWORD = "your-password"
AD_Keil_Project\tools\run_ad_gui_remote.bat
```

To use another login name:

```powershell
$env:AD_GUI_USER = "operator"
$env:AD_GUI_PASSWORD = "your-password"
AD_Keil_Project\tools\run_ad_gui_remote.bat
```

The remote server listens on:

```text
0.0.0.0:8765
```

The bat prints URLs like:

```text
http://192.168.1.50:8765/
```

Open that URL from the remote PC.

## Requirements

- The PC running the bat must be connected to the AD board COM port.
- The remote PC must be on the same LAN or VPN.
- Install serial support once if needed:

```powershell
python -m pip install -r AD_Keil_Project\tools\requirements-ad-terminal.txt
```

## Windows Firewall

If the remote PC cannot open the page, allow inbound TCP port `8765` on the PC running the server.

Run PowerShell as Administrator:

```powershell
New-NetFirewallRule -DisplayName "AD GUI Remote 8765" -Direction Inbound -Protocol TCP -LocalPort 8765 -Action Allow
```

## Security

Remote access uses HTTP Basic authentication when `AD_GUI_PASSWORD` is set. Use it only on a trusted local network or VPN. Do not expose port `8765` to the internet because HTTP Basic authentication does not encrypt the password without HTTPS.

For local-only password protection, set `AD_GUI_PASSWORD` before running `run_ad_gui.bat`:

```powershell
$env:AD_GUI_PASSWORD = "your-password"
run_ad_gui.bat
```

## Stop

Close the terminal window or press:

```text
Ctrl+C
```
