diff --git a/.vs/Crunchyroll Downloader/v15/.suo b/.vs/Crunchyroll Downloader/v15/.suo
index b1f7fa8..e848182 100644
Binary files a/.vs/Crunchyroll Downloader/v15/.suo and b/.vs/Crunchyroll Downloader/v15/.suo differ
diff --git a/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide b/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide
index 742a6d3..60d3c39 100644
Binary files a/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide and b/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide differ
diff --git a/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-shm b/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-shm
index c08b206..5459713 100644
Binary files a/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-shm and b/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-shm differ
diff --git a/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-wal b/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-wal
index ed36f36..058a656 100644
Binary files a/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-wal and b/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-wal differ
diff --git a/CRD-addon - Chrome/icons/icon-128.png b/CRD-addon - Chrome/icons/icon-128.png
deleted file mode 100644
index 7e9eb88..0000000
Binary files a/CRD-addon - Chrome/icons/icon-128.png and /dev/null differ
diff --git a/CRD-addon - Chrome/icons/icon-20.png b/CRD-addon - Chrome/icons/icon-20.png
deleted file mode 100644
index 012e057..0000000
Binary files a/CRD-addon - Chrome/icons/icon-20.png and /dev/null differ
diff --git a/CRD-addon - Chrome/icons/icon-48.png b/CRD-addon - Chrome/icons/icon-48.png
deleted file mode 100644
index 323edbf..0000000
Binary files a/CRD-addon - Chrome/icons/icon-48.png and /dev/null differ
diff --git a/CRD-addon - Chrome/images/submit.png b/CRD-addon - Chrome/images/submit.png
deleted file mode 100644
index 0c6adb8..0000000
Binary files a/CRD-addon - Chrome/images/submit.png and /dev/null differ
diff --git a/CRD-addon - Chrome/inject.js b/CRD-addon - Chrome/inject.js
deleted file mode 100644
index 3b16d99..0000000
--- a/CRD-addon - Chrome/inject.js
+++ /dev/null
@@ -1,34 +0,0 @@
-var episodeCount = document.getElementsByClassName("episode").length;
-var i;
-for (i = 0; i < episodeCount; i++) {
- document.getElementsByClassName("episode")[i].setAttribute('href', "javascript:" + document.getElementsByClassName("episode")[i].href);
- document.getElementsByClassName("episode")[i].setAttribute('onclick', 'deselect(this.id)')
- //document.getElementsByClassName("episode")[i].style.background = "#f78c25";
- document.getElementsByClassName("episode")[i].setAttribute('id', makeid(8))
- //document.getElementsByClassName("episode")[i].classList.add('CRD-Selected')
-}
-
-function deselect(clicked_id) {
- var seleceted = document.getElementById(clicked_id).classList.contains('CRD-Selected')
-
- if (seleceted == true) {
- document.getElementById(clicked_id).classList.remove('CRD-Selected')
- document.getElementById(clicked_id).style.background = "#ffffff";
-
- } else {
- document.getElementById(clicked_id).classList.add('CRD-Selected')
- document.getElementById(clicked_id).style.background = "#f78c25";
-
- }
-
-}
-
-function makeid(length) {
- var result = '';
- var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- var charactersLength = characters.length;
- for (var i = 0; i < length; i++) {
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
- return result;
-}
diff --git a/CRD-addon - Chrome/inject_funimation.js b/CRD-addon - Chrome/inject_funimation.js
deleted file mode 100644
index 3b16d99..0000000
--- a/CRD-addon - Chrome/inject_funimation.js
+++ /dev/null
@@ -1,34 +0,0 @@
-var episodeCount = document.getElementsByClassName("episode").length;
-var i;
-for (i = 0; i < episodeCount; i++) {
- document.getElementsByClassName("episode")[i].setAttribute('href', "javascript:" + document.getElementsByClassName("episode")[i].href);
- document.getElementsByClassName("episode")[i].setAttribute('onclick', 'deselect(this.id)')
- //document.getElementsByClassName("episode")[i].style.background = "#f78c25";
- document.getElementsByClassName("episode")[i].setAttribute('id', makeid(8))
- //document.getElementsByClassName("episode")[i].classList.add('CRD-Selected')
-}
-
-function deselect(clicked_id) {
- var seleceted = document.getElementById(clicked_id).classList.contains('CRD-Selected')
-
- if (seleceted == true) {
- document.getElementById(clicked_id).classList.remove('CRD-Selected')
- document.getElementById(clicked_id).style.background = "#ffffff";
-
- } else {
- document.getElementById(clicked_id).classList.add('CRD-Selected')
- document.getElementById(clicked_id).style.background = "#f78c25";
-
- }
-
-}
-
-function makeid(length) {
- var result = '';
- var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- var charactersLength = characters.length;
- for (var i = 0; i < length; i++) {
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
- return result;
-}
diff --git a/CRD-addon - Chrome/manifest.json b/CRD-addon - Chrome/manifest.json
deleted file mode 100644
index d454a69..0000000
--- a/CRD-addon - Chrome/manifest.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "manifest_version": 2,
- "name": "Crunchyroll Downloader Addon",
- "version": "0.2.0",
-
- "description": "A Chrome Addon for my Crunchyroll Downloader",
-
- "icons": {
- "48": "icons/icon-48.png"
- },
- "permissions": [
- "activeTab",
- "tabs"
- ],
-
- "browser_action": {
- "default_icon": {
- "128": "icons/icon-128.png",
- "48": "icons/icon-48.png",
- "20": "icons/icon-20.png"
- },
- "default_title": "CR-Downloader",
- "default_popup": "popup.html"
- }
-
-}
\ No newline at end of file
diff --git a/CRD-addon - Chrome/popup.css b/CRD-addon - Chrome/popup.css
deleted file mode 100644
index 1839d7f..0000000
--- a/CRD-addon - Chrome/popup.css
+++ /dev/null
@@ -1,15 +0,0 @@
-.btn_class {
- background-color: #ff8000;
- border: none;
- color: white;
- padding: 10px;
- text-align: center;
- text-decoration: none;
- font-size: 16px;
- margin-left:12px;
- margin-right:12px;
- margin-Top:12px;
- margin-Bottom:12px;
- border-radius: 12px;
- cursor:pointer;
-}
\ No newline at end of file
diff --git a/CRD-addon - Chrome/popup.html b/CRD-addon - Chrome/popup.html
deleted file mode 100644
index 1c6e88a..0000000
--- a/CRD-addon - Chrome/popup.html
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
- CR Unblocker plugin popup
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CRD-addon - Chrome/popup.js b/CRD-addon - Chrome/popup.js
deleted file mode 100644
index b2065e6..0000000
--- a/CRD-addon - Chrome/popup.js
+++ /dev/null
@@ -1,352 +0,0 @@
-chrome.tabs.query({
- active: true,
- currentWindow: true
-},
- function (tabs) {
- console.log(tabs.length);
- let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url);
- console.log(tab.url);
- if (tab.url.includes('crunchyroll.com')) {
- //var crunchyroll = chrome.tabs.executeScript({
- // code: 'document.getElementsByClassName("episode")[0].href;'
- //});
-
- //crunchyroll.then(onExecuted, onError);
-
- chrome.tabs.executeScript(null, {
- //code: 'document.getElementsByClassName("episode")[0].href;'
- code: 'document.getElementsByClassName("episode").length;'
- },
- function (results) {
-
- if (results > 0) {
-
- onExecuted(results);
- } else {
- onError("error")
- }
-
- });
-
- } else if (tab.url.includes('funimation.com')) {
- chrome.tabs.executeScript(null, {
- //code: 'document.getElementsByClassName("trackVideo")[0].href'
- code: 'document.getElementsByClassName("trackVideo").length;'
- },
- function (results) {
-
- if (results > 0) {
- FunimationSuccess(results);
-
- } else {
- FunimationError(results);
-
- }
-
- });
-
- } else {
-
- document.getElementById("btn_add").hidden = true;
- document.getElementById("btn_enable_select").hidden = true;
- document.getElementById("btn_add_mass").hidden = true;
- document.getElementById("btn_select_all").hidden = true;
- document.getElementById("btn_select_none").hidden = true;
- document.getElementById("btn_enable_funimation_select").hidden = true;
- document.getElementById("btn_add_funimation").hidden = true;
- }
-});
-
-document.getElementById('btn_enable_select').addEventListener('click', () => {
-
- chrome.tabs.executeScript(null, {
- code: 'var script=document.createElement("script");script.type="text/javascript",script.src="http://127.0.0.1/inject.js",document.head.appendChild(script);'
- });
-
- //browser.tabs.executeScript({
- // code: 'var script=document.createElement("script");script.type="text/javascript",script.src="http://127.0.0.1/inject.js",document.head.appendChild(script);'
- //}); //load script from local CRD Server included in https://github.com/hama3254/Crunchyroll-Downloader-v3.0
-
- document.getElementById("btn_add_mass").hidden = false;
- document.getElementById("btn_select_all").hidden = false;
- document.getElementById("btn_select_none").hidden = false;
- document.getElementById("btn_enable_select").hidden = true;
- document.getElementById("btn_add").hidden = true;
- document.getElementById("btn_enable_funimation_select").hidden = true;
- document.getElementById("btn_add_funimation").hidden = true;
-});
-
-document.getElementById('btn_select_all').addEventListener('click', () => {
- chrome.tabs.query({
- active: true,
- currentWindow: true
- },
- function (tabs) {
- console.log(tabs.length);
- let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url);
- console.log(tab.url);
- if (tab.url.includes('crunchyroll.com')) {
-
- chrome.tabs.executeScript(null, {
- code: 'var i,episodeCount=document.getElementsByClassName("episode").length;for(i=0;i {
-
- chrome.tabs.query({
- active: true,
- currentWindow: true
- },
- function (tabs) {
- console.log(tabs.length);
- let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url);
- console.log(tab.url);
- if (tab.url.includes('crunchyroll.com')) {
-
- chrome.tabs.executeScript(null, {
- code: 'var i,episodeCount=document.getElementsByClassName("episode").length;for(i=0;i {
- chrome.tabs.executeScript(null, {
- code: "document.getElementsByClassName('no-js')[0].innerHTML;"
- },
- function (results) {
-
- if (results !== null) {
-
- document.getElementById("btn_add").disabled = true;
- document.getElementById("btn_add").style.background = "#c9c9c9"
- const form = document.createElement('form');
- form.method = 'post';
- form.action = "http://127.0.0.1/post";
- const hiddenField = document.createElement('input');
- hiddenField.type = 'hidden';
- hiddenField.name = "HTMLSingle";
- hiddenField.value = results;
- form.appendChild(hiddenField);
-
- document.body.appendChild(form);
- form.submit();
-
- setTimeout(function () {
- document.getElementById("btn_add").style.background = "#ff8000"
- }, 10000);
- setTimeout(function () {
- document.getElementById("btn_add").disabled = false;
- }, 10000);
-
- } else {
- add_one_error(results);
-
- }
-
- });
-
-});
-
-document.getElementById('btn_add_funimation').addEventListener('click', () => {
-
- chrome.tabs.query({
- active: true,
- currentWindow: true
- },
- function (tabs) {
- document.getElementById("btn_add_funimation").disabled = true;
- document.getElementById("btn_add_funimation").style.background = "#c9c9c9"
-
- console.log(tabs.length);
- let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url);
- console.log(tab.url);
- const form = document.createElement('form');
- form.method = 'post';
- form.action = "http://127.0.0.1/post";
-
- const hiddenField2 = document.createElement('input');
- hiddenField2.type = 'hidden';
- hiddenField2.name = "FunimationURL";
- hiddenField2.value = tab.url;
- form.appendChild(hiddenField2);
-
- document.body.appendChild(form);
- form.submit();
- setTimeout(function () {
- document.getElementById("btn_add_funimation").style.background = "#ff8000"
- }, 10000);
- setTimeout(function () {
- document.getElementById("btn_add_funimation").disabled = false;
- }, 10000);
- });
-});
-
-document.getElementById('btn_add_mass').addEventListener('click', () => {
-
- chrome.tabs.executeScript(null, {
- code: 'var i,URLList="";for(i=0;i {
-
- // browser.tabs.executeScript({
- // code: 'var script=document.createElement("script");script.type="text/javascript",script.src="http://127.0.0.1/inject_funimation.js",document.head.appendChild(script);'
- // }); //load script from local CRD Server included in https://github.com/hama3254/Crunchyroll-Downloader-v3.0
- chrome.tabs.executeScript(null, {
- code: 'var script=document.createElement("script");script.type="text/javascript",script.src="http://127.0.0.1/inject_funimation.js",document.head.appendChild(script);'
- });
-
- document.getElementById("btn_add_mass").hidden = false;
- document.getElementById("btn_select_all").hidden = false;
- document.getElementById("btn_select_none").hidden = false;
- document.getElementById("btn_enable_select").hidden = true;
- document.getElementById("btn_add").hidden = true;
- document.getElementById("btn_add_funimation").hidden = true;
-
-});
-
-function FunimationSuccess(result) {
- chrome.tabs.executeScript(null, {
- code: "document.getElementsByClassName('trackVideo')[0].href.includes('javascript:');"
- },
- function (result) {
- if (result == 'true') {
- document.getElementById("btn_add").hidden = true;
- document.getElementById("btn_add_mass").hidden = false;
- document.getElementById("btn_select_all").hidden = false;
- document.getElementById("btn_select_none").hidden = false;
- document.getElementById("btn_enable_select").hidden = true;
-
- document.getElementById("btn_enable_funimation_select").hidden = true;
- document.getElementById("btn_add_funimation").hidden = true;
- console.log(true);
- } else {
- document.getElementById("btn_add").hidden = true;
- document.getElementById("btn_add_funimation").hidden = true;
- document.getElementById("btn_enable_select").hidden = true;
- document.getElementById("btn_add_mass").hidden = true;
- document.getElementById("btn_select_all").hidden = true;
- document.getElementById("btn_select_none").hidden = true;
- document.getElementById("btn_enable_funimation_select").hidden = false;
-
- console.log(false);
- }
- });
-}
-
-function FunimationError(error) {
- console.log(`Error: ${error}`);
-
- document.getElementById("btn_add").hidden = true;
- document.getElementById("btn_add_mass").hidden = true;
- document.getElementById("btn_select_all").hidden = true;
- document.getElementById("btn_select_none").hidden = true;
- document.getElementById("btn_enable_select").hidden = true;
- document.getElementById("btn_add_funimation").hidden = false;
- document.getElementById("btn_enable_funimation_select").hidden = true;
-
-}
diff --git a/CRD-addon/background.js b/CRD-addon/background.js
new file mode 100644
index 0000000..7a0f36c
--- /dev/null
+++ b/CRD-addon/background.js
@@ -0,0 +1,32 @@
+browser.webRequest.onHeadersReceived.addListener(
+ details => {
+ browser.test.log(`onHeadersReceived ${JSON.stringify(details)}\n`);
+ if (!details.fromCache) {
+ //console.log("not cached");
+ browser.test.sendMessage("statusCode", details.statusCode);
+ const mime = details.responseHeaders.find(header => {
+ return header.value && header.name === "Server";
+ });
+ if (mime) {
+ //console.log(mime.value);
+ browser.runtime.sendMessage({
+ Server: mime.value
+ });
+
+ } else {
+ details.responseHeaders.push({
+ name: "Content-Security-Policy",
+ value: "upgrade-insecure-requests",
+ });
+ }
+
+ return {
+ responseHeaders: details.responseHeaders,
+ };
+ } else {
+ console.log("cached");
+ }
+}, {
+ urls: ["http://127.0.0.1/*"],
+},
+ ["blocking", "responseHeaders"]);
diff --git a/CRD-addon/manifest.json b/CRD-addon/manifest.json
index de4f46c..799fa08 100644
--- a/CRD-addon/manifest.json
+++ b/CRD-addon/manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Crunchyroll Downloader Addon",
- "version": "0.4.0",
+ "version": "0.4.2",
"description": "A Firefox Addon for my Crunchyroll Downloader",
@@ -11,7 +11,9 @@
"permissions": [
"storage",
"activeTab",
- "cookies",
+ "webRequest",
+ "webRequestBlocking",
+ "http://127.0.0.1/*",
"tabs"
],
@@ -23,6 +25,10 @@
},
"default_title": "CR-Downloader",
"default_popup": "popup.html"
+ },
+
+ "background": {
+ "scripts": ["background.js"]
}
}
\ No newline at end of file
diff --git a/CRD-addon/popup.html b/CRD-addon/popup.html
index 78f7d73..c08b76e 100644
--- a/CRD-addon/popup.html
+++ b/CRD-addon/popup.html
@@ -7,7 +7,8 @@
@@ -24,10 +25,11 @@
+ Enter the port or start the Desktop application
-
-
+
+