Skip to content

Commit

Permalink
Correct URL schema and include cast script
Browse files Browse the repository at this point in the history
  • Loading branch information
superhawk610 committed Oct 12, 2017
1 parent dd51a91 commit f0c62e8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ Head over to `http://YOUR_LOCAL_IP:3944/` in your browser to get started, then s

In order for a Chromecast to establish and maintain a connection with a Cast sender, the sender must open two ports:

```
```html
1900/UDP (DIAL)
5353/UDP (mDNS)
```

Make sure that the device running MultiCast has these ports open, as well as the standard HTTP ports

```
```html
80/TCP/UDP (HTTP)
443/TCP/UDP (HTTPS)
```
Expand All @@ -140,7 +140,7 @@ Make sure that the device running MultiCast has these ports open, as well as the

### Common Errors

```shell
```html
*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs
Expand All @@ -151,6 +151,13 @@ Make sure that the device running MultiCast has these ports open, as well as the

Don't worry about this. This warning shows up in all Node apps on Linux that depend on `libavahi-compat-libdnssd-dev`. You can safely ignore it.

**Can't launch after installing via NPM?**
Make sure your `NODE_PATH` environment variable correctly includes the global store for node dependencies. On Linux:

```shell
export NODE_PATH=/opt/lib/node_modules
```

**Multicast can't find your devices?**
Make sure they've already been setup and powered on and the display that they're connected to is powered on and displaying their output.

Expand Down
14 changes: 3 additions & 11 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,18 +257,18 @@ app.get('/device/:device_id', (req, res) => {
Chromecast.findOne({ deviceId: req.params.device_id }).populate('channel').exec((err, device) => {
if (err) console.log(err)
if (device && device.channel) {
if (takeover) res.render(`layouts/${takeover.layout}`, { deviceId: req.params.device_id, channel: takeover })
if (takeover) res.render(`layouts/${takeover.layout}`, { deviceId: req.params.device_id, channel: takeover, casting: true })
else {

/* device registered and channel set
display device page */
res.render(`layouts/${device.channel.layout}`, { deviceId: req.params.device_id, channel: device.channel })
res.render(`layouts/${device.channel.layout}`, { deviceId: req.params.device_id, channel: device.channel, casting: true })

}
} else {
var localDevice = devices.find(d => d.deviceId == req.params.device_id)
if (device) {
if (takeover) res.render(`layouts/${takeover.layout}`, { deviceId: req.params.device_id, channel: takeover })
if (takeover) res.render(`layouts/${takeover.layout}`, { deviceId: req.params.device_id, channel: takeover, casting: true })
else {

/* device registered but no channel set
Expand Down Expand Up @@ -371,14 +371,6 @@ app.post('/channel/new', (req, res) => {
})

app.get('/channel/:channel_id', (req, res) => {
Channel.findOne({ _id: req.params.channel_id }).exec((err, channel) => {
if (err) console.log(err)
if (channel) res.render(`layouts/${channel.layout}`, { channel: channel, casting: true })
else res.render('layouts/empty', { casting: true })
})
})

app.get('/channel/:channel_id/preview', (req, res) => {
Channel.findOne({ _id: req.params.channel_id }).exec((err, channel) => {
if (err) console.log(err)
if (channel) res.render(`layouts/${channel.layout}`, { channel: channel, casting: false })
Expand Down
2 changes: 1 addition & 1 deletion app/views/channels.pug
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ table.table
td
a(href=`/channel/${c._id}/edit`)= c.name
td.text-right
a(href=`/channel/${c._id}/preview`) Preview
a(href=`/channel/${c._id}`) Preview
else
tr
td.text-gray(colspan=42) No channels available.

0 comments on commit f0c62e8

Please sign in to comment.