fxi big
This commit is contained in:
parent
e39daec704
commit
84ebc30b3f
2
index.js
2
index.js
@ -7,7 +7,7 @@ var {execFile} = require("child_process");
|
||||
var app = express();
|
||||
app.set("env", process.env.NODE_ENV || "production");
|
||||
app.set("trust proxy", "loopback");
|
||||
var server = app.listen(process.env.PORT || 8080, process.env.ADDR);
|
||||
var server = app.listen(process.env.PORT || 9245, process.env.ADDR);
|
||||
|
||||
app.get("/channels", async (req, res) => {
|
||||
res.send(await getChannels());
|
||||
|
@ -372,17 +372,17 @@
|
||||
}
|
||||
|
||||
|
||||
var playlist;
|
||||
var gPlaylist;
|
||||
|
||||
async function nowPlaying() {
|
||||
var expired;
|
||||
var playlist = gPlaylist, expired;
|
||||
if (!playlist || (expired = now() > playlist.timestamp + playlist.totalDuration*1000)) {
|
||||
playlist = await fetch(`channels/${gChannel}/playlist.json`).then(res => res.json());
|
||||
gPlaylist = playlist = await fetch(`channels/${gChannel}/playlist.json`).then(res => res.json());
|
||||
}
|
||||
|
||||
if (expired) {
|
||||
console.warn("playlist is expired");
|
||||
var playlist = {...playlist};
|
||||
playlist = {...gPlaylist};
|
||||
while (now() > playlist.timestamp + playlist.totalDuration*1000) {
|
||||
playlist.timestamp = playlist.timestamp + playlist.totalDuration*1000;
|
||||
}
|
||||
@ -454,7 +454,7 @@
|
||||
case "channel":
|
||||
gChannel = j[1];
|
||||
history.pushState({}, "", `/${gChannel}`);
|
||||
playlist = undefined;
|
||||
gPlaylist = undefined;
|
||||
sync();
|
||||
[...document.getElementsByClassName('mousie')].forEach(m => m.remove());
|
||||
lines = [];
|
||||
@ -535,7 +535,7 @@
|
||||
};
|
||||
ws.onclose = () => {
|
||||
setTimeout(createWs, 5000);
|
||||
playlist = undefined;
|
||||
gPlaylist = undefined;
|
||||
[...document.getElementsByClassName('mousie')].forEach(m => m.remove());
|
||||
};
|
||||
})();
|
||||
|
Loading…
x
Reference in New Issue
Block a user