@@ 19,6 19,7 @@
</div>
</div>
</div>
+
<div v-if="rokuHost">
<div>
<img src="/roku-remote.png" alt="Roku remote" usemap="#rokumap"/>
@@ 40,6 41,7 @@
<area shape="rect" coords="284,409,306,457" title="Mute" @click="apiPress('mute')"/>
</map>
</div>
+
<div class="text-entry">
<label>
Type text:
@@ 54,6 56,16 @@
<button @click="sendLiteral"><b>⏎</b></button>
<button @click="apiPress('backspace')"><b>⌫</b></button>
</div>
+
+ <div class="apps">
+ <img
+ :alt="name"
+ @click="launch(appId)"
+ :src="`app-icons/${appId}.jpg`"
+ v-for="(name, appId) in apps"
+ :key="appId"
+ />
+ </div>
</div>
</div>
</template>
@@ 73,6 85,9 @@ export default {
this.rokuHosts = res.data
this.discoveringRokus = false
+ const res2 = await axios.get('/api/apps')
+ this.apps = res2.data
+
const self = this
window.addEventListener('keydown', function (e) {
if (! self.textFieldFocused) {
@@ 88,6 103,7 @@ export default {
},
data: function () {
return {
+ apps: {},
discoveringRokus: false,
literalText: '',
rokuHost: null,
@@ 99,6 115,9 @@ export default {
async apiPress (button) {
await axios.get(`/api/press/${button}`)
},
+ launch(appId) {
+ axios.get(`/api/launch/${appId}`)
+ },
async sendLiteral () {
await axios.post(
'/api/literal',
@@ 139,4 158,12 @@ map {
max-width: 20vw;
}
}
+
+.apps {
+ img {
+ cursor: pointer;
+ margin: 1em;
+ max-width: 30vw;
+ }
+}
</style>
@@ 21,6 21,23 @@ def choose_roku():
return "OK", 200
+@app.route('/api/apps')
+def apps():
+ apps = dict()
+ for a in current_roku.apps:
+ apps[a.id] = a.name
+
+ return make_response(
+ jsonify(apps),
+ 200
+ )
+
+@app.route('/api/launch/<app_id>')
+def launch(app_id):
+ current_roku[app_id].launch()
+
+ return "OK", 200
+
@app.route('/api/discover')
def discover():
rokus = Roku.discover()