mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-21 17:33:29 +01:00
ability to specify sonos service name and id
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import express, { Express } from "express";
|
||||
import * as Eta from "eta";
|
||||
import { Sonos, servicesFrom, registrationStatus } from "./sonos";
|
||||
import { Sonos, servicesFrom, registrationStatus, Service } from "./sonos";
|
||||
|
||||
function server(sonos: Sonos): Express {
|
||||
function server(sonos: Sonos, bonob: Service): Express {
|
||||
const app = express();
|
||||
|
||||
app.use(express.static("./web/public"));
|
||||
@@ -12,14 +12,15 @@ function server(sonos: Sonos): Express {
|
||||
app.set("views", "./web/views");
|
||||
|
||||
app.get("/", (_, res) => {
|
||||
sonos.devices().then(devices => {
|
||||
const services = servicesFrom(devices)
|
||||
sonos.devices().then((devices) => {
|
||||
const services = servicesFrom(devices);
|
||||
res.render("index", {
|
||||
devices,
|
||||
services,
|
||||
registration: registrationStatus(services)
|
||||
})
|
||||
})
|
||||
bonob,
|
||||
registration: registrationStatus(services, bonob),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return app;
|
||||
|
||||
Reference in New Issue
Block a user