From b6c1ee174312af1cb7e15041ae32305f46bd80cd Mon Sep 17 00:00:00 2001 From: Ajay Date: Sun, 16 Jan 2022 13:56:57 -0500 Subject: [PATCH] Don't allow submissions on active premieres or livestreams Fix #523 Fix #367 --- public/_locales/en/messages.json | 3 +++ src/content.ts | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index f8157d91..6b8f923f 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -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" }, diff --git a/src/content.ts b/src/content.ts index 0d0aa132..37c3812a 100644 --- a/src/content.ts +++ b/src/content.ts @@ -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());