From 2b558c43bd5ee0e73d6a8e75bbd8ead55ff5163f Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 8 Feb 2020 22:55:59 -0500 Subject: [PATCH 1/5] Removed subdomain requirement. --- public/_locales/en/messages.json | 2 +- src/options.ts | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index db260eb041..5e0d0407ed 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -415,7 +415,7 @@ "message": "Reset" }, "customAddressError": { - "message": "This address is not in the right form. Make sure you have http:// or https:// at the begining and no slashes or sub-folders at the end." + "message": "This address is not in the right form. Make sure you have http:// or https:// at the begining and no trailing slashes." }, "areYouSureReset": { "message": "Are you sure you would like to reset this?" diff --git a/src/options.ts b/src/options.ts index 00a71bb9cb..eb0930b003 100644 --- a/src/options.ts +++ b/src/options.ts @@ -362,9 +362,8 @@ function validateServerAddress(input: string): string { input = input.substring(0, input.length - 1); } - // Isn't HTTP protocol or has extra slashes - if ((!input.startsWith("https://") && !input.startsWith("http://")) - || input.replace("://", "").includes("/")) { + // If it isn't HTTP protocol + if ((!input.startsWith("https://") && !input.startsWith("http://"))) { alert(chrome.i18n.getMessage("customAddressError")); From 50f293d783156f7e0a609d3e5eb03af4bb20540b Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 8 Feb 2020 23:01:28 -0500 Subject: [PATCH 2/5] Added better server address trimming. --- src/options.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/options.ts b/src/options.ts index eb0930b003..1ce1f05ae2 100644 --- a/src/options.ts +++ b/src/options.ts @@ -357,10 +357,10 @@ function activatePrivateTextChange(element: HTMLElement) { * @param input Input server address */ function validateServerAddress(input: string): string { - // Trim the last slash if needed - if (input.endsWith("/")) { - input = input.substring(0, input.length - 1); - } + input = input.trim(); + + // Trim the trailing slashes + input = input.replace(/\/+$/, ""); // If it isn't HTTP protocol if ((!input.startsWith("https://") && !input.startsWith("http://"))) { From 9026044528b4dc63d06a5e1611f9b5e1ab575207 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 8 Feb 2020 23:16:44 -0500 Subject: [PATCH 3/5] Fixed preview sponsor times not turning into actual ones upon submission. --- src/content.ts | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/content.ts b/src/content.ts index dba13c35df..05255f4b04 100644 --- a/src/content.ts +++ b/src/content.ts @@ -379,8 +379,20 @@ function sponsorsLookup(id: string, channelIDPromise?) { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { sponsorDataFound = true; - sponsorTimes = JSON.parse(xmlhttp.responseText).sponsorTimes; - UUIDs = JSON.parse(xmlhttp.responseText).UUIDs; + let recievedSponsorTimes = JSON.parse(xmlhttp.responseText).sponsorTimes; + let recievedUUIDs = JSON.parse(xmlhttp.responseText).UUIDs; + + // Check if any old submissions should be kept + for (let i = 0; i < UUIDs.length; i++) { + if (UUIDs[i] === null) { + // This is a user submission, keep it + recievedSponsorTimes.push(sponsorTimes[i]); + recievedUUIDs.push(UUIDs[i]); + } + } + + sponsorTimes = recievedSponsorTimes; + UUIDs = recievedUUIDs; // Remove all submissions smaller than the minimum duration if (Config.config.minDuration !== 0) { @@ -1091,10 +1103,12 @@ function sendSubmitMessage(){ Config.config.sponsorTimes.delete(currentVideoID); //add submissions to current sponsors list + if (sponsorTimes === null) sponsorTimes = []; + sponsorTimes = sponsorTimes.concat(sponsorTimesSubmitting); for (let i = 0; i < sponsorTimesSubmitting.length; i++) { - // Add some random IDs - UUIDs.push(utils.generateUserID()); + // Add placeholder IDs + UUIDs.push(null); } // Empty the submitting times From 40cddbf8ee1165355f4789da3c5be9de615995ea Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 8 Feb 2020 23:28:41 -0500 Subject: [PATCH 4/5] Disabling auto skip now enables the notice. --- src/options.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/options.ts b/src/options.ts index 1ce1f05ae2..1836c6c3ac 100644 --- a/src/options.ts +++ b/src/options.ts @@ -50,6 +50,16 @@ async function init() { switch (option) { case "supportInvidious": invidiousOnClick(checkbox, option); + break; + case "disableAutoSkip": + if (!checkbox.checked) { + // Enable the notice + Config.config["dontShowNotice"] = false; + + let showNoticeSwitch = document.querySelector("[sync-option='dontShowNotice'] > label > label > input"); + showNoticeSwitch.checked = true; + } + break; } }); From 00117bdface92e1369afea6e74b7bd938bee8b9f Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 8 Feb 2020 23:29:09 -0500 Subject: [PATCH 5/5] Increase version number. --- manifest/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest/manifest.json b/manifest/manifest.json index 4f391a4814..391b76af08 100644 --- a/manifest/manifest.json +++ b/manifest/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_fullName__", "short_name": "__MSG_Name__", - "version": "1.2.5", + "version": "1.2.6", "default_locale": "en", "description": "__MSG_Description__", "content_scripts": [