|
|
@ -202,6 +202,9 @@ window.addEventListener("DOMContentLoaded", async (event) => {
|
|
|
|
document.getElementById("save-button").addEventListener("click", (_event) => {
|
|
|
|
document.getElementById("save-button").addEventListener("click", (_event) => {
|
|
|
|
saveVideoDraft();
|
|
|
|
saveVideoDraft();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
document.getElementById("submit-changes-button").addEventListener("click", (_event) => {
|
|
|
|
|
|
|
|
submitVideoChanges();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
document.getElementById("advanced-submission").addEventListener("click", (_event) => {
|
|
|
|
document.getElementById("advanced-submission").addEventListener("click", (_event) => {
|
|
|
|
const advancedOptionsContainer = document.getElementById("advanced-submission-options");
|
|
|
|
const advancedOptionsContainer = document.getElementById("advanced-submission-options");
|
|
|
@ -406,6 +409,15 @@ async function initializeVideoInfo() {
|
|
|
|
uploaderAllowlistBox.value = videoInfo.uploader_whitelist.join(",");
|
|
|
|
uploaderAllowlistBox.value = videoInfo.uploader_whitelist.join(",");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (videoInfo.state === "DONE") {
|
|
|
|
|
|
|
|
const submitButton = document.getElementById("submit-button");
|
|
|
|
|
|
|
|
submitButton.classList.add("hidden");
|
|
|
|
|
|
|
|
const saveButton = document.getElementById("save-button");
|
|
|
|
|
|
|
|
saveButton.classList.add("hidden");
|
|
|
|
|
|
|
|
const submitChangesButton = document.getElementById("submit-changes-button");
|
|
|
|
|
|
|
|
submitChangesButton.classList.remove("hidden");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (modifiedAdvancedOptions) {
|
|
|
|
if (modifiedAdvancedOptions) {
|
|
|
|
const advancedSubmissionContainer = document.getElementById("advanced-submission-options");
|
|
|
|
const advancedSubmissionContainer = document.getElementById("advanced-submission-options");
|
|
|
|
advancedSubmissionContainer.classList.remove("hidden");
|
|
|
|
advancedSubmissionContainer.classList.remove("hidden");
|
|
|
@ -611,14 +623,18 @@ async function submitVideo() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return sendVideoData(true, false);
|
|
|
|
return sendVideoData("EDITED", false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function saveVideoDraft() {
|
|
|
|
async function saveVideoDraft() {
|
|
|
|
return sendVideoData(false, false);
|
|
|
|
return sendVideoData("UNEDITED", false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function submitVideoChanges() {
|
|
|
|
|
|
|
|
return sendVideoData("MODIFIED", false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function sendVideoData(edited, overrideChanges) {
|
|
|
|
async function sendVideoData(newState, overrideChanges) {
|
|
|
|
let videoDescription = document.getElementById("video-info-description").value;
|
|
|
|
let videoDescription = document.getElementById("video-info-description").value;
|
|
|
|
if (videoDescription.indexOf(CHAPTER_MARKER_DELIMITER_PARTIAL) !== -1) {
|
|
|
|
if (videoDescription.indexOf(CHAPTER_MARKER_DELIMITER_PARTIAL) !== -1) {
|
|
|
|
addError(
|
|
|
|
addError(
|
|
|
@ -627,6 +643,8 @@ async function sendVideoData(edited, overrideChanges) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const edited = newState === "EDITED";
|
|
|
|
|
|
|
|
|
|
|
|
const submissionResponseElem = document.getElementById("submission-response");
|
|
|
|
const submissionResponseElem = document.getElementById("submission-response");
|
|
|
|
submissionResponseElem.classList.value = ["submission-response-pending"];
|
|
|
|
submissionResponseElem.classList.value = ["submission-response-pending"];
|
|
|
|
submissionResponseElem.innerText = "Submitting video...";
|
|
|
|
submissionResponseElem.innerText = "Submitting video...";
|
|
|
@ -771,7 +789,6 @@ async function sendVideoData(edited, overrideChanges) {
|
|
|
|
"advanced-submission-option-uploader-allow"
|
|
|
|
"advanced-submission-option-uploader-allow"
|
|
|
|
).value;
|
|
|
|
).value;
|
|
|
|
const uploaderAllowlist = uploaderAllowlistValue ? uploaderAllowlistValue.split(",") : null;
|
|
|
|
const uploaderAllowlist = uploaderAllowlistValue ? uploaderAllowlistValue.split(",") : null;
|
|
|
|
const state = edited ? "EDITED" : "UNEDITED";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const editData = {
|
|
|
|
const editData = {
|
|
|
|
video_ranges: ranges,
|
|
|
|
video_ranges: ranges,
|
|
|
@ -784,7 +801,7 @@ async function sendVideoData(edited, overrideChanges) {
|
|
|
|
video_channel: globalStreamName,
|
|
|
|
video_channel: globalStreamName,
|
|
|
|
video_quality: videoInfo.video_quality,
|
|
|
|
video_quality: videoInfo.video_quality,
|
|
|
|
uploader_whitelist: uploaderAllowlist,
|
|
|
|
uploader_whitelist: uploaderAllowlist,
|
|
|
|
state: state,
|
|
|
|
state: newState,
|
|
|
|
|
|
|
|
|
|
|
|
// We also provide some sheet column values to verify data hasn't changed.
|
|
|
|
// We also provide some sheet column values to verify data hasn't changed.
|
|
|
|
sheet_name: videoInfo.sheet_name,
|
|
|
|
sheet_name: videoInfo.sheet_name,
|
|
|
@ -815,7 +832,7 @@ async function sendVideoData(edited, overrideChanges) {
|
|
|
|
|
|
|
|
|
|
|
|
if (submitResponse.ok) {
|
|
|
|
if (submitResponse.ok) {
|
|
|
|
submissionResponseElem.classList.value = ["submission-response-success"];
|
|
|
|
submissionResponseElem.classList.value = ["submission-response-success"];
|
|
|
|
if (edited) {
|
|
|
|
if (newState === "EDITED") {
|
|
|
|
submissionResponseElem.innerText = "Submitted edit";
|
|
|
|
submissionResponseElem.innerText = "Submitted edit";
|
|
|
|
const submissionTimesListContainer = document.createElement("ul");
|
|
|
|
const submissionTimesListContainer = document.createElement("ul");
|
|
|
|
for (const range of rangesData) {
|
|
|
|
for (const range of rangesData) {
|
|
|
@ -828,8 +845,13 @@ async function sendVideoData(edited, overrideChanges) {
|
|
|
|
submissionTimesListContainer.appendChild(submissionTimeResponse);
|
|
|
|
submissionTimesListContainer.appendChild(submissionTimeResponse);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
submissionResponseElem.appendChild(submissionTimesListContainer);
|
|
|
|
submissionResponseElem.appendChild(submissionTimesListContainer);
|
|
|
|
} else {
|
|
|
|
} else if (newState === "UNEDITED") {
|
|
|
|
submissionResponseElem.innerText = "Saved draft";
|
|
|
|
submissionResponseElem.innerText = "Saved draft";
|
|
|
|
|
|
|
|
} else if (newState === "MODIFIED") {
|
|
|
|
|
|
|
|
submissionResponseElem.innerText = "Submitted changes";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// should never happen but shrug
|
|
|
|
|
|
|
|
submissionResponseElem.innerText = `Submitted state ${newState}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
submissionResponseElem.classList.value = ["submission-response-error"];
|
|
|
|
submissionResponseElem.classList.value = ["submission-response-error"];
|
|
|
@ -838,7 +860,7 @@ async function sendVideoData(edited, overrideChanges) {
|
|
|
|
const submitButton = document.createElement("button");
|
|
|
|
const submitButton = document.createElement("button");
|
|
|
|
submitButton.innerText = "Submit Anyway";
|
|
|
|
submitButton.innerText = "Submit Anyway";
|
|
|
|
submitButton.addEventListener("click", (_event) => {
|
|
|
|
submitButton.addEventListener("click", (_event) => {
|
|
|
|
sendVideoData(edited, true);
|
|
|
|
sendVideoData(newState, true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
submissionResponseElem.innerHTML = "";
|
|
|
|
submissionResponseElem.innerHTML = "";
|
|
|
|
submissionResponseElem.appendChild(serverErrorNode);
|
|
|
|
submissionResponseElem.appendChild(serverErrorNode);
|
|
|
|