diff --git a/src/dataFetching.ts b/src/dataFetching.ts index ed4c10d..a92f02c 100644 --- a/src/dataFetching.ts +++ b/src/dataFetching.ts @@ -1,6 +1,6 @@ import { VideoID, getVideo, getVideoID, getYouTubeVideoID } from "../maze-utils/src/video"; import { ThumbnailSubmission, ThumbnailWithRandomTimeResult, fetchVideoMetadata, isLiveSync } from "./thumbnails/thumbnailData"; -import { TitleResult, TitleSubmission } from "./titles/titleData"; +import { getCurrentPageTitle, TitleResult, TitleSubmission } from "./titles/titleData"; import { FetchResponse, sendRealRequestToCustomServer } from "../maze-utils/src/background-request-proxy"; import { BrandingLocation, BrandingResult, replaceCurrentVideoBranding, updateBrandingForVideo } from "./videoBranding/videoBranding"; import { logError } from "./utils/logger"; @@ -16,6 +16,7 @@ import { getThumbnailFallbackOption, getThumbnailFallbackOptionFastCheck, should import { updateSubmitButton } from "./video"; import { sendRequestToServer } from "./utils/requests"; import { thumbnailDataCache } from "./thumbnails/thumbnailDataCache"; +import { getAutoWarning } from "./submission/autoWarning"; interface VideoBrandingCacheRecord extends BrandingResult { lastUsed: number; @@ -490,6 +491,8 @@ export async function submitVideoBranding(videoID: VideoID, title: TitleSubmissi Config.config!.firstThumbnailSubmitted = true; } + const wasWarned = !!title && !!getAutoWarning(title.title, getCurrentPageTitle() || ""); + const result = await sendRequestToServer("POST", "/api/branding", { userID: Config.config!.userID, videoID, @@ -497,7 +500,8 @@ export async function submitVideoBranding(videoID: VideoID, title: TitleSubmissi thumbnail, downvote, autoLock: actAsVip, - videoDuration: getVideo()?.duration + videoDuration: getVideo()?.duration, + wasWarned }); clearCache(videoID); diff --git a/src/submission/autoWarning.ts b/src/submission/autoWarning.ts index 29e99c7..8256d1a 100644 --- a/src/submission/autoWarning.ts +++ b/src/submission/autoWarning.ts @@ -95,10 +95,10 @@ const autoWarningChecks: AutoWarningCheck[] = [ } ]; -function getAutoWarning(title: string, originalTitle: string): { id: string; text: string } | null { +export function getAutoWarning(title: string, originalTitle: string, ignoreShown = false): { id: string; text: string } | null { for (const check of autoWarningChecks) { const { found, match } = check.check(title, originalTitle); - if (found && !shownWarnings.includes(check.id)) { + if (found && (ignoreShown || !shownWarnings.includes(check.id))) { return { id: check.id, text: check.error + (match ? `\n\n${chrome.i18n.getMessage("DetectedWord")}${match}` : "")