Skip to content

Commit 5f8816e

Browse files
committed
Merge branch 'pr/136' into beta-branch
2 parents 8941894 + 397e077 commit 5f8816e

File tree

14 files changed

+66
-46
lines changed

14 files changed

+66
-46
lines changed

moz.xpi

185 Bytes
Binary file not shown.

moz.zip

185 Bytes
Binary file not shown.

moz/common.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@
340340
width: 180px !important;
341341

342342
transition: all 0.3s ease !important;
343-
transition: opacity 1s ease !important;
344343
}
345344

346345
.web-to-plex-button.hide {

moz/manifest.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"homepage_url": "https://github.com/SpaceK33z/web-to-plex/",
55

66
"manifest_version": 2,
7-
"version": "4.1.1.4",
7+
"version": "4.1.1.6",
88
"browser_specific_settings": {
99
"gecko": {
1010
"id": "mink.cbos@gmail.com",
@@ -24,6 +24,7 @@
2424
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
2525

2626
"content_scripts": [
27+
// Allow media downloads
2728
{
2829
"matches": [
2930
"*://*.openload.co/*", "*://*.oload.co/*",
@@ -69,11 +70,13 @@
6970
"all_frames": true
7071
},
7172

73+
// Testing purposes only
7274
{
7375
"matches": ["*://ephellon.github.io/web.to.plex/test/*"],
7476
"js": ["utils.js", "__test__.js"]
7577
},
7678

79+
// The sites
7780
{
7881
"matches": ["*://*.movieo.me/*"],
7982
"js": ["history-hack.js", "utils.js", "movieo$.js"]

moz/options.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@ class Prompt {
396396
}
397397
}
398398

399+
function TLDHost(host) {
400+
return host.replace(/^(ww\w+|\w{2})\./, '');
401+
}
402+
399403
function addListener(element, eventName, callback = event => {}) {
400404
eventName = eventName.replace(/^(on)?/, 'on');
401405
callback = callback.toString().replace(/;+$/g, '');
@@ -1903,7 +1907,7 @@ for(let index = 0, length = builtin_array.length; builtinElement && index < leng
19031907
url = new URL(builtin[i]),
19041908
js = name.replace(/^builtin_/i, ''),
19051909
o = url.origin,
1906-
r = url.host.replace(/^(ww\w+\.)/, '');
1910+
r = TLDHost(url.host);
19071911

19081912
builtin_sites[r] = o;
19091913

@@ -1928,7 +1932,7 @@ for(let index = 0, length = builtin_array.length; builtinElement && index < leng
19281932
url = new URL(builtins[title]),
19291933
js = name.replace(/^builtin_/i, ''),
19301934
o = url.origin,
1931-
r = url.host.replace(/^(ww\w+\.)/, '');
1935+
r = TLDHost(url.host);
19321936

19331937
builtin_sites[r] = o;
19341938

@@ -2006,7 +2010,7 @@ for(let index = 0, length = plugin_array.length; pluginElement && index < length
20062010
url = new URL(plugin[i]),
20072011
js = name.replace(/^plugin_/i, ''),
20082012
o = url.origin,
2009-
r = url.host.replace(/^(ww\w+\.)/, '');
2013+
r = TLDHost(url.host);
20102014

20112015
plugin_sites[r] = o;
20122016

@@ -2031,7 +2035,7 @@ for(let index = 0, length = plugin_array.length; pluginElement && index < length
20312035
url = new URL(plugins[title]),
20322036
js = name.replace(/^plugin_/i, ''),
20332037
o = url.origin,
2034-
r = url.host.replace(/^(ww\w+\.)/, '');
2038+
r = TLDHost(url.host);
20352039

20362040
plugin_sites[r] = o;
20372041

moz/plugn.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ function RandomName(length = 16, symbol = '') {
238238
return values.join(symbol).replace(/^[^a-z]+/i, '');
239239
};
240240

241+
function TLDHost(host) {
242+
return host.replace(/^(ww\w+|\w{2})\./, '');
243+
}
244+
241245
async function prepare({ code, alias, type, allowed, url }) {
242246

243247
let DATE = (new Date),
@@ -250,7 +254,7 @@ async function prepare({ code, alias, type, allowed, url }) {
250254
Type = type.replace(/^\w/, ($0, $$, $_) => $0.toUpperCase());
251255

252256
let org = url.origin,
253-
ali = url.host.replace(/^(ww\w+\.|\w{2}\.)/i, '');
257+
ali = TLDHost(url.host);
254258

255259
let { authorized, ...A } = await GetAuthorization(alias);
256260

@@ -459,7 +463,7 @@ let tabchange = async tabs => {
459463

460464
url = new URL(url);
461465
org = url.origin;
462-
ali = url.host.replace(/^(ww\w+\.|\w{2}\.)/i, '');
466+
ali = TLDHost(url.host);
463467
type = (load(`builtin:${ ali }`) + '') == 'true'? 'script': 'plugin';
464468
js = load(`${ type }:${ ali }`);
465469
code = cache[ali];

moz/utils.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,10 @@ let configuration, init, Update;
650650
document.body.append(frame);
651651
}
652652

653+
function TLDHost(host) {
654+
return host.replace(/^(ww\w+|\w{2})\./, '');
655+
}
656+
653657
// Send an update query to background.js
654658
Update = (type, options = {}, postToo) => {
655659
if(configuration)
@@ -1044,7 +1048,7 @@ let configuration, init, Update;
10441048
};
10451049

10461050
if(configuration) {
1047-
let host = location.host.replace(/^(ww\w+\.)/, ''),
1051+
let host = TLDHost(location.host),
10481052
doms = configuration.__domains.split(',');
10491053

10501054
if(!~doms.indexOf(host))
@@ -1098,7 +1102,9 @@ let configuration, init, Update;
10981102
tid = TVDbID || null, // TVDbID
10991103
rqut = apit, // request type: tmdb, imdb, or tvdb
11001104
manable = __CONFIG__.ManagerSearch && !(rerun & 0b1000), // is the user's "Manager Searches" option enabled?
1101-
UTF_16 = /[^0\u0020-\u007e, 1\u00a1\u00bf-\u00ff, 2\u0100-\u017f, 3\u0180-\u024f, 4\u0300-\u036f, 5\u0370-\u03ff, 6\u0400-\u04ff, 7\u0500-\u052f, 8\u20a0-\u20bf]+/g;
1105+
UTF_16 = /[^0\u0020-\u007e, 1\u00a1\u00bf-\u00ff, 2\u0100-\u017f, 3\u0180-\u024f, 4\u0300-\u036f, 5\u0370-\u03ff, 6\u0400-\u04ff, 7\u0500-\u052f, 8\u20a0-\u20bf]+/g,
1106+
MV = /^(movies?|films?|cinemas?)$/i.test(apit),
1107+
TV = /^(tv[\s\-]*(?:shows?|series)?)$/i.test(apit);
11021108

11031109
type = type || null;
11041110
meta = { ...meta, mode: 'cors' };
@@ -1150,9 +1156,9 @@ let configuration, init, Update;
11501156
/* the rest of this function is a beautiful mess that will need to be dealt with later... but it works */
11511157
let url =
11521158
(manable && title && __CONFIG__.usingOmbi && __CONFIG__.ombiURLRoot)?
1153-
`${ __CONFIG__.ombiURLRoot }api/v1/Search/${ (rqut == 'imdb' || rqut == 'tmdb' || apit == 'movie')? 'movie': 'tv' }/${ plus(title, '%20') }/?apikey=${ api.ombi }`:
1159+
`${ __CONFIG__.ombiURLRoot }api/v1/Search/${ (/^[it]mdb$/i.test(rqut) || MV)? 'movie': 'tv' }/${ plus(title, '%20') }/?apikey=${ api.ombi }`:
11541160
(manable && (__CONFIG__.usingRadarr || __CONFIG__.usingSonarr || __CONFIG__.usingMedusa /*|| __CONFIG__.usingSickBeard*/))?
1155-
(__CONFIG__.usingRadarr && (rqut == 'imdb' || rqut == 'tmdb') && __CONFIG__.radarrURLRoot)?
1161+
(__CONFIG__.usingRadarr && /^[it]mdb$/i.test(rqut) && __CONFIG__.radarrURLRoot)?
11561162
(mid)?
11571163
`${ __CONFIG__.radarrURLRoot }api/movie/lookup/tmdb?tmdbId=${ mid }&apikey=${ __CONFIG__.radarrToken }`:
11581164
(iid)?
@@ -1168,22 +1174,22 @@ let configuration, init, Update;
11681174
`${ __CONFIG__.medusaURLRoot }api/v2/internal/searchIndexersForShowName?query=${ plus(title) }&indexerId=0&api_key=${ __CONFIG__.medusaToken }`:
11691175
/* TODO: find a way to get CORS to work on Sick Beard URLs (localhost) */
11701176
// (__CONFIG__.usingSickBeard)?
1171-
// (tid)?
1172-
// `${ __CONFIG__.sickBeardURLRoot }api/${ __CONFIG__.sickBeardToken }/?cmd=sb.searchtvdb&tvdbid=${ tid }`:
1173-
// `${ __CONFIG__.sickBeardURLRoot }api/${ __CONFIG__.sickBeardToken }/?cmd=sb.searchtvdb&name=${ encodeURIComponent(title) }`:
1177+
// (tid)?
1178+
// `${ __CONFIG__.sickBeardURLRoot }api/${ __CONFIG__.sickBeardToken }/?cmd=sb.searchtvdb&tvdbid=${ tid }`:
1179+
// `${ __CONFIG__.sickBeardURLRoot }api/${ __CONFIG__.sickBeardToken }/?cmd=sb.searchtvdb&name=${ encodeURIComponent(title) }`:
11741180
null:
11751181
(rqut == 'imdb' || (rqut == '*' && !iid && title) || (rqut == 'tvdb' && !iid && title && !(rerun & 0b1000)) && (rerun |= 0b1000))?
11761182
(iid)?
11771183
`https://www.omdbapi.com/?i=${ iid }&apikey=${ api.omdb }`:
11781184
(year)?
11791185
`https://www.omdbapi.com/?t=${ plus(title) }&y=${ year }&apikey=${ api.omdb }`:
11801186
`https://www.omdbapi.com/?t=${ plus(title) }&apikey=${ api.omdb }`:
1181-
(rqut == 'tmdb' || (rqut == '*' && !mid && title && year) || apit == 'movie')?
1187+
(rqut == 'tmdb' || (rqut == '*' && !mid && title && year) || MV)?
11821188
(apit && apid)?
1183-
`https://api.themoviedb.org/3/${ apit }/${ apid }?api_key=${ api.tmdb }`:
1189+
`https://api.themoviedb.org/3/${ MV? 'movie': 'tv' }/${ apid }?api_key=${ api.tmdb }`:
11841190
(iid || mid || tid)?
11851191
`https://api.themoviedb.org/3/find/${ iid || mid || tid }?api_key=${ api.tmdb }&external_source=${ iid? 'imdb': mid? 'tmdb': 'tvdb' }_id`:
1186-
`https://api.themoviedb.org/3/search/${ apit }?api_key=${ api.tmdb }&query=${ encodeURI(title) }${ year? '&year=' + year: '' }`:
1192+
`https://api.themoviedb.org/3/search/${ MV? 'movie': 'tv' }?api_key=${ api.tmdb }&query=${ encodeURI(title) }${ year? '&year=' + year: '' }`:
11871193
(rqut == 'tvdb' || (rqut == '*' && !tid && title) || (apid == tid))?
11881194
(tid)?
11891195
`https://api.tvmaze.com/shows/?thetvdb=${ tid }`:
@@ -1192,7 +1198,7 @@ let configuration, init, Update;
11921198
`https://api.tvmaze.com/search/shows?q=${ encodeURI(title) }`:
11931199
(title)?
11941200
(apit && year)?
1195-
`https://www.theimdbapi.org/api/find/${ apit }?title=${ encodeURI(title) }&year=${ year }`:
1201+
`https://www.theimdbapi.org/api/find/${ MV? 'movie': 'show' }?title=${ encodeURI(title) }&year=${ year }`:
11961202
`https://www.theimdbapi.org/api/find/movie?title=${ encodeURI(title) }${ year? '&year=' + year: '' }`:
11971203
null;
11981204

src.crx

-2 Bytes
Binary file not shown.

src.zip

-3 Bytes
Binary file not shown.

src/manifest.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,7 @@
66
"homepage_url": "https://github.com/SpaceK33z/web-to-plex/",
77

88
"manifest_version": 2,
9-
"version": "4.1.1.4",
10-
// Firefox Support =>
11-
// "applications": {
12-
// "gecko": {
13-
// "id": "{05243336-ce19-46df-95af-680070c96134}",
14-
// "strict_min_version": "57.0"
15-
// "update_url": "https://ephellon.github.com/web.to.plex/update.json"
16-
// }
17-
// },
9+
"version": "4.1.1.6",
1810

1911
"icons": {
2012
"16": "img/16.png",
@@ -214,7 +206,6 @@
214206
"persistent": true
215207
},
216208

217-
// Disable/Comment "options_page" to enable FF support
218209
"options_page": "options/index.html",
219210
"options_ui": {
220211
"page": "options/index.html",

0 commit comments

Comments
 (0)