{ | { | ||||
"name": "pipic", | "name": "pipic", | ||||
"version": "1.0.0", | |||||
"version": "1.0.1", | |||||
"description": "Pipic is software for making slideshows. The idea is that you have one server, running a pipic server, and have as many clients as necessary which just display the website hosted by the pipic server.", | "description": "Pipic is software for making slideshows. The idea is that you have one server, running a pipic server, and have as many clients as necessary which just display the website hosted by the pipic server.", | ||||
"main": "server.js", | "main": "server.js", | ||||
"dependencies": { | "dependencies": { |
} | } | ||||
function reload() { | function reload() { | ||||
message("Server down, waiting"); | |||||
message("Connection to server lost."); | |||||
var i = setInterval(() => { | var i = setInterval(() => { | ||||
fetch("/") | fetch("/") | ||||
.then(() => { | |||||
.then(res => { | |||||
if (res.status !== 200) | |||||
return; | |||||
history.replaceState({}, "", "/"); | history.replaceState({}, "", "/"); | ||||
location.reload(); | location.reload(); | ||||
}) | }) | ||||
} | } | ||||
await(); | await(); | ||||
}) | }) | ||||
.catch(err => { console.error(err); await(); }); | |||||
.catch(err => { console.error(err); reload(); }); | |||||
} | } | ||||
await(); | await(); |