Files
lampa-plugins/plugins/tmdb-proxy.min.js

1 line
2.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(){"use strict";let t="cubnotrip.top",e=[{url:`https://${t}/api/checker`,name:t}],n={name:"TMDB Proxy by Skaz (Mod. LeMaX)",version:"1.0.5",description:"Проксирование постеров и API сайта TMDB (Optimized )",pathImage:`imagetmdb.${t}/`,pathApi:`apitmdb.${t}/3/`},o=!1;function i(t){let e=t.slice(0,8),n=t.slice(8).replace(/\/\+/g,"/");return e+n}function r(t){let e=function t(){try{let e=Lampa.Storage.get("account","{}");return("string"==typeof e?JSON.parse(e):e).email||""}catch(n){return""}}();return e?Lampa.Utils.addUrlComponent(t,`email=${encodeURIComponent(e)}`):t}1===Lampa.Storage.get("cub_domain_skaz")&&function t(){if(o)return;let n=0;!function t(){if(n>=e.length)return;let i=e[n],r=new XMLHttpRequest;r.open("GET",i.url,!0),r.timeout=5e3,r.onload=function(){if(200===r.status)try{let e=r.responseText;if("ok"===e){localStorage.setItem("cub_domain",i.name),o=!0;return}}catch(a){console.warn("API check error:",a)}n++,t()},r.onerror=r.ontimeout=function(){n++,t()},r.send()}()}(),Lampa.Storage.set("cache_images",!1),Lampa.TMDB.image=function(t){let e=Lampa.Utils.protocol(),o=Lampa.Storage.field("proxy_tmdb"),a=o?`${e}${n.pathImage}${t}`:`${e}image.tmdb.org/${t}`;return r(i(a))},Lampa.TMDB.api=function(t){let e=Lampa.Utils.protocol(),o=Lampa.Storage.field("proxy_tmdb"),a=o?`${e}${n.pathApi}${t}`:`${e}api.themoviedb.org/3/${t}`;return r(i(a))},Lampa.Settings.listener.follow("open",function(t){"tmdb"===t.name&&t.body.find('[data-parent="proxy"]').remove()}),console.log("TMDB-Proxy",`v${n.version} started, enabled:`,Lampa.Storage.field("proxy_tmdb")),Lampa.SettingsApi.addComponent({component:"iptvskaz",icon:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z"/></svg>',name:"by Skaz (Optimized)"}),Lampa.SettingsApi.addParam({component:"iptvskaz",param:{name:"b_skaz",type:"trigger",default:!1},field:{name:"Убрать с главной трансляции",description:"Убирает с главной трансляцию события"},onChange:function(t){Lampa.Noty.show("Необходимо перезайти в лампу")}})}();