Merge pull request #351 from ajayyy/react

Category Improvements
This commit is contained in:
Ajay Ramachandran
2020-05-15 20:56:09 -04:00
committed by GitHub
4 changed files with 16 additions and 23 deletions

View File

@@ -17,6 +17,9 @@ jobs:
- run: npm install - run: npm install
- name: Copy configuration - name: Copy configuration
run: cp config.json.example config.json run: cp config.json.example config.json
- name: Install Zip
run: sudo apt-get install zip
# Create Chrome artifacts # Create Chrome artifacts
- name: Create Chrome artifacts - name: Create Chrome artifacts
@@ -28,9 +31,7 @@ jobs:
- run: mkdir ./builds - run: mkdir ./builds
- name: Zip Artifacts - name: Zip Artifacts
run: cd ./dist run: cd ./dist
- uses: montudor/action-zip@v0.1.0 - run: zip -r ../builds/ChromeExtension.zip *
with:
args: zip -r ../builds/ChromeExtension.zip *
- run: cd ../ - run: cd ../
# Create Firefox artifacts # Create Firefox artifacts
@@ -56,9 +57,7 @@ jobs:
path: dist path: dist
- name: Zip Artifacts - name: Zip Artifacts
run: cd ./dist run: cd ./dist
- uses: montudor/action-zip@v0.1.0 - run: zip -r ../builds/ChromeExtensionBeta.zip *
with:
args: zip -r ../builds/ChromeExtensionBeta.zip *
- run: cd ../ - run: cd ../
- name: Create Firefox Beta artifacts - name: Create Firefox Beta artifacts
@@ -69,9 +68,7 @@ jobs:
path: dist path: dist
- name: Zip Artifacts - name: Zip Artifacts
run: cd ./dist run: cd ./dist
- uses: montudor/action-zip@v0.1.0 - run: zip -r ../builds/FirefoxExtensionBeta.zip *
with:
args: zip -r ../builds/FirefoxExtensionBeta.zip *
- run: cd ../ - run: cd ../
# Create Firefox Signed Beta version # Create Firefox Signed Beta version

View File

@@ -1,7 +1,7 @@
{ {
"name": "__MSG_fullName__", "name": "__MSG_fullName__",
"short_name": "__MSG_Name__", "short_name": "__MSG_Name__",
"version": "1.2.28.2", "version": "1.2.28.3",
"default_locale": "en", "default_locale": "en",
"description": "__MSG_Description__", "description": "__MSG_Description__",
"content_scripts": [{ "content_scripts": [{

View File

@@ -198,13 +198,11 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
</button> </button>
{/* Category vote */} {/* Category vote */}
{Config.config.testingServer && <button className="sponsorSkipObject sponsorSkipNoticeButton"
<button className="sponsorSkipObject sponsorSkipNoticeButton" onClick={() => this.openCategoryChooser()}>
onClick={() => this.openCategoryChooser()}>
{chrome.i18n.getMessage("incorrectCategory")} {chrome.i18n.getMessage("incorrectCategory")}
</button> </button>
}
</td> </td>
</tr> </tr>

View File

@@ -470,7 +470,7 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr
return; return;
} }
if (incorrectVideoIDCheck()) return; if (incorrectVideoCheck()) return;
if (currentTime === undefined || currentTime === null) currentTime = video.currentTime; if (currentTime === undefined || currentTime === null) currentTime = video.currentTime;
@@ -490,7 +490,7 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr
let forcedSkipTime: number = null; let forcedSkipTime: number = null;
let forcedIncludeIntersectingSegments = false; let forcedIncludeIntersectingSegments = false;
if (incorrectVideoIDCheck(videoID)) return; if (incorrectVideoCheck(videoID, currentSkip)) return;
if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) { if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) {
skipToTime(video, skipInfo.endIndex, skipInfo.array, skipInfo.openNotice); skipToTime(video, skipInfo.endIndex, skipInfo.array, skipInfo.openNotice);
@@ -515,13 +515,11 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr
} }
/** /**
* This makes sure the videoID is still correct * This makes sure the videoID is still correct and if the sponsorTime is included
*
* TODO: Remove this bug catching if statement when the bug is found
*/ */
function incorrectVideoIDCheck(videoID?: string): boolean { function incorrectVideoCheck(videoID?: string, sponsorTime?: SponsorTime): boolean {
let currentVideoID = getYouTubeVideoID(document.URL); let currentVideoID = getYouTubeVideoID(document.URL);
if (currentVideoID !== (videoID || sponsorVideoID)) { if (currentVideoID !== (videoID || sponsorVideoID) || (sponsorTime && !sponsorTimes.includes(sponsorTime))) {
// Something has really gone wrong // Something has really gone wrong
console.error("[SponsorBlock] The videoID recorded when trying to skip is different than what it should be."); console.error("[SponsorBlock] The videoID recorded when trying to skip is different than what it should be.");
console.error("[SponsorBlock] VideoID recorded: " + sponsorVideoID + ". Actual VideoID: " + currentVideoID); console.error("[SponsorBlock] VideoID recorded: " + sponsorVideoID + ". Actual VideoID: " + currentVideoID);