Skip to content

Commit 763de2e

Browse files
committed
Merge branch 'beta-branch'
2 parents 36efbb9 + fd604d6 commit 763de2e

37 files changed

+1754
-968
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Optionally, you can configure NZB Manager (see support table) in the extension's
1616
| Manager | Movie Support | TV Show Support | Searchable
1717
| ----------------------------------------------- |:-------------:|:---------------:|:----------:
1818
| [Watcher 3](https://nosmokingbandit.github.io/) | ✔ | ❌ | ❌
19-
| [CouchPotato](https://couchpota.to/) | ✔ | | ❌
19+
| [CouchPotato](https://couchpota.to/) | ✔ | | ❌
2020
| [Radarr](https://radarr.video/) | ✔ | ❌ | ✔
2121
| [Sonarr](https://sonarr.tv/) | ❌ | ✔ | ✔
2222
| [Ombi](https://ombi.io/) | ❔ | ❔ | ✔

moz.xpi

39.4 KB
Binary file not shown.

moz.zip

954 Bytes
Binary file not shown.

moz/background.js

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -181,33 +181,59 @@ UpdateConfiguration();
181181
// these requests in a background page instead of the content script?
182182
// This is because Movieo is served over HTTPS, so it won't accept requests to
183183
// HTTP servers. Unfortunately, many people use CouchPotato over HTTP.
184-
function Open_CouchPotato(request, sendResponse) {
184+
function Query_CouchPotato(request, sendResponse) {
185185
fetch(`${ request.url }?id=${ request.imdbId }`, {
186186
headers: new Headers(request.basicAuth),
187187
mode: cors(request.url)
188188
})
189189
.then(response => response.json())
190190
.then(json => {
191+
let { success } = json;
192+
191193
sendResponse({ success, status: (success? json.media.status: null) });
192194
})
193195
.catch(error => {
194-
sendResponse({ error: String(error), location: '@0B: Open_CouchPotato' });
196+
sendResponse({ error: String(error), location: '@0B: Query_CouchPotato' });
195197
});
196198
}
197199

198200
function Push_CouchPotato(request, sendResponse) {
199-
fetch(`${ request.url }?identifier=${ request.imdbId }`, {
201+
let headers = {
202+
'Content-Type': 'application/json',
203+
'X-Api-Key': request.token,
204+
...(new Headers(request.basicAuth))
205+
},
206+
query = `identifier=${ request.imdbId }`,
207+
debug = { headers, query, request };
208+
209+
fetch(debug.url = `${ request.url }?${ query }`, {
210+
method: 'POST',
211+
mode: cors(request.url),
212+
// body: JSON.stringify(body),
213+
headers,
214+
})
215+
.then(response => response.json())
216+
.catch(error => sendResponse({ error: 'Movie not found', location: '@0B: Push_CouchPotato => fetch.then.catch', silent: true }))
217+
.then(response => {
218+
sendResponse({ success: response.success });
219+
})
220+
.catch(error => {
221+
sendResponse({
222+
error: String(error),
223+
location: '@0B: Push_CouchPotato => fetch("${ request.url }", { headers }).catch(error => { sendResponse })',
224+
debug
225+
});
226+
});
227+
}
228+
229+
function Charge_CouchPotato(request, sendResponse) {
230+
fetch(request.url, {
200231
headers: new Headers(request.basicAuth),
201232
mode: cors(request.url)
202233
})
203234
.then(response => response.json())
204-
.catch(error => sendResponse({ error: 'Item not found', location: '@0B: Push_CouchPotato => fetch.then.catch', silent: true }))
205-
.then(response => {
206-
sendResponse({ success: response.success });
207-
})
208-
.catch(error => {
209-
sendResponse({ error: String(error) , location: '@0B: Push_CouchPotato'});
210-
});
235+
.then(json => sendResponse(json))
236+
.catch(error => sendResponse({ error: String(error), location: '@0B: Charge_CouchPotato' }));
211237
}
212238

213239
/** Watcher - Movies **/
@@ -303,7 +329,7 @@ function Push_Radarr(request, sendResponse) {
303329
.then(body => {
304330
return fetch(`${ request.url }?apikey=${ request.token }`, debug.requestHeaders = {
305331
method: 'POST',
306-
mode: cors(request.url),
332+
// mode: cors(request.url),
307333
body: JSON.stringify(body),
308334
headers
309335
});
@@ -383,7 +409,7 @@ function Push_Sonarr(request, sendResponse) {
383409
.then(body => {
384410
return fetch(`${ request.url }?apikey=${ request.token }`, debug.requestHeaders = {
385411
method: 'POST',
386-
mode: cors(request.url),
412+
// mode: cors(request.url),
387413
body: JSON.stringify(body),
388414
headers
389415
});
@@ -455,7 +481,7 @@ function Push_Medusa(request, sendResponse) {
455481
.then(body => {
456482
return fetch(`${ request.url }`, debug.requestHeaders = {
457483
method: 'POST',
458-
mode: cors(request.url),
484+
// mode: cors(request.url),
459485
body: JSON.stringify({ id: { tvdb: id } }),
460486
headers
461487
});
@@ -529,7 +555,7 @@ function addMedusa(request, sendResponse) {
529555
.then(body => {
530556
return fetch(`${ request.url }`, debug.requestHeaders = {
531557
method: 'POST',
532-
mode: cors(request.url),
558+
// mode: cors(request.url),
533559
body: JSON.stringify({ id: { tvdb: id } }),
534560
headers
535561
});
@@ -611,7 +637,7 @@ function Push_SickBeard(request, sendResponse) {
611637

612638
return fetch(`${ request.url }?cmd=show.${ request.exists? 'addexisting': 'addnew' }&${ body }`, debug.requestHeaders = {
613639
method: 'POST',
614-
mode: cors(request.url),
640+
// mode: cors(request.url),
615641
// body: JSON.stringify(body),
616642
headers
617643
});
@@ -659,8 +685,8 @@ function Push_Ombi(request, sendResponse) {
659685
},
660686
type = request.contentType,
661687
id = (type == 'movie'? request.tmdbId: request.tvdbId),
662-
body = ({ [type == 'movie'? 'theMovieDbId': 'theTvDbId']: id }),
663-
debug = { headers, request };
688+
body = ({ [type == 'movie'? 'theMovieDbId': 'tvDbId']: id, requestAll: true, lastestSeason: true, firstSeason: true }),
689+
debug = { headers, body, request };
664690
// setup stack trace for debugging
665691

666692
if(request.contentType == 'movie' && (id || null) === null)
@@ -670,11 +696,11 @@ function Push_Ombi(request, sendResponse) {
670696

671697
fetch(debug.url = request.url, {
672698
method: 'POST',
673-
mode: cors(request.url),
699+
// mode: cors(request.url),
674700
body: JSON.stringify(body),
675701
headers
676702
})
677-
.catch(error => sendResponse({ error: `${ type } not found`, location: '@0B: Push_Ombi => fetch.then.catch', silent: true }))
703+
.catch(error => sendResponse({ error: `${ type } not found`, location: '@0B: Push_Ombi => fetch.then.catch', debug, silent: true }))
678704
.then(response => response.text())
679705
.then(data => {
680706
debug.data =
@@ -859,7 +885,7 @@ browser.contextMenus.onClicked.addListener(item => {
859885
url = external.SEARCH_PROVIDER == 'VO'?
860886
`google.com/search?q=${ p(tl) }+site:vumoo.to`:
861887
external.SEARCH_PROVIDER == 'GX'?
862-
`gostream.site/?s=${ p(tl) }`:
888+
`gostream.site?s=${ p(tl) }`:
863889
`google.com/search?q="${ p(tl, ' ') } ${ yr }"+${ pv }db`;
864890
break;
865891
case 'dl':
@@ -911,8 +937,12 @@ browser.runtime.onMessage.addListener((request = {}, sender, callback) => {
911937
Search_Plex(request, callback);
912938
break;
913939

914-
case 'VIEW_COUCHPOTATO':
915-
Open_CouchPotato(request, callback);
940+
case 'CHARGE_COUCHPOTATO':
941+
Charge_CouchPotato(request, callback);
942+
break;
943+
944+
case 'QUERY_COUCHPOTATO':
945+
Query_CouchPotato(request, callback);
916946
break;
917947

918948
case 'PUSH_COUCHPOTATO':

moz/common.css

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,27 @@
2222
}
2323

2424
/* Basic/Global Styling */
25-
*::-moz-scrollbar {
25+
[class*="web-to-plex"] *::-moz-scrollbar {
2626
width: 10px;
2727
}
2828

29-
*::-moz-scrollbar-thumb {
29+
[class*="web-to-plex"] *::-moz-scrollbar-thumb {
3030
min-height: 50px;
3131
background: rgba(255, 255, 255, 0.15);
3232
border: 2px solid rgba(0, 0, 0, 0);
3333
border-radius: 8px;
3434
background-clip: padding-box;
3535
}
3636

37-
*::-moz-scrollbar-track {
37+
[class*="web-to-plex"] *::-moz-scrollbar-track {
3838
/* background: url(noise.png) fixed, #3f4245 !important; */
3939
}
4040

41-
*::placeholder {
41+
[class*="web-to-plex"] *::placeholder {
4242
color: #999 !important;
4343
}
4444

45-
*::-webkit-input-placeholder {
45+
[class*="web-to-plex"] *::-webkit-input-placeholder {
4646
color: #999 !important;
4747
}
4848

@@ -405,15 +405,15 @@
405405
opacity: 0.1;
406406
}
407407

408-
*:not(#plexit-bookmarklet-frame) ~ .web-to-plex-button {
408+
[class*="web-to-plex"] *:not(#plexit-bookmarklet-frame) ~ .web-to-plex-button {
409409
margin-left: 0px;
410410
}
411411

412412
#plexit-bookmarklet-frame ~ .web-to-plex-button {
413413
margin-left: 280px !important;
414414
}
415415

416-
*:not(#plexit-bookmarklet-frame) + .web-to-plex-button #plexit, #plexit-bookmarklet-frame + .web-to-plex-button #wtp-plexit {
416+
*:not(#plexit-bookmarklet-frame) + .web-to-plex-button [id^="plexit"i], #plexit-bookmarklet-frame + .web-to-plex-button #wtp-plexit {
417417
display: none !important;
418418
}
419419

moz/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"homepage_url": "https://webtoplex.github.io/",
55

66
"manifest_version": 2,
7-
"version": "4.1.2.2",
7+
"version": "4.1.2.3",
88
"browser_specific_settings": {
99
"gecko": {
1010
"id": "mink.cbos@gmail.com",

moz/options.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ <h2>Connection Settings</h2>
323323
<input type="text" data-option="couchpotatoToken" placeholder="What's your CouchPotato API key?" default/>
324324
<div>
325325
1. Go to <strong>CouchPotato</strong> &rarr; <strong>Settings</strong><br/>
326+
&mdash; a. Ensure the checkbox <u>Show advanced</u> is checked<br/>
326327
2. Copy/Paste the <u>API Key</u><br/>
327328
&mdash; Such as <em>aa756d33242f6a8ffbca2b3963586f21</em>
328329
</div>
@@ -347,20 +348,20 @@ <h3>Login <strong orange>(saved)</strong></h3>
347348
This will allow the extension to ask Couchpotato for your list of films, or to add to your list of films.
348349
</div>
349350
</section>
350-
<!--
351+
351352
<section>
352-
<button type="button" id="couchpotato_test" disabled="true">Test Settings <span id="couchpotato_test_status"></span></button>
353+
<button type="button" id="couchpotato_test">Test Settings <span id="couchpotato_test_status"></span></button>
353354
</section>
354-
<section>
355+
<!-- <section>
355356
<label>Quality Profile</label>
356357
<select data-option="couchpotatoQualityProfileId" disabled="true" default>
357358
<option value="">Press "Test Settings" first</option>
358359
</select>
359-
</section>
360-
-->
361-
<section>
360+
</section> -->
361+
362+
<!-- <section>
362363
<button id="enable-couchpotato" data-option="enableCouchPotato">Enable CouchPotato</button>
363-
</section>
364+
</section> -->
364365
<hr><br>
365366
<section>
366367
<button class="test" target="_blank" href="https://webtoplex.github.io/web/">try out couchpotato</button>
@@ -634,7 +635,7 @@ <h2 x-mode>The Minion Button(s)</h2>
634635
Allow the use of custom (minion) buttons?
635636
<br>
636637
<span class="checkbox" prompt"y/n">
637-
<!-- When true (checked), will be accessed in CSS (options.css) as ".web-to-plex-minion { ... }" -->
638+
<!-- When true (checked), will be accessed in CSS (*.css) as ".web-to-plex-minion { ... }" -->
638639
<input id="allow-minions" type="checkbox" data-option="UseMinions" default/>
639640
<label for="allow-minions"></label>
640641
</span>

0 commit comments

Comments
 (0)