162 lines
7.9 KiB
PHP
162 lines
7.9 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
?><!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>PHP ADB TV Control</title>
|
|
<link rel="stylesheet" href="https://vps0.claygarth.com/style.css">
|
|
<link rel="stylesheet" href="assets/app.css">
|
|
</head>
|
|
<body>
|
|
<div class="container stack">
|
|
<header class="card hero-card">
|
|
<div class="card-header">
|
|
<div>
|
|
<p class="section-title">LAN Controller</p>
|
|
<h1 class="no-margin">Android TV ADB</h1>
|
|
<p class="muted no-margin">Scan 192.168.1.* and 192.168.2.* for Android TV boxes, then connect only when you choose.</p>
|
|
</div>
|
|
<div class="status-pill" id="adbStatus" aria-live="polite">
|
|
<span class="status-dot" aria-hidden="true"></span>
|
|
<span class="status-text">Checking ADB…</span>
|
|
</div>
|
|
</div>
|
|
<div class="row between">
|
|
<div class="actions no-margin-top">
|
|
<button type="button" class="button button-primary" id="scanBtn">
|
|
<span class="btn-icon" aria-hidden="true">⌕</span>
|
|
Scan Network
|
|
</button>
|
|
<button type="button" class="button" id="refreshBtn">
|
|
Refresh Status
|
|
</button>
|
|
</div>
|
|
<p class="muted small no-margin" id="scanMeta">Not scanned yet.</p>
|
|
</div>
|
|
</header>
|
|
|
|
<div class="grid dashboard-grid">
|
|
<section class="card" aria-labelledby="devices-title">
|
|
<div class="card-header">
|
|
<h2 class="section-title" id="devices-title">Discovered Devices</h2>
|
|
<span class="badge" id="deviceCount">0</span>
|
|
</div>
|
|
<div id="scanAlert" class="alert" hidden></div>
|
|
<div id="devicesList" class="device-grid" aria-live="polite">
|
|
<p class="empty">No scan yet. Click <strong>Scan Network</strong> to look for devices with port 5555 open.</p>
|
|
</div>
|
|
<p class="muted small hint-foot">Discovery probes TCP port 5555 and reads device name via local network lookup (no <code>adb connect</code> until you press Connect).</p>
|
|
</section>
|
|
|
|
<section class="card" aria-labelledby="control-title">
|
|
<div class="card-header">
|
|
<h2 class="section-title" id="control-title">Remote Control</h2>
|
|
<span class="badge" id="selectedBadge">No device selected</span>
|
|
</div>
|
|
|
|
<div id="controlEmpty" class="empty">
|
|
Select a device from the left to connect and send commands.
|
|
</div>
|
|
|
|
<div id="controlPanel" hidden>
|
|
<div class="selected-device">
|
|
<div>
|
|
<p class="selected-name" id="selectedName">Unknown device</p>
|
|
<p class="muted small no-margin" id="selectedIp">—</p>
|
|
</div>
|
|
<div class="actions no-margin-top">
|
|
<button type="button" class="button button-primary button-small" id="connectBtn">Connect</button>
|
|
<button type="button" class="button button-danger button-small" id="disconnectBtn">Disconnect</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="commandAlert" class="alert" hidden></div>
|
|
|
|
<div class="remote-section">
|
|
<p class="section-title">Navigation</p>
|
|
<div class="remote-grid" aria-label="Directional controls">
|
|
<span></span>
|
|
<button type="button" class="button remote-btn" data-key="KEYCODE_DPAD_UP" aria-label="Up">▲</button>
|
|
<span></span>
|
|
<button type="button" class="button remote-btn" data-key="KEYCODE_DPAD_LEFT" aria-label="Left">◀</button>
|
|
<button type="button" class="button remote-btn button-primary" data-key="KEYCODE_DPAD_CENTER" aria-label="OK">OK</button>
|
|
<button type="button" class="button remote-btn" data-key="KEYCODE_DPAD_RIGHT" aria-label="Right">▶</button>
|
|
<span></span>
|
|
<button type="button" class="button remote-btn" data-key="KEYCODE_DPAD_DOWN" aria-label="Down">▼</button>
|
|
<span></span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="remote-section">
|
|
<p class="section-title">Quick Actions</p>
|
|
<div class="actions no-margin-top wrap-actions">
|
|
<button type="button" class="button button-small" data-key="KEYCODE_HOME">Home</button>
|
|
<button type="button" class="button button-small" data-key="KEYCODE_BACK">Back</button>
|
|
<button type="button" class="button button-small" data-key="KEYCODE_MENU">Menu</button>
|
|
<button type="button" class="button button-small" data-key="KEYCODE_APP_SWITCH">Apps</button>
|
|
<button type="button" class="button button-small" data-key="KEYCODE_SETTINGS">Settings</button>
|
|
<button type="button" class="button button-small" data-key="KEYCODE_INFO">Info</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="remote-section">
|
|
<p class="section-title">Playback & Volume</p>
|
|
<div class="actions no-margin-top wrap-actions">
|
|
<button type="button" class="button button-small" data-key="KEYCODE_MEDIA_PREVIOUS">Prev</button>
|
|
<button type="button" class="button button-small" data-key="KEYCODE_MEDIA_PLAY_PAUSE">Play/Pause</button>
|
|
<button type="button" class="button button-small" data-key="KEYCODE_MEDIA_NEXT">Next</button>
|
|
<button type="button" class="button button-small" data-key="KEYCODE_VOLUME_DOWN">Vol -</button>
|
|
<button type="button" class="button button-small" data-key="KEYCODE_MUTE">Mute</button>
|
|
<button type="button" class="button button-small" data-key="KEYCODE_VOLUME_UP">Vol +</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="remote-section">
|
|
<p class="section-title">Command Picker</p>
|
|
<div class="field">
|
|
<label for="commandSelect">Choose a command</label>
|
|
<select id="commandSelect"></select>
|
|
<p class="hint" id="commandDesc">Select a command to see what it does.</p>
|
|
</div>
|
|
<div class="actions no-margin-top">
|
|
<button type="button" class="button button-primary button-small" id="sendCommandBtn">Send Command</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="remote-section">
|
|
<p class="section-title">Batch Commands</p>
|
|
<div class="field">
|
|
<label for="batchInput">Paste commands (one per line)</label>
|
|
<textarea id="batchInput" rows="5" placeholder="KEYCODE_HOME KEYCODE_DPAD_DOWN KEYCODE_DPAD_CENTER"></textarea>
|
|
<p class="hint">Runs keycodes in order, one per line. Lines starting with <code>#</code> and empty lines are ignored. Only whitelisted keycodes are accepted.</p>
|
|
</div>
|
|
<div class="actions no-margin-top">
|
|
<button type="button" class="button button-primary button-small" id="runBatchBtn">Run Batch</button>
|
|
<button type="button" class="button button-small" id="clearBatchBtn">Clear</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="remote-section">
|
|
<p class="section-title">Send Text</p>
|
|
<form id="textForm" class="input-group" autocomplete="off">
|
|
<label class="sr-only" for="textInput">Text to send</label>
|
|
<input id="textInput" type="text" maxlength="200" placeholder="Type text to send to device…" inputmode="text">
|
|
<button type="submit" class="button button-primary">Send</button>
|
|
</form>
|
|
<p class="hint">Uses <code>adb shell input text</code>. Basic ASCII characters work best.</p>
|
|
</div>
|
|
|
|
<details class="command-log-details">
|
|
<summary>Command log</summary>
|
|
<pre id="commandLog" class="command-log" aria-live="polite">No commands sent yet.</pre>
|
|
</details>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="assets/app.js" defer></script>
|
|
</body>
|
|
</html>
|