-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathtmdb_proxy.js
More file actions
30 lines (24 loc) · 820 Bytes
/
tmdb_proxy.js
File metadata and controls
30 lines (24 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(function () {
'use strict';
function filter(u) {
return u.replace(/\/\/+/g, '/');
}
function proxyLink(u) {
var proxy = Lampa.Storage.field('proxy_tmdb') ? 'https://apn-latest.onrender.com/' : '';
return proxy + u;
}
Lampa.TMDB.image = function (url) {
var base = Lampa.Utils.protocol() + filter('image.tmdb.org/' + url);
return proxyLink(base);
};
Lampa.TMDB.api = function (url) {
var base = Lampa.Utils.protocol() + filter('api.themoviedb.org/3/' + url);
return proxyLink(base);
};
Lampa.Settings.listener.follow('open', function (e) {
if (e.name == 'tmdb') {
e.body.find('[data-parent="proxy"]').remove();
}
});
console.log('TMDB-Proxy', 'nb557, enabled:', Lampa.Storage.field('proxy_tmdb'));
})();