aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay <[email protected]>2024-06-23 00:31:11 +0530
committerAjay <[email protected]>2024-06-23 00:31:11 +0530
commit116190f2b34b2df54b1a9038e0e087c7302d1e45 (patch)
treecbfc1bcb710829fca75d78b15be0aea47379469c
parent4bbd59b988db2b06c363ce36c351cdb551c4df1e (diff)
downloadSponsorBlock-116190f2b34b2df54b1a9038e0e087c7302d1e45.tar.gz
SponsorBlock-116190f2b34b2df54b1a9038e0e087c7302d1e45.zip
Warn if server-side ad wasn't detected and submitting a segment
m---------maze-utils0
m---------public/_locales0
-rw-r--r--src/components/SubmissionNoticeComponent.tsx7
-rw-r--r--src/content.ts3
4 files changed, 8 insertions, 2 deletions
diff --git a/maze-utils b/maze-utils
-Subproject 28a41ee8335750fd16eed1d3a818f9f9e0aaf6a
+Subproject 3c7787897e1e65cf6b55e76f39c43f4ed081d24
diff --git a/public/_locales b/public/_locales
-Subproject becf2e3f14983eae390d182ded0ac7897048e20
+Subproject 7cedce215851872be28bd50a9f690b680dd5444
diff --git a/src/components/SubmissionNoticeComponent.tsx b/src/components/SubmissionNoticeComponent.tsx
index 6ecd0e84..28703767 100644
--- a/src/components/SubmissionNoticeComponent.tsx
+++ b/src/components/SubmissionNoticeComponent.tsx
@@ -9,7 +9,7 @@ import NoticeTextSelectionComponent from "./NoticeTextSectionComponent";
import SponsorTimeEditComponent from "./SponsorTimeEditComponent";
import { getGuidelineInfo } from "../utils/constants";
import { exportTimes } from "../utils/exporter";
-import { getVideo } from "../../maze-utils/src/video";
+import { getVideo, isCurrentTimeWrong } from "../../maze-utils/src/video";
export interface SubmissionNoticeProps {
// Contains functions and variables from the content script needed by the skip notice
@@ -216,6 +216,11 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
}
submit(): void {
+ if (isCurrentTimeWrong()) {
+ alert(chrome.i18n.getMessage("submissionFailedServerSideAds"));
+ return;
+ }
+
// save all items
for (const ref of this.timeEditRefs) {
ref.current.saveEditTimes();
diff --git a/src/content.ts b/src/content.ts
index 3eec8a2c..f2683208 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -34,7 +34,7 @@ import { ChapterVote } from "./render/ChapterVote";
import { openWarningDialog } from "./utils/warnings";
import { isFirefoxOrSafari, waitFor } from "../maze-utils/src";
import { getErrorMessage, getFormattedTime } from "../maze-utils/src/formating";
-import { getChannelIDInfo, getVideo, getIsAdPlaying, getIsLivePremiere, setIsAdPlaying, checkVideoIDChange, getVideoID, getYouTubeVideoID, setupVideoModule, checkIfNewVideoID, isOnInvidious, isOnMobileYouTube, getLastNonInlineVideoID, triggerVideoIDChange, triggerVideoElementChange, getIsInline, getCurrentTime, setCurrentTime, getVideoDuration } from "../maze-utils/src/video";
+import { getChannelIDInfo, getVideo, getIsAdPlaying, getIsLivePremiere, setIsAdPlaying, checkVideoIDChange, getVideoID, getYouTubeVideoID, setupVideoModule, checkIfNewVideoID, isOnInvidious, isOnMobileYouTube, getLastNonInlineVideoID, triggerVideoIDChange, triggerVideoElementChange, getIsInline, getCurrentTime, setCurrentTime, getVideoDuration, verifyCurrentTime } from "../maze-utils/src/video";
import { Keybind, StorageChangesObject, isSafari, keybindEquals, keybindToString } from "../maze-utils/src/config";
import { findValidElement } from "../maze-utils/src/dom"
import { getHash, HashedValue } from "../maze-utils/src/hash";
@@ -1962,6 +1962,7 @@ function getRealCurrentTime(): number {
}
function startOrEndTimingNewSegment() {
+ verifyCurrentTime();
const roundedTime = Math.round((getRealCurrentTime() + Number.EPSILON) * 1000) / 1000;
if (!isSegmentCreationInProgress()) {
sponsorTimesSubmitting.push({