diff --git a/src/main.js b/src/main.js index f311eb5..02ef160 100644 --- a/src/main.js +++ b/src/main.js @@ -3,6 +3,7 @@ let plexToken = ''; let plexMachineId; let couchpotatoUrlRoot = ''; let couchpotatoToken = ''; +let couchpotatoBasicAuth = null; function isMoviePage() { const path = window.location.pathname; @@ -52,6 +53,12 @@ chrome.storage.sync.get(null, function(items) { plexMachineId = items.plexMachineId; couchpotatoUrlRoot = items.couchpotatoUrlRoot; couchpotatoToken = items.couchpotatoToken; + if (items.couchpotatoBasicAuthUsername) { + couchpotatoBasicAuth = { + username: items.couchpotatoBasicAuthUsername, + password: items.couchpotatoBasicAuthPassword, + }; + } if (!plexToken || !plexMachineId || !items.plexLibraryId || !items.plexUrlRoot) { showNotification('warning', 'Not all options for the Movieo to Plex extension are filled in.'); @@ -170,8 +177,7 @@ function addToCouchpotato(action) { } axios.get(viewUrl, { params: { id: imdbId }, - headers: { - }, + auth: couchpotatoBasicAuth, }) .then((res) => { const movieExists = res.data.success; @@ -191,9 +197,7 @@ function addToCouchpotato(action) { function addToCouchPotatoRequest(url, imdbId) { axios.get(url, { params: { identifier: imdbId }, - headers: { - Authorization: 'Basic a2Vlczpib25rZXJzdGVpbg==', - }, + auth: couchpotatoBasicAuth, }) .then((res) => { showNotification('info', 'Added movie on CouchPotato.'); diff --git a/src/options.html b/src/options.html index 06e7ef3..1186ae2 100644 --- a/src/options.html +++ b/src/options.html @@ -47,6 +47,18 @@ Example: aa756d33242f6g8ffbca2b3963586f21
+
+ CouchPotato basic auth username (optional):
+
+ If you password-protected your CouchPotato install, enter the username here.
+
+ CouchPotato basic auth password (optional):
+
+ If you password-protected your CouchPotato install, enter the password here.
+