HUGE refactor. working towards web UI
This commit is contained in:
parent
dd54e8cc49
commit
1f94eecca9
29 changed files with 1669 additions and 162 deletions
26
public/script/vod.js
Normal file
26
public/script/vod.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
const uploadState = document.getElementById("upload-state");
|
||||
console.log(uploadState);
|
||||
|
||||
function start() {
|
||||
const source = new EventSource("/sse?" + new URLSearchParams({"vod": location.pathname.split("/vods")[1]}).toString());
|
||||
source.addEventListener("message", event => {
|
||||
const data = JSON.parse(event.data);
|
||||
switch (data.state) {
|
||||
case "none":
|
||||
uploadState.textContent = "Yes";
|
||||
source.close();
|
||||
break;
|
||||
case "processing":
|
||||
uploadState.textContent = `Processing (${data.progress}%)`;
|
||||
break;
|
||||
case "uploading":
|
||||
uploadState.textContent = `Uploading (${data.progress}%)`;
|
||||
break;
|
||||
case "complete":
|
||||
uploadState.textContent = "Yes";
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
start();
|
||||
Loading…
Add table
Add a link
Reference in a new issue