Don't allow submissions on active premieres or livestreams

Fix #523
Fix #367
This commit is contained in:
Ajay 2022-01-16 13:56:57 -05:00
parent 6b6ca6198f
commit b6c1ee1743
2 changed files with 9 additions and 0 deletions

View file

@ -440,6 +440,9 @@
"shortCheck": {
"message": "The following submission is shorter than your minimum duration option. This could mean that this is already submitted, and just being ignored due to this option. Are you sure you would like to submit?"
},
"liveOrPremiere": {
"message": "Submitting on an active livesteam or premiere is not allowed. Please wait until it finishes, then refresh the page and verify that the segments are still valid."
},
"showUploadButton": {
"message": "Show Upload Button"
},

View file

@ -1798,6 +1798,12 @@ function submitSponsorTimes() {
//send the message to the background js
//called after all the checks have been made that it's okay to do so
async function sendSubmitMessage() {
// Block if submitting on a running livestream or premiere
if (isVisible(document.querySelector(".ytp-live-badge"))) {
alert(chrome.i18n.getMessage("liveOrPremiere"));
return;
}
// Add loading animation
playerButtons.submit.image.src = chrome.extension.getURL("icons/PlayerUploadIconSponsorBlocker.svg");
const stopAnimation = AnimationUtils.applyLoadingAnimation(playerButtons.submit.button, 1, () => updateEditButtonsOnPlayer());