Add local ADB web remote for Android TV
Node/Express server shells out to adb (connect/pair/keyevent/text/app launch) and serves a mobile-first installable PWA remote: power, mute, input switch, volume/channel rockers, D-pad, media transport, text entry, and one-tap streaming app launch. Supports multiple saved TVs and the Android 11+ wireless-debugging pairing flow. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RSVyYcrjrbmrMKT85G4fyn
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtemp, rm } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
|
||||
test("deviceStore add/list/update/remove roundtrip", async () => {
|
||||
const dir = await mkdtemp(join(tmpdir(), "tv-remote-test-"));
|
||||
process.env.DEVICES_FILE = join(dir, "devices.json");
|
||||
|
||||
// Import fresh so it picks up the env var above.
|
||||
const store = await import(`../src/deviceStore.js?t=${Date.now()}`);
|
||||
|
||||
assert.deepEqual(await store.listSavedDevices(), []);
|
||||
|
||||
const device = await store.addSavedDevice({ name: "Living Room", host: "192.168.1.50" });
|
||||
assert.equal(device.name, "Living Room");
|
||||
assert.ok(device.id);
|
||||
|
||||
let list = await store.listSavedDevices();
|
||||
assert.equal(list.length, 1);
|
||||
|
||||
const updated = await store.updateSavedDevice(device.id, { name: "Lounge" });
|
||||
assert.equal(updated.name, "Lounge");
|
||||
|
||||
const removed = await store.removeSavedDevice(device.id);
|
||||
assert.equal(removed, true);
|
||||
|
||||
list = await store.listSavedDevices();
|
||||
assert.equal(list.length, 0);
|
||||
|
||||
await rm(dir, { recursive: true, force: true });
|
||||
delete process.env.DEVICES_FILE;
|
||||
});
|
||||
Reference in New Issue
Block a user