Каталог плагинов: полный локальный mirror в ./plugins (один directory-mount в wwwroot/plugins), доки и вычистка неиспользуемых модулей

- plugins/: скачаны все 30 плагинов store локально (sources.json - карта исходных URL);
  патчи: showy.js (абсолютный хост подгрузки), pubtorr/td/torrentmanager - тела вместо лоадеров,
  modss.js - local-patched копия (из каталога исключена, upstream мёртв)
- extensions.json: 32 позиции, все ссылки {localhost}/plugins/<файл>.js, удалены мёртвые
  (Skaz TV x3, export.js, hotkeys/gold_theme/select_weapon/want/mult, MODS's, o.js, др.)
- compose: ./plugins:/lampac/wwwroot/plugins (один маунт вместо 30 file-mount)
- вычистка: удалены неиспользуемые mods (DatabaseEditor, ExternalBind, LogUserRequest-Lite,
  Telemetry, Transcoding, WatchTogether) и дубль каталога modules/
- config/init.conf: секции Tracks/AdminPanel/Music, customPlugins без gst.js
- mods/Tracks: правки Controller.cs/plugin.js
- README.md / AGENT.md: mirror, кеш static, правила mount
This commit is contained in:
2026-10-02 16:37:30 +03:00
parent 7b8e28b3bf
commit 257b42f518
98 changed files with 62636 additions and 21113 deletions
+982
View File
@@ -0,0 +1,982 @@
(function() {
'use strict';
function getBalancerUrl() {
var servers = [
'http://hdpoisk.ru:2053'
];
return servers[Math.floor(Math.random() * servers.length)];
}
// ---------------------------------------------------
var default_host = 'http://hdpoisk.ru:2053';
var Defined = {
api: 'lampac',
localhost: default_host + '/',
apn: ''
};
var balansers_with_search;
var unic_id = Lampa.Storage.get('lampac_unic_id', '');
if (!unic_id) {
unic_id = Lampa.Utils.uid(8).toLowerCase();
Lampa.Storage.set('lampac_unic_id', unic_id);
}
function getAndroidVersion() {
if (Lampa.Platform.is('android')) {
try {
var current = AndroidJS.appVersion().split('-');
return parseInt(current.pop());
} catch (e) {
return 0;
}
} else {
return 0;
}
}
var hostkey = 'hdpoisk.ru:2053'; // Используем постоянный ключ для хранилища, чтобы не терять сессию
if (!window.rch_nws || !window.rch_nws[hostkey]) {
if (!window.rch_nws) window.rch_nws = {};
window.rch_nws[hostkey] = {
type: Lampa.Platform.is('android') ? 'apk' : Lampa.Platform.is('tizen') ? 'cors' : undefined,
startTypeInvoke: false,
rchRegistry: false,
apkVersion: getAndroidVersion()
};
}
window.rch_nws[hostkey].typeInvoke = function rchtypeInvoke(host, call) {
if (!window.rch_nws[hostkey].startTypeInvoke) {
window.rch_nws[hostkey].startTypeInvoke = true;
var check = function check(good) {
window.rch_nws[hostkey].type = Lampa.Platform.is('android') ? 'apk' : good ? 'cors' : 'web';
call();
};
if (Lampa.Platform.is('android') || Lampa.Platform.is('tizen')) check(true);
else {
var net = new Lampa.Reguest();
// Тут тоже используем динамический хост для проверки
var check_url = getBalancerUrl();
net.silent(check_url.indexOf(location.host) >= 0 ? 'https://github.com/' : check_url + '/cors/check', function() {
check(true);
}, function() {
check(false);
}, false, {
dataType: 'text'
});
}
} else call();
};
window.rch_nws[hostkey].Registry = function RchRegistry(client, startConnection) {
// Вызываем с динамическим хостом
window.rch_nws[hostkey].typeInvoke(getBalancerUrl(), function() {
client.invoke("RchRegistry", JSON.stringify({
version: 149,
host: location.host,
rchtype: Lampa.Platform.is('android') ? 'apk' : Lampa.Platform.is('tizen') ? 'cors' : window.rch_nws[hostkey].type,
apkVersion: window.rch_nws[hostkey].apkVersion,
player: Lampa.Storage.field('player')
}));
if (client._shouldReconnect && window.rch_nws[hostkey].rchRegistry) {
if (startConnection) startConnection();
return;
}
window.rch_nws[hostkey].rchRegistry = true;
client.on('RchRegistry', function(clientIp) {
if (startConnection) startConnection();
});
client.on("RchClient", function(rchId, url, data, headers, returnHeaders) {
var network = new Lampa.Reguest();
function result(html) {
if (Lampa.Arrays.isObject(html) || Lampa.Arrays.isArray(html)) {
html = JSON.stringify(html);
}
if (typeof CompressionStream !== 'undefined' && html && html.length > 1000) {
var compressionStream = new CompressionStream('gzip');
var encoder = new TextEncoder();
var readable = new ReadableStream({
start: function(controller) {
controller.enqueue(encoder.encode(html));
controller.close();
}
});
var compressedStream = readable.pipeThrough(compressionStream);
new Response(compressedStream).arrayBuffer()
.then(function(compressedBuffer) {
var compressedArray = new Uint8Array(compressedBuffer);
if (compressedArray.length > html.length) {
client.invoke("RchResult", rchId, html);
} else {
$.ajax({
// Используем динамический хост для POST результата
url: getBalancerUrl() + '/rch/gzresult?id=' + rchId,
type: 'POST',
data: compressedArray,
async: true,
cache: false,
contentType: false,
processData: false,
success: function(j) {},
error: function() {
client.invoke("RchResult", rchId, html);
}
});
}
})
.catch(function() {
client.invoke("RchResult", rchId, html);
});
} else {
client.invoke("RchResult", rchId, html);
}
}
if (url == 'eval') {
console.log('RCH', url, data);
result(eval(data));
} else if (url == 'ping') {
result('pong');
} else {
console.log('RCH', url);
network["native"](url, result, function() {
console.log('RCH', 'result empty');
result('');
}, data, {
dataType: 'text',
timeout: 1000 * 8,
headers: headers,
returnHeaders: returnHeaders
});
}
});
client.on('Connected', function(connectionId) {
console.log('RCH', 'ConnectionId: ' + connectionId);
window.rch_nws[hostkey].connectionId = connectionId;
});
client.on('Closed', function() {
console.log('RCH', 'Connection closed');
});
client.on('Error', function(err) {
console.log('RCH', 'error:', err);
});
});
};
window.rch_nws[hostkey].typeInvoke(default_host, function() {});
function rchInvoke(json, call) {
if (window.nwsClient && window.nwsClient[hostkey] && window.nwsClient[hostkey]._shouldReconnect){
call();
return;
}
if (!window.nwsClient) window.nwsClient = {};
if (window.nwsClient[hostkey] && window.nwsClient[hostkey].socket)
window.nwsClient[hostkey].socket.close();
window.nwsClient[hostkey] = new NativeWsClient(json.nws, {
autoReconnect: false
});
window.nwsClient[hostkey].on('Connected', function(connectionId) {
window.rch_nws[hostkey].Registry(window.nwsClient[hostkey], function() {
call();
});
});
window.nwsClient[hostkey].connect();
}
function rchRun(json, call) {
if (typeof NativeWsClient == 'undefined') {
// Используем динамический хост для загрузки скрипта клиента
Lampa.Utils.putScript([getBalancerUrl() + "/js/nws-client-es5.js?v18112025"], function() {}, false, function() {
rchInvoke(json, call);
}, true);
} else {
rchInvoke(json, call);
}
}
function account(url) {
url = url + '';
// --- ДИНАМИЧЕСКАЯ ПОДМЕНА ХОСТА ---
// При каждом вызове account, мы берем новый случайный сервер
// и заменяем любые известные домены на него.
var random_host = getBalancerUrl();
// Список доменов, которые мы хотим подменять на лету
var replaceable = [
'http://hdpoisk.ru:2053'
];
for (var i = 0; i < replaceable.length; i++) {
if (url.indexOf(replaceable[i]) !== -1) {
url = url.replace(replaceable[i], random_host);
break; // Заменили один раз и выходим
}
}
// ----------------------------------
if (url.indexOf('account_email=') == -1) {
var email = Lampa.Storage.get('account_email');
if (email) url = Lampa.Utils.addUrlComponent(url, 'account_email=' + encodeURIComponent(email));
}
if (url.indexOf('uid=') == -1) {
var uid = Lampa.Storage.get('lampac_unic_id', '');
if (uid) url = Lampa.Utils.addUrlComponent(url, 'uid=' + encodeURIComponent(uid));
}
if (url.indexOf('token=') == -1) {
var token = '';
if (token != '') url = Lampa.Utils.addUrlComponent(url, 'token=');
}
if (url.indexOf('nws_id=') == -1 && window.rch_nws && window.rch_nws[hostkey]) {
var nws_id = window.rch_nws[hostkey].connectionId || '';
if (nws_id) url = Lampa.Utils.addUrlComponent(url, 'nws_id=' + encodeURIComponent(nws_id));
}
return url;
}
var Network = Lampa.Reguest;
function component(object) {
var network = new Network();
var scroll = new Lampa.Scroll({
mask: true,
over: true
});
var files = new Lampa.Explorer(object);
var filter = new Lampa.Filter(object);
var sources = {};
var last;
var source;
var balanser;
var initialized;
var balanser_timer;
var images = [];
var number_of_requests = 0;
var number_of_requests_timer;
var life_wait_times = 0;
var life_wait_timer;
var filter_sources = {};
var filter_translate = {
season: Lampa.Lang.translate('torrent_serial_season'),
voice: Lampa.Lang.translate('torrent_parser_voice'),
source: Lampa.Lang.translate('settings_rest_source')
};
var filter_find = {
season: [],
voice: []
};
if (balansers_with_search == undefined) {
network.timeout(10000);
network.silent(account(Defined.localhost + 'lite/withsearch'), function(json) {
balansers_with_search = json;
}, function() {
balansers_with_search = [];
});
}
function balanserName(j) {
var bals = j.balanser;
var name = j.name.split(' ')[0];
return (bals || name).toLowerCase();
}
function clarificationSearchAdd(value){
var id = Lampa.Utils.hash(object.movie.number_of_seasons ? object.movie.original_name : object.movie.original_title);
var all = Lampa.Storage.get('clarification_search','{}');
all[id] = value;
Lampa.Storage.set('clarification_search',all);
}
function clarificationSearchDelete(){
var id = Lampa.Utils.hash(object.movie.number_of_seasons ? object.movie.original_name : object.movie.original_title);
var all = Lampa.Storage.get('clarification_search','{}');
delete all[id];
Lampa.Storage.set('clarification_search',all);
}
function clarificationSearchGet(){
var id = Lampa.Utils.hash(object.movie.number_of_seasons ? object.movie.original_name : object.movie.original_title);
var all = Lampa.Storage.get('clarification_search','{}');
return all[id];
}
this.initialize = function() {
var _this = this;
this.loading(true);
filter.onSearch = function(value) {
clarificationSearchAdd(value);
Lampa.Activity.replace({
search: value,
clarification: true,
similar: true
});
};
filter.onBack = function() {
_this.start();
};
filter.render().find('.selector').on('hover:enter', function() {
clearInterval(balanser_timer);
});
filter.render().find('.filter--search').appendTo(filter.render().find('.torrent-filter'));
filter.onSelect = function(type, a, b) {
if (type == 'filter') {
if (a.reset) {
clarificationSearchDelete();
_this.replaceChoice({
season: 0,
voice: 0,
voice_url: '',
voice_name: ''
});
setTimeout(function() {
Lampa.Select.close();
Lampa.Activity.replace({
clarification: 0,
similar: 0
});
}, 10);
} else {
var url = filter_find[a.stype][b.index].url;
var choice = _this.getChoice();
if (a.stype == 'voice') {
choice.voice_name = filter_find.voice[b.index].title;
choice.voice_url = url;
}
choice[a.stype] = b.index;
_this.saveChoice(choice);
_this.reset();
_this.request(url);
setTimeout(Lampa.Select.close, 10);
}
} else if (type == 'sort') {
Lampa.Select.close();
object.lampac_custom_select = a.source;
_this.changeBalanser(a.source);
}
};
if (filter.addButtonBack) filter.addButtonBack();
filter.render().find('.filter--sort span').text(Lampa.Lang.translate('lampac_balanser'));
scroll.body().addClass('torrent-list');
files.appendFiles(scroll.render());
files.appendHead(filter.render());
scroll.minus(files.render().find('.explorer__files-head'));
scroll.body().append(Lampa.Template.get('lampac_content_loading'));
Lampa.Controller.enable('content');
this.loading(false);
if(object.balanser){
files.render().find('.filter--search').remove();
sources = {};
sources[object.balanser] = {name: object.balanser};
balanser = object.balanser;
filter_sources = [];
return network["native"](account(object.url.replace('rjson=','nojson=')), this.parse.bind(this), function(){
files.render().find('.torrent-filter').remove();
_this.empty();
}, false, {
dataType: 'text'
});
}
this.externalids().then(function() {
return _this.createSource();
}).then(function(json) {
if (!balansers_with_search.find(function(b) {
return balanser.slice(0, b.length) == b;
})) {
filter.render().find('.filter--search').addClass('hide');
}
_this.search();
})["catch"](function(e) {
_this.noConnectToServer(e);
});
};
this.rch = function(json, noreset) {
var _this2 = this;
rchRun(json, function() {
if (!noreset) _this2.find();
else noreset();
});
};
this.externalids = function() {
return new Promise(function(resolve, reject) {
if (!object.movie.imdb_id || !object.movie.kinopoisk_id) {
var query = [];
query.push('id=' + encodeURIComponent(object.movie.id));
query.push('serial=' + (object.movie.name ? 1 : 0));
if (object.movie.imdb_id) query.push('imdb_id=' + (object.movie.imdb_id || ''));
if (object.movie.kinopoisk_id) query.push('kinopoisk_id=' + (object.movie.kinopoisk_id || ''));
var url = Defined.localhost + 'externalids?' + query.join('&');
network.timeout(10000);
network.silent(account(url), function(json) {
for (var name in json) {
object.movie[name] = json[name];
}
resolve();
}, function() {
resolve();
});
} else resolve();
});
};
this.updateBalanser = function(balanser_name) {
var last_select_balanser = Lampa.Storage.cache('online_last_balanser', 3000, {});
last_select_balanser[object.movie.id] = balanser_name;
Lampa.Storage.set('online_last_balanser', last_select_balanser);
};
this.changeBalanser = function(balanser_name) {
this.updateBalanser(balanser_name);
Lampa.Storage.set('online_balanser', balanser_name);
var to = this.getChoice(balanser_name);
var from = this.getChoice();
if (from.voice_name) to.voice_name = from.voice_name;
this.saveChoice(to, balanser_name);
Lampa.Activity.replace();
};
this.requestParams = function(url) {
var query = [];
var card_source = object.movie.source || 'tmdb'; //Lampa.Storage.field('source')
query.push('id=' + encodeURIComponent(object.movie.id));
if (object.movie.imdb_id) query.push('imdb_id=' + (object.movie.imdb_id || ''));
if (object.movie.kinopoisk_id) query.push('kinopoisk_id=' + (object.movie.kinopoisk_id || ''));
if (object.movie.tmdb_id) query.push('tmdb_id=' + (object.movie.tmdb_id || ''));
query.push('title=' + encodeURIComponent(object.clarification ? object.search : object.movie.title || object.movie.name));
query.push('original_title=' + encodeURIComponent(object.movie.original_title || object.movie.original_name));
query.push('serial=' + (object.movie.name ? 1 : 0));
query.push('original_language=' + (object.movie.original_language || ''));
query.push('year=' + ((object.movie.release_date || object.movie.first_air_date || '0000') + '').slice(0, 4));
query.push('source=' + card_source);
query.push('clarification=' + (object.clarification ? 1 : 0));
query.push('similar=' + (object.similar ? true : false));
query.push('rchtype=' + (((window.rch_nws && window.rch_nws[hostkey]) ? window.rch_nws[hostkey].type : (window.rch && window.rch[hostkey]) ? window.rch[hostkey].type : '') || ''));
if (Lampa.Storage.get('account_email', '')) query.push('cub_id=' + Lampa.Utils.hash(Lampa.Storage.get('account_email', '')));
return url + (url.indexOf('?') >= 0 ? '&' : '?') + query.join('&');
};
this.getLastChoiceBalanser = function() {
var last_select_balanser = Lampa.Storage.cache('online_last_balanser', 3000, {});
if (last_select_balanser[object.movie.id]) {
return last_select_balanser[object.movie.id];
} else {
return Lampa.Storage.get('online_balanser', filter_sources.length ? filter_sources[0] : '');
}
};
this.startSource = function(json) {
return new Promise(function(resolve, reject) {
json.forEach(function(j) {
var name = balanserName(j);
sources[name] = {
url: j.url,
name: j.name,
show: typeof j.show == 'undefined' ? true : j.show
};
});
filter_sources = Lampa.Arrays.getKeys(sources);
if (filter_sources.length) {
var last_select_balanser = Lampa.Storage.cache('online_last_balanser', 3000, {});
if (last_select_balanser[object.movie.id]) {
balanser = last_select_balanser[object.movie.id];
} else {
balanser = Lampa.Storage.get('online_balanser', filter_sources[0]);
}
if (!sources[balanser]) balanser = filter_sources[0];
if (!sources[balanser].show && !object.lampac_custom_select) balanser = filter_sources[0];
source = sources[balanser].url;
Lampa.Storage.set('active_balanser', balanser);
resolve(json);
} else {
reject();
}
});
};
this.lifeSource = function() {
var _this3 = this;
return new Promise(function(resolve, reject) {
var url = _this3.requestParams(Defined.localhost + 'lifeevents?memkey=' + (_this3.memkey || ''));
var red = false;
var gou = function gou(json, any) {
if (json.accsdb) return reject(json);
var last_balanser = _this3.getLastChoiceBalanser();
if (!red) {
var _filter = json.online.filter(function(c) {
return any ? c.show : c.show && c.name.toLowerCase() == last_balanser;
});
if (_filter.length) {
red = true;
resolve(json.online.filter(function(c) {
return c.show;
}));
} else if (any) {
reject();
}
}
};
var fin = function fin(call) {
network.timeout(3000);
network.silent(account(url), function(json) {
life_wait_times++;
filter_sources = [];
sources = {};
json.online.forEach(function(j) {
var name = balanserName(j);
sources[name] = {
url: j.url,
name: j.name,
show: typeof j.show == 'undefined' ? true : j.show
};
});
filter_sources = Lampa.Arrays.getKeys(sources);
filter.set('sort', filter_sources.map(function(e) {
return {
title: sources[e].name,
source: e,
selected: e == balanser,
ghost: !sources[e].show
};
}));
filter.chosen('sort', [sources[balanser] ? sources[balanser].name : balanser]);
gou(json);
var lastb = _this3.getLastChoiceBalanser();
if (life_wait_times > 15 || json.ready) {
filter.render().find('.lampac-balanser-loader').remove();
gou(json, true);
} else if (!red && sources[lastb] && sources[lastb].show) {
gou(json, true);
life_wait_timer = setTimeout(fin, 1000);
} else {
life_wait_timer = setTimeout(fin, 1000);
}
}, function() {
life_wait_times++;
if (life_wait_times > 15) {
reject();
} else {
life_wait_timer = setTimeout(fin, 1000);
}
});
};
fin();
});
};
this.createSource = function() {
var _this4 = this;
return new Promise(function(resolve, reject) {
var url = _this4.requestParams(Defined.localhost + 'lite/events?life=true');
network.timeout(15000);
network.silent(account(url), function(json) {
if (json.accsdb) return reject(json);
if (json.life) {
_this4.memkey = json.memkey;
if (json.title) {
if (object.movie.name) object.movie.name = json.title;
if (object.movie.title) object.movie.title = json.title;
}
filter.render().find('.filter--sort').append('<span class="lampac-balanser-loader" style="width: 1.2em; height: 1.2em; margin-top: 0; background: url(./img/loader.svg) no-repeat 50% 50%; background-size: contain; margin-left: 0.5em"></span>');
_this4.lifeSource().then(_this4.startSource).then(resolve)["catch"](reject);
} else {
_this4.startSource(json).then(resolve)["catch"](reject);
}
}, reject);
});
};
/**
* Подготовка
*/
this.create = function() {
return this.render();
};
/**
* Начать поиск
*/
this.search = function() { //this.loading(true)
this.filter({
source: filter_sources
}, this.getChoice());
this.find();
};
this.find = function() {
this.request(this.requestParams(source));
};
this.request = function(url) {
number_of_requests++;
if (number_of_requests < 10) {
network["native"](account(url), this.parse.bind(this), this.doesNotAnswer.bind(this), false, {
dataType: 'text'
});
clearTimeout(number_of_requests_timer);
number_of_requests_timer = setTimeout(function() {
number_of_requests = 0;
}, 4000);
} else this.empty();
};
this.parseJsonDate = function(str, name) {
try {
var html = $('<div>' + str + '</div>');
var elems = [];
html.find(name).each(function() {
var item = $(this);
var data = JSON.parse(item.attr('data-json'));
var season = item.attr('s');
var episode = item.attr('e');
var text = item.text();
if (!object.movie.name) {
if (text.match(/\d+p/i)) {
if (!data.quality) {
data.quality = {};
data.quality[text] = data.url;
}
text = object.movie.title;
}
if (text == 'По умолчанию') {
text = object.movie.title;
}
}
if (episode) data.episode = parseInt(episode);
if (season) data.season = parseInt(season);
if (text) data.text = text;
data.active = item.hasClass('active');
elems.push(data);
});
return elems;
} catch (e) {
return [];
}
};
this.getFileUrl = function(file, call, waiting_rch) {
var _this = this;
if(Lampa.Storage.field('player') !== 'inner' && file.stream && Lampa.Platform.is('apple')){
var newfile = Lampa.Arrays.clone(file);
newfile.method = 'play';
newfile.url = file.stream;
call(newfile, {});
}
else if (file.method == 'play') call(file, {});
else {
Lampa.Loading.start(function() {
Lampa.Loading.stop();
Lampa.Controller.toggle('content');
network.clear();
});
network["native"](account(file.url), function(json) {
if(json.rch){
if(waiting_rch) {
Lampa.Loading.stop();
call(false, {});
}
else {
_this.rch(json,function(){
Lampa.Loading.stop();
_this.getFileUrl(file, call, true);
});
}
}
else{
Lampa.Loading.stop();
call(json, json);
}
}, function() {
Lampa.Loading.stop();
call(false, {});
});
}
};
this.toPlayElement = function(file) {
var play = {
title: file.title,
url: file.url,
quality: file.qualitys,
timeline: file.timeline,
subtitles: file.subtitles,
segments: file.segments,
callback: file.mark,
season: file.season,
episode: file.episode,
voice_name: file.voice_name
};
return play;
};
this.orUrlReserve = function(data) {
if (data.url && typeof data.url == 'string' && data.url.indexOf(" or ") !== -1) {
var urls = data.url.split(" or ");
data.url = urls[0];
data.url_reserve = urls[1];
}
};
this.setDefaultQuality = function(data) {
if (Lampa.Arrays.getKeys(data.quality).length) {
for (var q in data.quality) {
if (parseInt(q) == Lampa.Storage.field('video_quality_default')) {
data.url = data.quality[q];
this.orUrlReserve(data);
}
if (data.quality[q].indexOf(" or ") !== -1)
data.quality[q] = data.quality[q].split(" or ")[0];
}
}
};
this.display = function(videos) {
var _this5 = this;
this.draw(videos, {
onEnter: function onEnter(item, html) {
_this5.getFileUrl(item, function(json, json_call) {
if (json && json.url) {
var playlist = [];
var first = _this5.toPlayElement(item);
first.url = json.url;
first.headers = json_call.headers || json.headers;
first.quality = json_call.quality || item.qualitys;
first.segments = json_call.segments || item.segments;
first.hls_manifest_timeout = json_call.hls_manifest_timeout || json.hls_manifest_timeout;
first.subtitles = json.subtitles;
first.subtitles_call = json_call.subtitles_call || json.subtitles_call;
if (json.vast && json.vast.url) {
first.vast_url = json.vast.url;
first.vast_msg = json.vast.msg;
first.vast_region = json.vast.region;
first.vast_platform = json.vast.platform;
first.vast_screen = json.vast.screen;
}
_this5.orUrlReserve(first);
_this5.setDefaultQuality(first);
if (item.season) {
videos.forEach(function(elem) {
var cell = _this5.toPlayElement(elem);
if (elem == item) cell.url = json.url;
else {
if (elem.method == 'call') {
if (Lampa.Storage.field('player') !== 'inner') {
cell.url = elem.stream;
delete cell.quality;
} else {
cell.url = function(call) {
_this5.getFileUrl(elem, function(stream, stream_json) {
if (stream.url) {
cell.url = stream.url;
cell.quality = stream_json.quality || elem.qualitys;
cell.segments = stream_json.segments || elem.segments;
cell.subtitles = stream.subtitles;
_this5.orUrlReserve(cell);
_this5.setDefaultQuality(cell);
elem.mark();
} else {
cell.url = '';
Lampa.Noty.show(Lampa.Lang.translate('lampac_nolink'));
}
call();
}, function() {
cell.url = '';
call();
});
};
}
} else {
cell.url = elem.url;
}
}
_this5.orUrlReserve(cell);
_this5.setDefaultQuality(cell);
playlist.push(cell);
}); //Lampa.Player.playlist(playlist)
} else {
playlist.push(first);
}
if (playlist.length > 1) first.playlist = playlist;
if (first.url) {
var element = first;
element.isonline = true;
if (element.url && element.isonline) {
// online.js
}
else if (element.url) {
if (false) {
if (Platform.is('browser') && location.host.indexOf("127.0.0.1") !== -1) {
Noty.show('Видео открыто в playerInner', {time: 3000});
$.get(getBalancerUrl() + '/player-inner/' + element.url);
return;
}
Player.play(element);
}
else {
if (true && Platform.is('browser') && location.host.indexOf("127.0.0.1") !== -1)
Noty.show('Внешний плеер можно указать в init.conf (playerInner)', {time: 3000});
Player.play(element);
}
}
Lampa.Player.play(element);
Lampa.Player.playlist(playlist);
if(element.subtitles_call) _this5.loadSubtitles(element.subtitles_call)
item.mark();
_this5.updateBalanser(balanser);
} else {
Lampa.Noty.show(Lampa.Lang.translate('lampac_nolink'));
}
} else Lampa.Noty.show(Lampa.Lang.translate('lampac_nolink'));
}, true);
},
onContextMenu: function onContextMenu(item, html, data, call) {
_this5.getFileUrl(item, function(stream) {
call({
file: stream.url,
quality: item.qualitys
});
}, true);
}
});
this.filter({
season: filter_find.season.map(function(s) {
return s.title;
}),
voice: filter_find.voice.map(function(b) {
return b.title;
})
}, this.getChoice());
};
this.loadSubtitles = function(link){
network.silent(account(link), function(subs){
Lampa.Player.subtitles(subs)
})
}
this.parse = function(str) {
var json = Lampa.Arrays.decodeJson(str, {});
if (Lampa.Arrays.isObject(str) && str.rch) json = str;
if (json.rch) return this.rch(json);
try {
var items = this.parseJsonDate(str, '.videos__item');
var buttons = this.parseJsonDate(str, '.videos__button');
if (items.length == 1 && items[0].method == 'link' && !items[0].similar) {
filter_find.season = items.map(function(s) {
return {
title: s.text,
url: s.url
};
});
this.replaceChoice({
season: 0
});
this.request(items[0].url);
} else {
this.activity.loader(false);
var videos = items.filter(function(v) {
return v.method == 'play' || v.method == 'call';
});
var similar = items.filter(function(v) {
return v.similar;
});
if (videos.length) {
if (buttons.length) {
filter_find.voice = buttons.map(function(b) {
return {
title: b.text,
url: b.url
};
});
var select_voice_url = this.getChoice(balanser).voice_url;
var select_voice_name = this.getChoice(balanser).voice_name;
var find_voice_url = buttons.find(function(v) {
return v.url == select_voice_url;
});
var find_voice_name = buttons.find(function(v) {
return v.text == select_voice_name;
});
var find_voice_active = buttons.find(function(v) {
return v.active;
}); ////console.log('b',buttons)
////console.log('u',find_voice_url)
////console.log('n',find_voice_name)
////console.log('a',find_voice_active)
if (find_voice_url && !find_voice_url.active) {
//console.log('Lampac', 'go to voice', find_voice_url);
this.replaceChoice({
voice: buttons.indexOf(find_voice_url),
voice_name: find_voice_url.text
});
this.request(find_voice_url.url);
} else if (find_voice_name && !find_voice_name.active) {
//console.log('Lampac', 'go to voice', find_voice_name);
this.replaceChoice({
voice: buttons.indexOf(find_voice_name),
voice_name: find_voice_name.text
});
this.request(find_voice_name.url);
} else {
if (find_voice_active) {
this.replaceChoice({
voice: buttons.indexOf(find_voice_active),
voice_name: find_voice_active.text
});
}
this.display(videos);
}
} else {
this.replaceChoice({
voice: 0,
voice_url: '',
voice_name: ''
});
this.display(videos);
}
} else if (items.length) {
if (similar.length) {
this.similars(similar);
this.activity.loader(false);
} else { //this.activity.loader(true)
filter_find.season = items.map(function(s) {
return {
title: s.text,
url: s.url
};
});
var select_season = this.getChoice(balanser).season;
var season = filter_find.season[select_season];
if (!season) season = filter_find.season[0];
//console.log('Lampac', 'go to season', season);
this.request(season.url);
}
} else {
this.doesNotAnswer(json);
}
}
} catch (e) {
//console.log('Lampac', 'error', e.stack);
this.doesNotAnswer(e);
}
};
this.similars = function(json) {
var _this6 = this;
scroll.clear();
json.forEach(function(elem) {
elem.title = elem.text;
elem.info = '';
var info = [];
var year = ((elem.start_date || elem.year || object.movie.release_date || object.movie.first_air_date || '') + '').slice(0, 4);
if (year) info.push(year);
if (elem.details) info.push(elem.details);
var name = elem.title || elem.text;
elem.title
+2774
View File
File diff suppressed because it is too large Load Diff
+9
View File
@@ -0,0 +1,9 @@
(function () {
'use strict';
Lampa.Utils.putScriptAsync(['http://rc.bwa.ad/sisi.js?v23012026', 'https://cf.xsena.red?v14012026', 'http://pl.xsena.red?v14012026', 'http://nl.xsena.red?v14012026'], function () {});
/*if (Lampa.Platform.is('android'))
Lampa.Utils.putScriptAsync(['https://immisterio.github.io/AdultJS/lampa.js'], function () {});
*/
})();
+3016
View File
File diff suppressed because it is too large Load Diff
+10
View File
@@ -0,0 +1,10 @@
(function () {
'use strict';
//Не нужно переписывать весь этот код, не делайте так!
//for Lampa.
window.lampa_settings.torrents_use = true;
window.lampa_settings.demo = false;
window.lampa_settings.read_only = false;
})();
+259
View File
@@ -0,0 +1,259 @@
{
"secuses": true,
"results": [
{
"title": "Популярные",
"results": [
{
"name": "BwaRC",
"author": "bwa.ad",
"link": "{localhost}/plugins/bwa_rc.js",
"descr": "Фильмы и сериалы в онлайн",
"available_lampa": 1
},
{
"name": "Онлайн Мод",
"author": "@t_anton",
"link": "{localhost}/plugins/online_mod.js",
"descr": "Фильмы и сериалы в онлайн.",
"available_lampa": 1
},
{
"name": "Showy",
"author": "Showy",
"link": "{localhost}/plugins/showy.js",
"descr": "Фильмы и сериалы в онлайн",
"available_lampa": 1
}
],
"hpu": "best"
},
{
"title": "Видео",
"results": [
{
"name": "BwaRC",
"author": "bwa.ad",
"link": "{localhost}/plugins/bwa_rc.js",
"descr": "Фильмы и сериалы в онлайн",
"available_lampa": 1
},
{
"name": "Онлайн Мод",
"author": "@t_anton",
"link": "{localhost}/plugins/online_mod.js",
"descr": "Фильмы и сериалы в онлайн",
"available_lampa": 1
},
{
"name": "Клубничка 18+",
"author": "bwa.ad",
"link": "{localhost}/plugins/bwa_re.js",
"descr": "Онлайн просмотр контента для взрослых, больше 30 сайтов",
"available_lampa": 1
},
{
"name": "Xsena 18+",
"author": "xsena",
"link": "{localhost}/plugins/xsena.js",
"descr": "Онлайн просмотр контента для взрослых, больше 40 сайтов",
"available_lampa": 1
},
{
"name": "Filmix",
"author": "@lampa_land",
"link": "{localhost}/plugins/filmix_fx.js",
"descr": "Фильмы и сериалы в онлайн",
"available_lampa": 1
},
{
"name": "Showy",
"author": "Showy",
"link": "{localhost}/plugins/showy.js",
"descr": "Фильмы и сериалы в онлайн",
"available_lampa": 1
},
{
"name": "Онлайн Stream",
"author": "",
"link": "{localhost}/plugins/arkmv_vod.js",
"descr": "Онлайн",
"available_lampa": 1
},
{
"name": "Онлайн Stream 2",
"author": "",
"link": "{localhost}/plugins/llpp_vod.js",
"descr": "Онлайн",
"available_lampa": 1
}
],
"hpu": "video"
},
{
"title": "Управление",
"results": [
{
"name": "Подборки",
"author": "@lampa_land",
"link": "{localhost}/plugins/podbor.js",
"descr": "Подборки от онлайн кинотеатров, мультсериалы и мультфильмы.",
"available_lampa": 1
},
{
"name": "Добавляет пункт \"Парсер\" в меню",
"author": "@lampa",
"link": "{localhost}/plugins/etor.js",
"descr": "Плагин для ТВ, на которых Lampa установлена через официальные магазины LG Store и Tizen App Store. Включает в настройках отображение пунктов Парсер и Torrserver",
"available_lampa": 1
},
{
"name": "Публичные парсеры",
"author": "@lme",
"link": "{localhost}/plugins/pubtorr.js",
"descr": "Сборник публичных парсеров отображением статуса доступности",
"available_lampa": 1
},
{
"name": "Дополнительные категории",
"author": "@lme",
"link": "{localhost}/plugins/nc.js",
"descr": "Добавление категорий Мультфильмы, Netflix, Концерты, и прочее",
"available_lampa": 1
},
{
"name": "Сброс настроек субтитров",
"author": "@t_anton",
"link": "{localhost}/plugins/reset_subs.js",
"descr": "Сбрасывает настройки субтитров по умолчанию",
"available_lampa": 1
},
{
"name": "Выключение тача",
"author": "@t_anton",
"link": "{localhost}/plugins/not_mobile.js",
"descr": "Выключает сенсорное управление, если оно было включено по ошибке",
"available_lampa": 1
},
{
"name": "LME Torrent Manager",
"author": "@rootu",
"link": "{localhost}/plugins/torrentmanager.js",
"descr": "Плагин управления торрентами",
"available_lampa": 1
},
{
"name": "Torrent downloader",
"author": "@rootu",
"link": "{localhost}/plugins/td.js",
"descr": "Плагин управления торрентами",
"available_lampa": 1
}
],
"hpu": "control"
},
{
"title": "Телевидение",
"results": [
{
"name": "Kulik",
"author": "@SawamuraRen",
"link": "{localhost}/plugins/kulik.js",
"descr": "Просмотр IPTV каналов, отсортированных по различным категориям. Есть возможность поменять стиль плагина, сервер вещания, а также добавить каналы в избранное",
"available_lampa": 1
},
{
"name": "Дизель ТВ",
"author": "@AndreyURL54",
"link": "{localhost}/plugins/diesel.js",
"descr": "Бесплатный просмотр телеканалов и коммерческих плейлистов с телепрограммой и записью архива",
"available_lampa": 1
}
],
"hpu": "tv"
},
{
"title": "Разное",
"results": [
{
"name": "Логотипы вместо названий",
"author": "@lampa_land",
"link": "{localhost}/plugins/logo.js",
"descr": "Отображает логотипы фильмов, вместо названий в карточках",
"available_lampa": 1
},
{
"name": "Кинопоиск",
"author": "and7ey",
"link": "{localhost}/plugins/kinopoisk.js",
"descr": "Отображает в приложении список фильмов из папки Буду смотреть на Кинопоиске",
"available_lampa": 1
},
{
"name": "SomaFM",
"author": "@tsynik",
"link": "{localhost}/plugins/soma.js",
"descr": "Радио для Lampa",
"available_lampa": 1
},
{
"name": "Оригинальные названия",
"author": "@BDV_Burik",
"link": "{localhost}/plugins/title.js",
"descr": "Добавляет оригинальные названия к фильмам, сериалам.",
"available_lampa": 1
},
{
"name": "Shikimori - Каталог аниме",
"author": "@lme",
"link": "{localhost}/plugins/shikimori.js",
"descr": "Отображает информацию по аниме с Shikimori, так же пытается найти по оригинальному названию на ТМДБ, если найдено множество результато в то покажет меню с выбором",
"available_lampa": 1
},
{
"name": "Радио Рекорд (мод плагина от @Tw1cker)",
"author": "@elenatv99",
"link": "{localhost}/plugins/record.js",
"descr": "Радио Рекорд + Радио Вера)))",
"available_lampa": 1
},
{
"name": "Радио Records",
"author": "@nemiroff",
"link": "{localhost}/plugins/rr.js",
"descr": "Радио Records",
"available_lampa": 1
},
{
"name": "Комментарии с HDRezka",
"author": "@BDV_Burik",
"link": "{localhost}/plugins/rezkacomment.js",
"descr": "Добавляет кнопку чтения отзывов с rezka.ag в карточку фильма или сериала",
"available_lampa": 1
},
{
"name": "Рейтинг КиноПоиск и IMDB",
"author": "@t_anton",
"link": "{localhost}/plugins/rating.js",
"descr": "Показ рейтинга КиноПоиск и IMDB в карточке. Функционал аналогичен части из MODSs, так что их не следует использовать вместе",
"available_lampa": 1
},
{
"name": "Предзагрузка ts",
"author": "@rootu",
"link": "{localhost}/plugins/ts-preload.plugin.js",
"descr": "Плагин визуализации предзагрузки торрентов для встроенного клиента TorrServer",
"available_lampa": 1
},
{
"name": "Отключение Websocket",
"author": "@rootu",
"link": "{localhost}/plugins/wsoff.js",
"descr": "Плагин отключает протокол Websocket, помогает при ошибках на некоторых устройствах",
"available_lampa": 1
}
],
"hpu": "other"
}
]
}
+1905
View File
File diff suppressed because one or more lines are too long
+425
View File
@@ -0,0 +1,425 @@
(function() {
'use strict';
var network = new Lampa.Reguest();
function getRandomKinopoiskTechKey() {
const keys = ['8c8e1a50-6322-4135-8875-5d40a5420d86', 'f1d94351-2911-4485-b037-97817098724e', '8c8e1a50-6322-4135-8875-5d40a5420d86'];
const randomIndex = Math.floor(Math.random() * keys.length);
return keys[randomIndex];
}
function calculateProgress(total, current) {
if(total == current) {
Lampa.Noty.show('Обновление списка фильмов Кинопоиска завершено (' + String(total) + ')');
if(Lampa.Storage.get('kinopoisk_launched_before', false) == false) {
Lampa.Storage.set('kinopoisk_launched_before', true);
Lampa.Activity.push({
url: '',
title: 'Кинопоиск',
component: 'kinopoisk',
page: 1
});
}
}
}
function processKinopoiskData(data) {
// use cache
if(data && data.data.userProfile && data.data.userProfile.userData && data.data.userProfile.userData.plannedToWatch) {
var kinopoiskMovies = Lampa.Storage.get('kinopoisk_movies', []);
var receivedMovies = data.data.userProfile.userData.plannedToWatch.movies.items;
var receivedMoviesCount = receivedMovies.length;
var moviesCount = data.data.userProfile.userData.plannedToWatch.movies.total;
console.log('Kinopoisk', "Total planned to watch movies found: " + String(moviesCount));
console.log('Kinopoisk', "Movies received count: " + String(receivedMoviesCount));
if(receivedMoviesCount == 0) {
Lampa.Noty.show('В списке "Буду смотреть" Кинопоиска нет фильмов');
}
const receivedMovieIds = new Set(receivedMovies.map(m => String(m.movie.id)));
// filter out movies that are no longer present in receivedMovies
kinopoiskMovies = kinopoiskMovies.filter(movie => receivedMovieIds.has(String(movie.kinopoisk_id)));
Lampa.Storage.set('kinopoisk_movies', JSON.stringify(kinopoiskMovies));
let processedItems = 1;
receivedMovies.forEach(m => {
const existsInLocalStorage = kinopoiskMovies.some(km => km.kinopoisk_id === String(m.movie.id));
if (!existsInLocalStorage) {
// get movie data
var title = m.movie.title.localized || m.movie.title.original;
console.log('Kinopoisk', 'Getting details for movie: ' + String(m.movie.id) + ', movie title: ' + title);
// getting imdb id based on kinopoisk id
// network.silent('https://kinopoiskapiunofficial.tech/api/v2.2/films/' + String(m.movie.id), function(data) {
network.silent('https://api.alloha.tv/?token=04941a9a3ca3ac16e2b4327347bbc1&kp=' + String(m.movie.id), function(data) {
if (data && data.data) {
var movieIMDBid = data.data.id_imdb;
var movieTMDBid = data.data.id_tmdb ? data.data.id_tmdb : null;
var movieTitle = data.data.original_name ? data.data.original_name : data.data.name;
if (data.data.category == 1) {
var movieType = 'movie';
} else { // 2
var movieType = 'tv';
}
var movieYear = data.data.year;
if (movieTMDBid) {
console.log('Kinopoisk', 'TMDB movie id found: ' + String(movieTMDBid) + ' for kinopoisk id: ' + String(m.movie.id));
var url = Lampa.Utils.protocol() + 'tmdb.'+ Lampa.Manifest.cub_domain +'/3/' + movieType + '/' + String(movieTMDBid) + '?api_key=4ef0d7355d9ffb5151e987764708ce96&language=ru';
} else {
if (movieType === 'movie') {
console.log('Kinopoisk', 'No IMDB movie id found for kinopoisk id: ' + String(m.movie.id) + ', will search by movie title: ' + movieTitle);
var url = Lampa.Utils.protocol() + 'tmdb.'+ Lampa.Manifest.cub_domain +'/3/search/movie?query=' + encodeURIComponent(movieTitle) + '&api_key=4ef0d7355d9ffb5151e987764708ce96&year=' + String(movieYear) + '&language=ru';
} else { // TV_SERIES
console.log('Kinopoisk', 'No IMDB movie id found for kinopoisk id: ' + String(m.movie.id) + ', will search by tv series title: ' + movieTitle);
var url = Lampa.Utils.protocol() + 'tmdb.'+ Lampa.Manifest.cub_domain +'/3/search/tv?query=' + encodeURIComponent(movieTitle) + '&api_key=4ef0d7355d9ffb5151e987764708ce96&year=' + String(movieYear) + '&language=ru';
}
}
// getting movie details
network.silent(url, function(data) {
if(data) {
if (movieTMDBid) {
var movieItem = data;
} else {
if (data.movie_results && data.movie_results[0]) {
var movieItem = data.movie_results[0];
} else if(data.tv_results && data.tv_results[0]) {
var movieItem = data.tv_results[0];
} else if(data.results && data.results[0]) {
var movieItem = data.results[0];
}
}
if(movieItem) {
// console.log('Kinopoisk', 'Movie details received: ' + JSON.stringify(movieItem));
console.log('Kinopoisk', 'TMDB id found: ' + movieItem.id + ' for IMDB movie id: ' + movieIMDBid + ', kinopoisk id: ' + String(m.movie.id));
var movieDateStr = movieItem.release_date || movieItem.first_air_date; // film or tv series
var movieDate = new Date(movieDateStr);
if (movieDate <= new Date()) {
movieItem.kinopoisk_id = String(m.movie.id);
movieItem.source = "tmdb";
kinopoiskMovies = Lampa.Storage.get('kinopoisk_movies', []); // re-read data if another process modified it
kinopoiskMovies.unshift(movieItem);
Lampa.Storage.set('kinopoisk_movies', JSON.stringify(kinopoiskMovies));
} else {
console.log('Kinopoisk', 'Movie or TV with kinopoisk id ' + String(m.movie.id) + ' not released yet, release date:', movieDate);
if (Lampa.Storage.get('kinopoisk_add_to_favorites', false)) { // add to favorites
Lampa.Favorite.add('wath', movieItem, 100);
}
}
} else {
console.log('Kinopoisk', 'No result found for ' + movieTitle + ', ' + movieYear, data);
}
} else {
console.log('Kinopoisk', 'No movie found by IMDB id: ' + String(movieIMDBid));
}
calculateProgress(receivedMoviesCount, processedItems++);
}, function(data) {
console.log('Kinopoisk', 'apitmdb.cub.red error, data: ' + String(data));
calculateProgress(receivedMoviesCount, processedItems++);
});
} else {
console.log('Kinopoisk', 'No movie found for kinopoisk id: ' + String(m.movie.id) + ', movie: ' + title);
calculateProgress(receivedMoviesCount, processedItems++);
}
}, function(data) {
console.log('Kinopoisk', 'kinopoiskapiunofficial error, data: ' + String(data));
calculateProgress(receivedMoviesCount, processedItems++);
}, false, {
type: 'get' //,
// headers: {
// 'X-API-KEY': getRandomKinopoiskTechKey()
// }
});
} else {
console.log('Kinopoisk', 'Reading data from local storage for movie: ' + String(m.movie.id))
calculateProgress(receivedMoviesCount, processedItems++);
}
})
} else {
Lampa.Noty.show('Невозможно обработать данные, полученные от Кинопоиска');
console.log('Kinopoisk', 'processKinopoiskData - ');
console.log('Kinopoisk', data);
}
}
function getKinopoiskData() {
console.log('Kinopoisk', 'Starting to get Kinopoisk data...');
var oauth = Lampa.Storage.get('kinopoisk_access_token');
// google script is used to act as CORS proxy
network.silent('https://script.google.com/macros/s/AKfycbwQhxl9xQPv46uChWJ1UDg6BjSmefbSlTRUoSZz5f1rZDRvdhAGTi6RHyXwcSeyBtPr/exec?oauth=' + oauth, function(data) { // on success
processKinopoiskData(data);
}, function(data) { // on error
console.log('Kinopoisk', 'Error, google script', data);
});
}
function full(params, oncomplete, onerror) {
// https://github.com/yumata/lampa-source/blob/main/src/utils/reguest.js
// https://github.com/yumata/lampa-source/blob/main/plugins/collections/api.js
var oauth = Lampa.Storage.get('kinopoisk_access_token');
if(oauth) {
getKinopoiskData();
}
oncomplete({
"secuses": true,
"page": 1,
"results": Lampa.Storage.get('kinopoisk_movies', [])
});
}
function clear() {
network.clear();
}
var Api = {
full: full,
clear: clear
};
function component(object) {
var comp = new Lampa.InteractionCategory(object);
comp.create = function() {
Api.full(object, this.build.bind(this), this.empty.bind(this));
};
comp.nextPageReuest = function(object, resolve, reject) {
Api.full(object, resolve.bind(comp), reject.bind(comp));
};
return comp;
}
// getting/refreshing oauth kinopoisk token
function getToken(device_code, refresh) {
var client_id = 'b8b9c7a09b79452094e12f6990009934';
if(!refresh) {
var token_data = {
'grant_type': 'device_code',
'code': device_code,
'client_id': client_id,
'client_secret': '0e7001e272944c05ae5a0df16e3ea8bd'
}
} else { // refresh token
var token_data = {
'grant_type': 'refresh_token',
'refresh_token': device_code, // pass refresh token as device_code
'client_id': client_id,
'client_secret': '0e7001e272944c05ae5a0df16e3ea8bd'
}
}
network.silent('https://oauth.yandex.ru/token', function(data) { // on token success
if(data.access_token) {
Lampa.Storage.set('kinopoisk_access_token', data.access_token);
Lampa.Storage.set('kinopoisk_refresh_token', data.refresh_token);
Lampa.Storage.set('kinopoisk_token_expires', data.expires_in * 1000 + Date.now());
Lampa.Modal.close();
getUserEmail();
getKinopoiskData();
} else {
Lampa.Noty.show('Не удалось получить token');
console.log('Kinopoisk', 'Error during OAuth', data.error);
}
}, function(data) { // on token error
Lampa.Noty.show(data.responseJSON.error_description);
console.log('Kinopoisk', 'Token error', data);
}, token_data);
}
// getting oauth user_code
// https://yandex.ru/dev/id/doc/ru/codes/screen-code-oauth
function getDeviceCode() {
// generating unique device id
const uuid4 = () => {
const ho = (n, p) => n.toString(16).padStart(p, 0);
const data = crypto.getRandomValues(new Uint8Array(16));
data[6] = (data[6] & 0xf) | 0x40;
data[8] = (data[8] & 0x3f) | 0x80;
const view = new DataView(data.buffer);
return `${ho(view.getUint32(0), 8)}${ho(view.getUint16(4), 4)}${ho(view.getUint16(6), 4)}${ho(view.getUint16(8), 4)}${ho(view.getUint32(10), 8)}${ho(view.getUint16(14), 4)}`; /// Compile the canonical textual form from the array data
};
Lampa.Storage.set('kinopoisk_deviceid', uuid4());
var client_id = 'b8b9c7a09b79452094e12f6990009934';
var device_code_data = {
'client_id': client_id,
'device_id': Lampa.Storage.get('kinopoisk_deviceid', '')
}
network.silent('https://oauth.yandex.ru/device/code', function(data) { // on device code success
if(data.user_code && data.device_code) {
// Lampa.Utils.copyTextToClipboard(data.user_code, ()=>{});
// ask user to authorize
let modal = $('<div><div class="about">Перейдите по ссылке https://ya.ru/device на любом устройстве и введите код<br><br><b>' + data.user_code + '</b><br><br></div><br><div class="broadcast__device selector" style="textalign: center">Готово</div></div>')
Lampa.Modal.open({
title: 'Авторизация',
html: modal,
align: 'center',
onBack: () => {
Lampa.Modal.close()
},
onSelect: () => { // on button click
getToken(data.device_code, false);
}
})
} else {
Lampa.Noty.show('Не удалось получить user_code');
console.log('Kinopoisk', 'Failed to get user_code', data.error);
}
}, function(data) { // on device code error
Lampa.Noty.show(data.responseJSON.error_description);
console.log('Kinopoisk', 'Failed to get device code', data);
}, device_code_data);
}
function getUserEmail() {
network.silent('https://login.yandex.ru/info?format=json', function(data) {
if (data.default_email) {
Lampa.Storage.set('kinopoisk_email', data.default_email);
$('div[data-name="kinopoisk_auth"]').find('.settings-param__name').text(data.default_email); // NOT WORKING?
} else {
Lampa.Noty.show('Не удалось получить email пользователя');
console.log('Kinopoisk', 'Failed to get user email', data.error);
}
}, function(data) { // on device code error
Lampa.Noty.show(data.responseText);
console.log('Kinopoisk', 'Failed to get user email', data);
}, false, {
type: 'get',
headers: {
'Authorization': 'OAuth ' + Lampa.Storage.get('kinopoisk_access_token')
}
});
}
function startPlugin() {
var manifest = {
type: 'video',
version: '0.4.0',
name: 'Кинопоиск',
description: '',
component: 'kinopoisk'
};
Lampa.Manifest.plugins = manifest;
Lampa.Component.add('kinopoisk', component);
if(Lampa.Storage.get('kinopoisk_access_token', '') !== '' && Lampa.Storage.get('kinopoisk_token_expires', 0) < Date.now()) { // refresh token needed
console.log('Kinopoisk', 'Token should be refreshed')
getToken(Lampa.Storage.get('kinopoisk_refresh_token', ''), true);
}
function add() {
var button = $("<li class=\"menu__item selector\">\n <div class=\"menu__ico\">\n <svg width=\"239\" height=\"239\" viewBox=\"0 0 239 239\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\" xml:space=\"preserve\"><path fill=\"currentColor\" d=\"M215 121.415l-99.297-6.644 90.943 36.334a106.416 106.416 0 0 0 8.354-29.69z\" /><path fill=\"currentColor\" d=\"M194.608 171.609C174.933 197.942 143.441 215 107.948 215 48.33 215 0 166.871 0 107.5 0 48.13 48.33 0 107.948 0c35.559 0 67.102 17.122 86.77 43.539l-90.181 48.07L162.57 32.25h-32.169L90.892 86.862V32.25H64.77v150.5h26.123v-54.524l39.509 54.524h32.169l-56.526-57.493 88.564 46.352z\" /><path d=\"M206.646 63.895l-90.308 36.076L215 93.583a106.396 106.396 0 0 0-8.354-29.688z\" fill=\"currentColor\"/></svg>\n </div>\n <div class=\"menu__text\">".concat(manifest.name, "</div>\n </li>"));
button.on('hover:enter', function() {
if(Lampa.Storage.get('kinopoisk_access_token', '') == '') { // initial authorization needed
getDeviceCode();
}
Lampa.Activity.push({
url: '',
title: manifest.name,
component: 'kinopoisk',
page: 1
});
});
$('.menu .menu__list').eq(0).append(button);
// $('.head__actions').eq(0).append(button);
}
if(window.appready) add();
else {
Lampa.Listener.follow('app', function(e) {
if(e.type == 'ready') add();
});
}
// SETTINGS
if(!window.lampa_settings.kinopoisk) { // re-use kinopoisk_ratings element, if exists
Lampa.SettingsApi.addComponent({
component: 'kinopoisk',
icon: '<svg width=\"239\" height=\"239\" viewBox=\"0 0 239 239\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\" xml:space=\"preserve\"><path fill=\"currentColor\" d=\"M215 121.415l-99.297-6.644 90.943 36.334a106.416 106.416 0 0 0 8.354-29.69z\" /><path fill=\"currentColor\" d=\"M194.608 171.609C174.933 197.942 143.441 215 107.948 215 48.33 215 0 166.871 0 107.5 0 48.13 48.33 0 107.948 0c35.559 0 67.102 17.122 86.77 43.539l-90.181 48.07L162.57 32.25h-32.169L90.892 86.862V32.25H64.77v150.5h26.123v-54.524l39.509 54.524h32.169l-56.526-57.493 88.564 46.352z\" /><path d=\"M206.646 63.895l-90.308 36.076L215 93.583a106.396 106.396 0 0 0-8.354-29.688z\" fill=\"currentColor\"/></svg>',
name: 'Кинопоиск'
});
}
Lampa.SettingsApi.addParam({
component: 'kinopoisk',
param: {
type: 'title'
},
field: {
name: 'Аккаунт',
}
})
var kinopoisk_email = Lampa.Storage.get('kinopoisk_email', false);
Lampa.SettingsApi.addParam({
component: 'kinopoisk',
param: {
type: 'button',
name: 'kinopoisk_auth'
},
field: {
name: kinopoisk_email ? kinopoisk_email : 'Авторизоваться',
},
onChange: () => {
if (Lampa.Storage.get('kinopoisk_email', false)) { // user authorized
Lampa.Select.show({
title: 'Выйти из аккаунта',
items: [{
title: 'Да',
confirm: true
}, {
title: 'Нет'
}],
onSelect: (a) => {
if(a.confirm) {
Lampa.Storage.set('kinopoisk_email', '');
Lampa.Storage.set('kinopoisk_access_token', '');
Lampa.Storage.set('kinopoisk_refresh_token', '');
// Lampa.Storage.set('kinopoisk_movies', []);
Lampa.Storage.set('kinopoisk_token_expires', 0);
$('div[data-name="kinopoisk_auth"]').find('.settings-param__name').text('Авторизоваться');
}
Lampa.Controller.toggle('settings_component');
},
onBack: ()=>{
Lampa.Controller.toggle('settings_component');
},
})
} else { // user not authorized
Lampa.Controller.toContent(); // hide settings menu
getDeviceCode(); // start auth process
}
}
});
Lampa.SettingsApi.addParam({
component: 'kinopoisk',
param: {
type: 'title'
},
field: {
name: 'Список Буду смотреть',
}
})
Lampa.SettingsApi.addParam({
component: 'kinopoisk',
param: {
name: 'kinopoisk_add_to_favorites',
type: 'trigger',
default: false
},
field: {
name: 'Добавлять в Избранное',
description: 'Будущие, еще не вышедшие релизы добавляются в список Позже'
}
})
Lampa.SettingsApi.addParam({
component: 'kinopoisk',
param: {
type: 'button',
name: 'kinopoisk_delete_cache'
},
field: {
name: 'Очистить кэш фильмов',
description: 'Необходимо при возникновении проблем'
},
onChange: () => {
Lampa.Storage.set('kinopoisk_movies', []);
Lampa.Noty.show('Кэш Кинопоиска очищен');
}
});
}
if(!window.kinopoisk_ready) startPlugin();
})();
+1966
View File
File diff suppressed because it is too large Load Diff
+15735
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -0,0 +1,2 @@
(function(){'use strict';function startPlugin(){window.logoplugin=!0;Lampa.Listener.follow('full',function(e){if(e.type=='complite'&&Lampa.Storage.get('logo_glav')!='1'){var data=e.data.movie;var type=data.name?'tv':'movie';if(data.id!='')var url=Lampa.TMDB.api(type+'/'+data.id+'/images?api_key='+Lampa.TMDB.key()+'&language='+Lampa.Storage.get('language'));$.get(url,function(data){if(data.logos&&data.logos[0]){var logo=data.logos[0].file_path;if(logo!='')e.object.activity.render().find('.full-start-new__title').html('<img style="margin-top:5px;max-height:125px;" src="'+Lampa.TMDB.image('/t/p/w300'+logo.replace('.svg','.png'))+'"/>')}})}})}
Lampa.SettingsApi.addParam({component:'interface',param:{name:'logo_glav',type:'select',values:{1:'Скрыть',0:'Отображать',},default:'0',},field:{name:'Логотипы вместо названий',description:'Отображает логотипы фильмов вместо текста',}});if(!window.logoplugin)startPlugin()})()
+312
View File
@@ -0,0 +1,312 @@
if(!window.loaded_modss) {
//show
Date.now||(Date.now=function(){return(new Date.getTime())}),function(){"use strict";for(var t=["webkit","moz"],e=0;e<t.length&&!window.requestAnimationFrame;++e){var i=t[e];window.requestAnimationFrame=window[i+"RequestAnimationFrame"],window.cancelAnimationFrame=window[i+"CancelAnimationFrame"]||window[i+"CancelRequestAnimationFrame"]}if(/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent)||!window.requestAnimationFrame||!window.cancelAnimationFrame){var s=0;window.requestAnimationFrame=function(t){var e=Date.now(),i=Math.max(s+16,e);return setTimeout(function(){t(s=i)},i-e)},window.cancelAnimationFrame=clearTimeout}}(),function(t){t.snowfall=function(e,i){function s(s,n,a,r){this.x=s,this.y=n,this.size=a,this.speed=r,this.step=0,this.stepSize=h(1,10)/100,i.collection&&(this.target=m[h(0,m.length-1)]);var p=null;i.image?(p=document.createElement("img"),p.src=i.image):(p=document.createElement("div"),t(p).css({background:i.flakeColor})),t(p).attr({"class":"snowfall-flakes"}).css({width:this.size,height:this.size,position:i.flakePosition,top:this.y,left:this.x,fontSize:0,zIndex:i.flakeIndex}),t(e).get(0).tagName===t(document).get(0).tagName?(t("body").append(t(p)),e=t("body")):t(e).append(t(p)),this.element=p,this.update=function(){if(this.y+=this.speed,this.y>l-(this.size+6)&&this.reset(),this.element.style.top=this.y+"px",this.element.style.left=this.x+"px",this.step+=this.stepSize,y===!1?this.x+=Math.cos(this.step):this.x+=y+Math.cos(this.step),i.collection&&this.x>this.target.x&&this.x<this.target.width+this.target.x&&this.y>this.target.y&&this.y<this.target.height+this.target.y){var t=this.target.element.getContext("2d"),e=this.x-this.target.x,s=this.y-this.target.y,n=this.target.colData;if(void 0!==n[parseInt(e)][parseInt(s+this.speed+this.size)]||s+this.speed+this.size>this.target.height)if(s+this.speed+this.size>this.target.height){for(;s+this.speed+this.size>this.target.height&&this.speed>0;)this.speed*=.5;t.fillStyle=o.flakeColor,void 0==n[parseInt(e)][parseInt(s+this.speed+this.size)]?(n[parseInt(e)][parseInt(s+this.speed+this.size)]=1,t.fillRect(e,s+this.speed+this.size,this.size,this.size)):(n[parseInt(e)][parseInt(s+this.speed)]=1,t.fillRect(e,s+this.speed,this.size,this.size)),this.reset()}else this.speed=1,this.stepSize=0,parseInt(e)+1<this.target.width&&void 0==n[parseInt(e)+1][parseInt(s)+1]?this.x++:parseInt(e)-1>0&&void 0==n[parseInt(e)-1][parseInt(s)+1]?this.x--:(t.fillStyle=o.flakeColor,t.fillRect(e,s,this.size,this.size),n[parseInt(e)][parseInt(s)]=1,this.reset())}(this.x+this.size>d-c||this.x<c)&&this.reset()},this.reset=function(){this.y=0,this.x=h(c,d-c),this.stepSize=h(1,10)/100,this.size=h(100*i.minSize,100*i.maxSize)/100,this.element.style.width=this.size+"px",this.element.style.height=this.size+"px",this.speed=h(i.minSpeed,i.maxSpeed)}}function n(){for(r=0;r<a.length;r+=1)a[r].update();p=requestAnimationFrame(function(){n()})}var a=[],o={flakeCount:35,flakeColor:"#ffffff",flakePosition:"absolute",flakeIndex:999999,minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:!1,shadow:!1,collection:!1,collectionHeight:40,deviceorientation:!1},i=t.extend(o,i),h=function(t,e){return Math.round(t+Math.random()*(e-t))};t(e).data("snowfall",this);var r=0,l=t(e).height(),d=t(e).width(),c=0,p=0;if(i.collection!==!1){var f=document.createElement("canvas");if(f.getContext&&f.getContext("2d"))for(var m=[],w=t(i.collection),g=i.collectionHeight,r=0;r<w.length;r++){var u=w[r].getBoundingClientRect(),x=t("<canvas/>",{"class":"snowfall-canvas"}),z=[];if(u.top-g>0){t("body").append(x),x.css({position:i.flakePosition,left:u.left+"px",top:u.top-g+"px"}).prop({width:u.width,height:g});for(var v=0;v<u.width;v++)z[v]=[];m.push({element:x.get(0),x:u.left,y:u.top-g,width:u.width,height:g,colData:z})}}else i.collection=!1}for(t(e).get(0).tagName===t(document).get(0).tagName&&(c=25),t(window).bind("resize",function(){l=t(e)[0].clientHeight,d=t(e)[0].offsetWidth}),r=0;r<i.flakeCount;r+=1)a.push(new s(h(c,d-c),h(0,l),h(100*i.minSize,100*i.maxSize)/100,h(i.minSpeed,i.maxSpeed)));i.round&&t(".snowfall-flakes").css({"-moz-border-radius":i.maxSize,"-webkit-border-radius":i.maxSize,"border-radius":i.maxSize}),i.shadow&&t(".snowfall-flakes").css({"-moz-box-shadow":"1px 1px 1px #555","-webkit-box-shadow":"1px 1px 1px #555","box-shadow":"1px 1px 1px #555"});var y=!1;i.deviceorientation&&t(window).bind("deviceorientation",function(t){y=.1*t.originalEvent.gamma}),n(),this.clear=function(){t(".snowfall-canvas").remove(),t(e).children(".snowfall-flakes").remove(),cancelAnimationFrame(p)}},t.fn.snowfall=function(e){return"object"==typeof e||void 0==e?this.each(function(i){new t.snowfall(this,e)}):"string"==typeof e?this.each(function(e){var i=t(this).data("snowfall");i&&i.clear()}):void 0}}(jQuery);
(function () {
'use strict';
try {
if (!Array.isArray(window.__modssConsoleBuf)) window.__modssConsoleBuf = [];
window.__modssConsoleOnCall = function (method, args) {
try {
var buf = window.__modssConsoleBuf;
if (!Array.isArray(buf)) { buf = []; window.__modssConsoleBuf = buf; }
var list = args && typeof args.length === 'number' ? Array.prototype.slice.call(args) : [];
var line = list.map(function (a) {
if (a == null) return String(a);
if (typeof a === 'string' || typeof a === 'number' || typeof a === 'boolean') return String(a);
try { return JSON.stringify(a); } catch (eJ) { return String(a); }
}).join(' ');
buf.push({ t: Date.now(), m: method || 'log', line: line });
while (buf.length > 800) buf.shift();
} catch (eCap) { }
};
window.__modssEnsureConsoleCapture = function () {
try {
if (!Array.isArray(window.__modssConsoleBuf)) window.__modssConsoleBuf = [];
var methods = ['log', 'info', 'warn', 'error', 'debug'];
for (var i = 0; i < methods.length; i++) {
(function (method) {
/** try на каждый метод: на части WebView console.* только для чтения —
* раньше падение на первом методе снимало перехват целиком. */
try {
var cur = console[method];
if (typeof cur !== 'function' || cur.__modssCap) return;
var orig = cur;
var wrapped = function () {
try { if (typeof window.__modssConsoleOnCall === 'function') window.__modssConsoleOnCall(method, arguments); } catch (e1) { }
try { return orig.apply(console, arguments); } catch (e2) { }
};
wrapped.__modssCap = 1;
console[method] = wrapped;
if (console[method] !== wrapped) {
Object.defineProperty(console, method, { value: wrapped, configurable: true, writable: true });
}
} catch (eM) {
window.__modssConsoleCaptureError = String((eM && eM.message) || eM).slice(0, 200);
}
})(methods[i]);
}
window.__modssConsoleCapture = !!(typeof console.log === 'function' && console.log.__modssCap);
} catch (eEns) {
window.__modssConsoleCaptureError = String((eEns && eEns.message) || eEns).slice(0, 200);
}
};
window.__modssEnsureConsoleCapture();
setInterval(window.__modssEnsureConsoleCapture, 1000);
} catch (eBootCap) { }
var pluginSetup = {
urlKey: function (url) {
return String(url == null ? '' : url).trim().toLowerCase().replace(/^https?:\/\//, '').replace(/\/+$/, '');
},
accountPluginKeys: function (done) {
Lampa.Account.Api.plugins(function (items) {
var keys = [];
for (var i = 0; i < (items || []).length; i++) {
var key = Number(items[i].status) === 1 ? pluginSetup.urlKey(items[i].url) : '';
if (key) keys.push(key);
}
done(keys);
});
},
detectShell: function () {
var ua = String(navigator.userAgent || '').toLowerCase();
if (typeof webapis !== 'undefined' && typeof tizen !== 'undefined') return 'tizen';
if (typeof webOS !== 'undefined' && webOS.platform && webOS.platform.tv === true) return 'webos';
if (window.TVXHost || window.TVXManager) return 'msx';
if (ua.indexOf('tizen') !== -1 || ua.indexOf('webos') !== -1 || ua.indexOf('web0s') !== -1) return 'msx';
if (Lampa.Platform.is('apple_tv')) return 'apple_tv';
if (Lampa.Utils.isPWA && Lampa.Utils.isPWA()) return 'pwa';
return '';
},
baseDeviceId: function (value) {
return String(value == null ? '' : value).trim().replace(/_(?:pwa|msx|apple_tv|tizen|webos)$/, '');
},
taggedDeviceId: function (value) {
var base = pluginSetup.baseDeviceId(value);
var shell = pluginSetup.detectShell();
return base && shell ? base + '_' + shell : base;
},
saveDeviceId: function (value) {
var deviceId = pluginSetup.taggedDeviceId(value);
if (deviceId && deviceId !== Lampa.Storage.get('modss_device_id', '')) {
Lampa.Storage.set('modss_device_id', deviceId);
}
return deviceId;
},
resolveDeviceId: function (issuedId) {
var cached = Lampa.Storage.get('modss_device_id', '');
return cached ? pluginSetup.saveDeviceId(cached) : pluginSetup.taggedDeviceId(issuedId);
},
syncDeviceId: function (issuedId, onReady) {
var attempts = 0;
var tick = function () {
var cached = Lampa.Storage.get('modss_device_id', '');
if ((!cached || !pluginSetup.detectShell()) && attempts++ < 15) return setTimeout(tick, 100);
if (typeof onReady === 'function') onReady(pluginSetup.saveDeviceId(cached || issuedId));
};
tick();
},
shell: function () {
return pluginSetup.detectShell() || Lampa.Platform.get();
},
deviceKind: function (base) {
var kind = String(base || 'other');
var shell = pluginSetup.shell();
if (!shell || kind.indexOf('_') !== -1) return kind;
return kind + '_' + shell;
},
logDevice: function (base, issuedId, onChange) {
pluginSetup.syncDeviceId(issuedId, function (deviceId) {
if (deviceId && typeof onChange === 'function') onChange(deviceId);
console.log('Modss', 'device', '[' + pluginSetup.deviceKind(base) + ']');
});
},
cleanPluginList: function (liveUrls, deadUrls) {
pluginSetup.accountPluginKeys(function (accountKeys) {
pluginSetup.applyPluginList(liveUrls, deadUrls, accountKeys);
});
},
applyPluginList: function (liveUrls, deadUrls, accountKeys) {
try {
var plugins = Lampa.Plugins.get();
var accountHasLive = false;
var remove = [];
var live = [];
var changed = false;
for (var a = 0; a < liveUrls.length; a++) {
if (accountKeys.indexOf(liveUrls[a]) !== -1) accountHasLive = true;
}
for (var i = 0; i < plugins.length; i++) {
var plugin = plugins[i];
var key = pluginSetup.urlKey(plugin.url);
if (deadUrls.indexOf(key) !== -1) {
remove.push({ plugin: plugin, reason: 'dead' });
continue;
}
if (liveUrls.indexOf(key) === -1) continue;
if (accountHasLive) remove.push({ plugin: plugin, reason: 'cub' });
else live.push({ plugin: plugin, key: key });
}
var keep = null;
for (var k = 0; k < live.length; k++) {
if (keep === null || liveUrls.indexOf(live[k].key) < liveUrls.indexOf(keep.key)) keep = live[k];
}
for (var d = 0; d < live.length; d++) {
if (live[d] !== keep) remove.push({ plugin: live[d].plugin, reason: 'dup' });
}
if (keep && String(keep.plugin.descr || '').trim() !== '') {
keep.plugin.descr = '';
keep.plugin.name = "MODS's";
changed = true;
}
for (var r = 0; r < remove.length; r++) {
if (!keep && !accountHasLive && r === 0) {
keep = { plugin: remove[r].plugin, key: liveUrls[0] };
keep.plugin.url = (window.location.protocol === 'https:' ? 'https://' : 'http://') + liveUrls[0];
changed = true;
console.log('Modss', 'plugin url', 'moved to ' + keep.plugin.url);
continue;
}
console.log('Modss', 'plugin url', 'removed [' + remove[r].reason + '] ' + remove[r].plugin.url);
Lampa.Plugins.remove(remove[r].plugin);
}
if (changed) Lampa.Plugins.save();
} catch (eClean) {
console.error('Modss', 'plugin url', 'clean error', eClean && eClean.message ? eClean.message : String(eClean));
}
}
};
var Protocol = function Protocol() {
return window.location.protocol == 'https:' ? 'https://' : 'http://';
}
var TRASH_R = ['$$$####!!!!!!!', '^^^^^^##@', '@!^^!@#@@$$$$$', '^^#@@!!@#!$', '@#!@@@##$$@@'];
var version_modss = '3.4.4', API = Protocol() + 'api.lampa.stream/', type = '', jackets = {}, cards, ping_auth, manifest, menu_list = [], vip = false, leftVipD = '', user_id = '', uid = '9f1c933cf85ae1ac7df7f332c_9d8ef5d9e88eb7c443bd2751', IP, logged = undefined, cashe = encodeURIComponent(Lampa.Base64.encode(window.location.origin));
var device_id = pluginSetup.resolveDeviceId('b546aae137ce4d0421cccb77ff745878');
var urls = [
Protocol() + 'lampa.stream/modss',
Protocol() + 'modss.tv'
];
console.log('Modss', 'protocol:', Protocol());
console.log('Modss', 'origin', window.location.origin);
console.log('Modss', 'plugin', '[VERSION] ' + version_modss);
pluginSetup.logDevice("other", device_id, function (next) {
device_id = next;
if (requestData) requestData.device_id = next;
});
console.log('Modss', 'init', 'LOADED - RU [85.234.8.237] - [GET] ' + urls[0]);
window.loaded_modss = true;
var network = new Lampa.Reguest();
var currentUrlIndex = 0;
var loadErrors = [];
var requestData = {
user_id: user_id,
uid: uid,
ips: '85.234.8.237',
cas: cashe,
cache: false,
id: '',
or: 'dW5kZWZpbmVk',
auth: logged,
device_id: device_id
};
function tryNextUrl() {
if (currentUrlIndex >= urls.length) {
var statusCodes = loadErrors.map(function(e) { return String(e.status != null ? e.status : '?'); }).join(', ');
console.log('Modss', 'init', 'RU [85.234.8.237] - все URL недоступны. Статусы ответов:', statusCodes, loadErrors);
Lampa.Noty.show('RU [85.234.8.237] - MODSs ОШИБКА ЗАГРУЗКИ ПЛАГИНА -> все серверы недоступны.<br>Статусы: ' + (statusCodes || '—') + '<br>Lampa: ' + window.location.origin, {time: 10000});
window.loaded_modss = false;
return;
}
var currentUrl = urls[currentUrlIndex];
var attemptNumber = currentUrlIndex + 1;
console.log('Modss', 'init', '[POST] Попытка ' + attemptNumber + '/' + urls.length + ' - загрузки:', currentUrl);
if(attemptNumber > 1) Lampa.Noty.show('Modss - init [POST] Попытка ' + attemptNumber + '/' + urls.length + ' - загрузки: ' + currentUrl, {time: 6000});
network.timeout(10000);
network.silent(currentUrl, function(json) {
try {
console.log('Modss', 'push', 'START - ' + currentUrl);
eval(json + '//# sourceURL='+window.location.origin+'/plugin_modss.js');
window.loaded_modss = true;
} catch (error) {
Lampa.Noty.show('MODSs ОШИБКА ЗАГРУЗКИ -> ' + error.message);
console.log('Modss', 'init', 'ERROR - ' + currentUrl, error.message);
console.error('Ошибка выполнения кода:', error);
currentUrlIndex++;
tryNextUrl();
}
}, function(a, c) {
var errMsg = network.errorDecode(a, c);
var statusNum = typeof a === 'number' ? a : (a && (a.status !== undefined ? a.status : (a.statusCode !== undefined ? a.statusCode : null)));
if (statusNum === undefined || statusNum === null) statusNum = '?';
loadErrors.push({ url: currentUrl, status: statusNum, message: errMsg || '' });
console.log('Modss', 'init', 'RU [85.234.8.237] - load get plugin error - [POST] ' + currentUrl, 'status:', statusNum, errMsg);
if (statusNum === 444 || statusNum === 403) {
console.error('Modss', 'init', 'ERROR - BLOCKED (status ' + statusNum + ')');
Lampa.Noty.show('MODSs BLOCKED — ' + (errMsg || statusNum), {time: 8000});
window.loaded_modss = false;
return;
}
currentUrlIndex++;
tryNextUrl();
}, requestData, {
dataType: 'text'
});
}
tryNextUrl();
})();
}
+3507
View File
File diff suppressed because it is too large Load Diff
+5
View File
@@ -0,0 +1,5 @@
(function () {
'use strict';
Lampa.Storage.set('is_true_mobile', 'false');
})();
+14948
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+536
View File
@@ -0,0 +1,536 @@
(function () {
'use strict';
function translate() {
Lampa.Lang.add({
lme_parser: {
ru: 'Каталог парсеров',
en: 'Parsers catalog',
uk: 'Каталог парсерів',
zh: '解析器目录' // Chinese translation
},
lme_parser_description: {
ru: 'Нажмите для выбора парсера из ',
en: 'Click to select a parser from the ',
uk: 'Натисніть для вибору парсера з ',
zh: '单击以从可用的 '
},
lme_parser_current: {
ru: 'Текущий выбор:',
en: 'Current selection:',
uk: 'Поточний вибір:',
zh: '当前选择:'
},
lme_parser_selected: {
ru: 'Выбрано',
en: 'Selected',
uk: 'Обрано',
zh: '已选择'
},
lme_parser_refresh: {
ru: 'Обновить проверку',
en: 'Refresh check',
uk: 'Оновити перевірку',
zh: '刷新检测'
},
lme_parser_none: {
ru: 'Не выбран',
en: 'Not selected',
uk: 'Не вибрано',
zh: '未选择'
},
lme_parser_none_description: {
ru: 'Без активного парсера',
en: 'No active parser',
uk: 'Без активного парсера',
zh: '未启用解析器'
},
lme_parser_health: {
ru: 'Индикация состояния парсеров',
en: 'Parser health indicator',
uk: 'Індикація стану парсерів',
zh: '解析器状态指示'
},
lme_parser_status_ok: {
ru: 'Доступен',
en: 'Available',
uk: 'Доступний',
zh: '可用'
},
lme_parser_status_auth: {
ru: 'Ошибка ключа',
en: 'Auth error',
uk: 'Помилка ключа',
zh: '密钥错误'
},
lme_parser_status_network: {
ru: 'Недоступен',
en: 'Unavailable',
uk: 'Недоступний',
zh: '不可用'
},
lme_parser_status_unknown: {
ru: 'Не проверен',
en: 'Unchecked',
uk: 'Не перевірено',
zh: '未检查'
},
lme_parser_status_checking: {
ru: 'Проверка...',
en: 'Checking...',
uk: 'Перевірка...',
zh: '检查中...'
},
lme_pubtorr: {
ru: 'Каталог TorrServer',
en: 'TorrServer catalog',
uk: 'Каталог TorrServer',
zh: '解析器目录' // Chinese translation
},
lme_pubtorr_description: {
ru: 'Бесплатные серверы от проекта LME',
en: 'Free servers from the LME project',
uk: 'Безкоштовні сервери від проєкту LME',
zh: '来自 LME 项目的免费服务器 '
},
lme_pubtorr_firstrun: {
"ru": "Привет! Ты установил плагин LME PubTorr, учти что если стоит Mods's то в разделе парсеров будет ошибка, которая не влияет на работу. Хочешь избавиться - оставь или LME PubTorr или Mods's.",
"en": "Hello! You have installed the LME PubTorr plugin. Note that if Mods's is enabled, there will be an error in the parsers section that does not affect functionality. If you want to get rid of it, keep either LME PubTorr or Mods's.",
"uk": "Привіт! Ви встановили плагін LME PubTorr, врахуйте, що якщо активовано Mods's, то в розділі парсерів буде помилка, яка не впливає на роботу. Якщо хочете позбутися - залиште або LME PubTorr, або Mods's.",
"zh": "你好!你安装了LME PubTorr插件,请注意,如果启用了Mods's,解析器部分将出现错误,但这不会影响功能。如果你想摆脱它,请保留LME PubTorr或Mods's。"
}
});
}
var Lang = {
translate: translate
};
var parsersInfo = [{
id: 'lampa_app',
name: 'Lampa.app',
settings: {
url: 'lampa.app',
key: '',
parser_torrent_type: 'jackett'
}
}, {
id: 'jacred_viewbox_dev',
name: 'Viewbox',
settings: {
url: 'jacred.viewbox.dev',
key: 'viewbox',
parser_torrent_type: 'jackett'
}
}, {
id: 'unknown',
name: 'Unknown',
settings: {
url: '188.119.113.252:9117',
key: '1',
parser_torrent_type: 'jackett'
}
}, {
id: 'trs_my_to',
name: 'Trs.my.to',
settings: {
url: 'trs.my.to:9118',
key: '',
parser_torrent_type: 'jackett'
}
}, {
id: 'jacred_my_to',
name: 'Jacred.my.to',
settings: {
url: 'jacred.my.to',
key: '',
parser_torrent_type: 'jackett'
}
}, {
id: 'jacred',
name: 'Jac.red',
settings: {
url: 'jac.red',
key: '',
parser_torrent_type: 'jackett'
}
}, {
id: 'JaCred_su',
name: 'JacRed.su',
settings: {
url: 'jacred.su',
key: '',
parser_torrent_type: 'jackett'
}
}, {
id: 'jac_red_ru',
name: 'jac-red.ru',
settings: {
url: 'jac-red.ru',
key: '',
parser_torrent_type: 'jackett'
}
}];
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
return n;
}
function _arrayWithoutHoles(r) {
if (Array.isArray(r)) return _arrayLikeToArray(r);
}
function _defineProperty(e, r, t) {
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[r] = t, e;
}
function _iterableToArray(r) {
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function ownKeys(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function (r) {
return Object.getOwnPropertyDescriptor(e, r).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread2(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
_defineProperty(e, r, t[r]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
});
}
return e;
}
function _toConsumableArray(r) {
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
}
function _toPrimitive(t, r) {
if ("object" != typeof t || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != typeof i) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == typeof i ? i : i + "";
}
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r) return _arrayLikeToArray(r, a);
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
}
}
var STATUS = {
ok: 'ok',
authError: 'auth_error',
networkError: 'network_error',
unknown: 'unknown',
checking: 'checking'
};
var cache = {
data: {},
TTL: 10 * 60 * 1000,
get: function get(key) {
var cached = this.data[key];
if (cached && Date.now() < cached.expiresAt) return cached;
return null;
},
set: function set(key, value) {
this.data[key] = _objectSpread2(_objectSpread2({}, value), {}, {
expiresAt: Date.now() + this.TTL
});
}
};
function getProtocol() {
if (Lampa.Utils && typeof Lampa.Utils.protocol === 'function') return Lampa.Utils.protocol();
return location.protocol === 'https:' ? 'https://' : 'http://';
}
function createHealthCheckUrl(parser) {
if (!parser || !parser.settings || !parser.settings.url) return null;
var settings = parser.settings;
var parserType = settings.parser_torrent_type || 'jackett';
var hasProtocol = /^https?:\/\//.test(settings.url);
var protocol = hasProtocol ? '' : getProtocol();
var apiKey = '';
if (parserType === 'prowlarr') apiKey = settings.key || '';else if (settings.url === 'spawn.pp.ua:59117') apiKey = '2';else apiKey = settings.key || '';
var basePath = parserType === 'prowlarr' ? '/api/v1/health' : '/api/v2.0/indexers/status:healthy/results';
return "".concat(protocol).concat(settings.url).concat(basePath, "?apikey=").concat(apiKey);
}
function cacheKey(parserId, url) {
return "".concat(parserId, "::").concat(url);
}
function statusFromXhr(xhr) {
if (!xhr) return STATUS.networkError;
if (xhr.status === 200) return STATUS.ok;
if (xhr.status === 401) return STATUS.authError;
return STATUS.networkError;
}
function checkAlive(parsers) {
if (!Array.isArray(parsers) || !parsers.length) return Promise.resolve({});
var results = {};
var requests = parsers.map(function (parser) {
return new Promise(function (resolve) {
var url = createHealthCheckUrl(parser);
var parserId = parser.id || parser.name || 'unknown';
if (!url) {
results[parserId] = STATUS.unknown;
resolve();
return;
}
var key = cacheKey(parserId, url);
var cached = cache.get(key);
if (cached) {
results[parserId] = cached.status;
resolve();
return;
}
$.ajax({
url: url,
method: 'GET',
timeout: 5000,
success: function success(response, textStatus, xhr) {
var status = statusFromXhr(xhr);
if (xhr.status === 200 || xhr.status === 401) {
cache.set(key, {
status: status
});
}
results[parserId] = status;
resolve();
},
error: function error(xhr) {
results[parserId] = statusFromXhr(xhr);
resolve();
}
});
});
});
return Promise.allSettled(requests).then(function () {
return results;
});
}
var STORAGE_KEY = 'lme_url_two';
var NO_PARSER_ID = 'no_parser';
function getSelectedParserId() {
return Lampa.Storage.get(STORAGE_KEY, NO_PARSER_ID);
}
function getParserById(parserId) {
return parsersInfo.find(function (parser) {
return parser.id === parserId;
});
}
function applySelectedParser() {
var parserId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getSelectedParserId();
var selectedParser = getParserById(parserId);
if (!selectedParser || !selectedParser.settings) {
if (parserId !== NO_PARSER_ID) console.warn('PubTorr', 'parser not found', parserId);
return false;
}
var settings = selectedParser.settings;
var parserType = settings.parser_torrent_type || 'jackett';
Lampa.Storage.set(parserType === 'prowlarr' ? 'prowlarr_url' : 'jackett_url', settings.url);
Lampa.Storage.set(parserType === 'prowlarr' ? 'prowlarr_key' : 'jackett_key', settings.key || '');
Lampa.Storage.set('parser_torrent_type', parserType);
return true;
}
var HEALTH_KEY$1 = 'lme_parser_health';
var STATUS_CLASS = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, STATUS.ok, 'status-ok'), STATUS.authError, 'status-auth-error'), STATUS.networkError, 'status-network-error'), STATUS.unknown, 'status-unknown'), STATUS.checking, 'status-checking');
function statusLabel(status) {
switch (status) {
case STATUS.ok:
return Lampa.Lang.translate('lme_parser_status_ok');
case STATUS.authError:
return Lampa.Lang.translate('lme_parser_status_auth');
case STATUS.networkError:
return Lampa.Lang.translate('lme_parser_status_network');
case STATUS.checking:
return Lampa.Lang.translate('lme_parser_status_checking');
default:
return Lampa.Lang.translate('lme_parser_status_unknown');
}
}
function applyStatus(item, status) {
var classes = Object.values(STATUS_CLASS).join(' ');
item.removeClass(classes);
item.addClass(STATUS_CLASS[status] || STATUS_CLASS[STATUS.unknown]);
item.find('.pubtorr-parser-modal__status').text(statusLabel(status));
}
function applySelection(list, selectedId) {
list.find('.pubtorr-parser-modal__item').removeClass('is-selected');
list.find("[data-parser-id=\"".concat(selectedId, "\"]")).addClass('is-selected');
}
function buildItem(parser) {
var item = $("<div class=\"pubtorr-parser-modal__item selector status-unknown\" data-parser-id=\"".concat(parser.id, "\">\n <div class=\"pubtorr-parser-modal__info\">\n <div class=\"pubtorr-parser-modal__name\">").concat(parser.name, "</div>\n </div>\n <div class=\"pubtorr-parser-modal__status\"></div>\n </div>"));
applyStatus(item, STATUS.unknown);
return item;
}
function updateCurrentLabel(wrapper, selectedId, parsers) {
var current = parsers.find(function (parser) {
return parser.id === selectedId;
});
var label = current ? current.name : Lampa.Lang.translate('lme_parser_none');
wrapper.find('.pubtorr-parser-modal__current-value').text(label);
}
function updateSettingsSelectedLabel(selectedId, parsers) {
var current = parsers.find(function (parser) {
return parser.id === selectedId;
});
var label = current ? current.name : Lampa.Lang.translate('lme_parser_none');
var text = "".concat(Lampa.Lang.translate('lme_parser_selected'), ": ").concat(label);
$('.pubtorr-parser-selected').text(text);
}
function openParserModal() {
var parsers = [{
id: NO_PARSER_ID,
name: Lampa.Lang.translate('lme_parser_none')
}].concat(_toConsumableArray(parsersInfo));
var selectedId = getSelectedParserId();
var modal = $("<div class=\"pubtorr-parser-modal\">\n <div class=\"pubtorr-parser-modal__head\">\n <div class=\"pubtorr-parser-modal__current\">\n <div class=\"pubtorr-parser-modal__current-label\">".concat(Lampa.Lang.translate('lme_parser_current'), "</div>\n <div class=\"pubtorr-parser-modal__current-value\"></div>\n </div>\n <div class=\"pubtorr-parser-modal__actions\">\n <div class=\"pubtorr-parser-modal__action selector\">").concat(Lampa.Lang.translate('lme_parser_refresh'), "</div>\n </div>\n </div>\n <div class=\"pubtorr-parser-modal__list\"></div>\n <div class=\"pubtorr-parser-modal__legend\">\n <div class=\"pubtorr-parser-modal__legend-item status-ok\">").concat(Lampa.Lang.translate('lme_parser_status_ok'), "</div>\n <div class=\"pubtorr-parser-modal__legend-item status-auth-error\">").concat(Lampa.Lang.translate('lme_parser_status_auth'), "</div>\n <div class=\"pubtorr-parser-modal__legend-item status-network-error\">").concat(Lampa.Lang.translate('lme_parser_status_network'), "</div>\n <div class=\"pubtorr-parser-modal__legend-item status-unknown\">").concat(Lampa.Lang.translate('lme_parser_status_unknown'), "</div>\n </div>\n </div>"));
var list = modal.find('.pubtorr-parser-modal__list');
var refreshAction = modal.find('.pubtorr-parser-modal__action');
var healthEnabled = Lampa.Storage.get(HEALTH_KEY$1, true);
parsers.forEach(function (parser) {
var item = buildItem(parser);
item.on('hover:enter', function () {
Lampa.Storage.set(STORAGE_KEY, parser.id);
applySelection(list, parser.id);
updateCurrentLabel(modal, parser.id, parsers);
updateSettingsSelectedLabel(parser.id, parsers);
applySelectedParser(parser.id);
});
list.append(item);
});
applySelection(list, selectedId);
updateCurrentLabel(modal, selectedId, parsers);
updateSettingsSelectedLabel(selectedId, parsers);
var actionableItems = list.find('.pubtorr-parser-modal__item').first();
Lampa.Modal.open({
title: Lampa.Lang.translate('lme_parser'),
html: modal,
size: 'medium',
scroll_to_center: true,
select: actionableItems,
onBack: function onBack() {
Lampa.Modal.close();
Lampa.Controller.toggle('settings_component');
}
});
if (!healthEnabled) {
refreshAction.addClass('hide');
modal.find('.pubtorr-parser-modal__legend').addClass('hide');
return;
}
var parserItems = list.find('.pubtorr-parser-modal__item').not("[data-parser-id=\"".concat(NO_PARSER_ID, "\"]"));
parserItems.each(function () {
applyStatus($(this), STATUS.checking);
});
var runChecks = function runChecks() {
parserItems.each(function () {
applyStatus($(this), STATUS.checking);
});
checkAlive(parsersInfo).then(function (statusMap) {
parserItems.each(function () {
var item = $(this);
var parserId = item.data('parserId');
var status = statusMap[parserId] || STATUS.unknown;
applyStatus(item, status);
});
});
};
refreshAction.on('hover:enter', function () {
runChecks();
});
runChecks();
}
var HEALTH_KEY = 'lme_parser_health';
function parserSetting() {
Lampa.SettingsApi.addParam({
component: 'parser',
param: {
name: 'lme_parser_manage',
type: 'button'
},
field: {
name: Lampa.Lang.translate('lme_parser'),
description: "".concat(Lampa.Lang.translate('lme_parser_description'), " ").concat(parsersInfo.length, "<div class=\"pubtorr-parser-selected\"></div>")
},
onChange: function onChange() {
openParserModal();
},
onRender: function onRender(item) {
var selectedId = Lampa.Storage.get('lme_url_two', 'no_parser');
var current = parsersInfo.find(function (parser) {
return parser.id === selectedId;
});
var label = current ? current.name : Lampa.Lang.translate('lme_parser_none');
item.find('.pubtorr-parser-selected').text("".concat(Lampa.Lang.translate('lme_parser_selected'), ": ").concat(label));
setTimeout(function () {
var parserUse = $('div[data-name="parser_use"]').first();
if (parserUse.length) item.insertAfter(parserUse);
if (Lampa.Storage.field('parser_use')) item.show();else item.hide();
});
}
});
Lampa.SettingsApi.addParam({
component: 'parser',
param: {
name: HEALTH_KEY,
type: 'trigger',
"default": true
},
field: {
name: Lampa.Lang.translate('lme_parser_health')
},
onRender: function onRender(item) {
setTimeout(function () {
var manage = $('div[data-name="lme_parser_manage"]').first();
if (manage.length) item.insertAfter(manage);
if (Lampa.Storage.field('parser_use')) item.show();else item.hide();
});
}
});
}
var Parser = {
parserSetting: parserSetting
};
Lampa.Platform.tv();
function add() {
Lang.translate();
Lampa.Template.add('pubtorr_style', "\n <style>\n .pubtorr-parser-modal{--pubtorr-status-ok:#19c37d;--pubtorr-status-auth:#ff4d4f;--pubtorr-status-network:#ff4d4f;--pubtorr-status-unknown:#8c8c8c;--pubtorr-status-checking:#f5a623;--pubtorr-selected-border:#fff;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:1em}.pubtorr-parser-modal__head{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;gap:1em}.pubtorr-parser-modal__current-label{font-size:.9em;opacity:.7}.pubtorr-parser-modal__current-value{font-size:1.1em}.pubtorr-parser-modal__action{padding:.5em .9em;-webkit-border-radius:.6em;border-radius:.6em;background:rgba(255,255,255,0.1);border:1px solid rgba(255,255,255,0.2)}.pubtorr-parser-modal__action.focus{border-color:var(--pubtorr-selected-border)}.pubtorr-parser-modal__list{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:.6em}.pubtorr-parser-modal__item{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;gap:1em;padding:.8em 1em .8em 1.8em;-webkit-border-radius:.7em;border-radius:.7em;background:rgba(255,255,255,0.05);border:1px solid rgba(255,255,255,0.08)}.pubtorr-parser-modal__item::before{content:'';position:absolute;left:.8em;top:50%;width:.55em;height:.55em;-webkit-border-radius:50%;border-radius:50%;background:var(--pubtorr-status-color,var(--pubtorr-status-unknown));-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);-webkit-box-shadow:0 0 .6em rgba(0,0,0,0.3);box-shadow:0 0 .6em rgba(0,0,0,0.3)}.pubtorr-parser-modal__item.is-selected,.pubtorr-parser-modal__item.focus{border-color:var(--pubtorr-selected-border)}.pubtorr-parser-modal__info{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:.25em;min-width:0}.pubtorr-parser-modal__name{font-size:1em}.pubtorr-parser-modal__status{font-size:.8em;opacity:.7;text-align:right;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center}.pubtorr-parser-modal__legend{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:.8em 1.2em;font-size:.85em;opacity:.7}.pubtorr-parser-modal__legend-item{position:relative;padding-left:1.2em}.pubtorr-parser-modal__legend-item::before{content:'';position:absolute;left:0;top:.55em;width:.5em;height:.5em;-webkit-border-radius:50%;border-radius:50%;background:var(--pubtorr-status-color,var(--pubtorr-status-unknown))}.pubtorr-parser-modal__item.status-ok,.pubtorr-parser-modal__legend-item.status-ok{--pubtorr-status-color:var(--pubtorr-status-ok)}.pubtorr-parser-modal__item.status-auth-error,.pubtorr-parser-modal__legend-item.status-auth-error{--pubtorr-status-color:var(--pubtorr-status-auth)}.pubtorr-parser-modal__item.status-network-error,.pubtorr-parser-modal__legend-item.status-network-error{--pubtorr-status-color:var(--pubtorr-status-network)}.pubtorr-parser-modal__item.status-unknown,.pubtorr-parser-modal__legend-item.status-unknown{--pubtorr-status-color:var(--pubtorr-status-unknown)}.pubtorr-parser-modal__item.status-checking{--pubtorr-status-color:var(--pubtorr-status-checking)}@media(max-width:600px){.pubtorr-parser-modal__head{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start}.pubtorr-parser-modal__item{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start}.pubtorr-parser-modal__status{text-align:left}}\n </style>\n ");
$('body').append(Lampa.Template.get('pubtorr_style', {}, true));
Parser.parserSetting();
}
function startPlugin() {
window.plugin_lmepublictorr_ready = true;
if (window.appready) add();else {
Lampa.Listener.follow('app', function (e) {
if (e.type === 'ready') add();
});
}
}
if (!window.plugin_lmepublictorr_ready) startPlugin();
})();
+325
View File
@@ -0,0 +1,325 @@
(function () {
'use strict';
function startsWith(str, searchString) {
return str.lastIndexOf(searchString, 0) === 0;
}
function endsWith(str, searchString) {
var start = str.length - searchString.length;
if (start < 0) return false;
return str.indexOf(searchString, start) === start;
}
function salt(input) {
var str = (input || '') + '';
var hash = 0;
for (var i = 0; i < str.length; i++) {
var c = str.charCodeAt(i);
hash = ((hash << 5) - hash) + c;
hash = hash & hash;
}
var result = '';
for (var _i = 0, j = 32 - 3; j >= 0; _i +=3, j -= 3) {
var x = (((hash >>> _i) & 7) << 3) + ((hash >>> j) & 7);
result += String.fromCharCode(x < 26 ? 97 + x : x < 52 ? 39 + x : x - 4);
}
return result;
}
function decodeSecret(input, password) {
var result = '';
password = (password || '') + '';
if (input && password) {
var hash = salt('123456789' + password);
while (hash.length < input.length) {
hash += hash;
}
var i = 0;
while (i < input.length) {
result += String.fromCharCode(input[i] ^ hash.charCodeAt(i));
i++;
}
}
return result;
}
function isDebug() {
var res = false;
var origin = window.location.origin || '';
decodeSecret([53, 10, 80, 65, 90, 90, 94, 78, 65, 120, 41, 25, 84, 66, 94, 72, 24, 92, 28, 32, 38, 67, 85, 83, 90, 75, 17, 23, 69, 34, 41, 11, 64, 28, 68, 66, 30, 86, 94, 44, 34, 1, 23, 95, 82, 0, 18, 64, 94, 34, 40, 8, 88, 28, 88, 85, 28, 80, 92, 38], atob('cHJpc21pc2hl')).split(';').forEach(function (s) {
res |= endsWith(origin, s);
});
return res;
}
function rating_kp_imdb(card) {
var network = new Lampa.Reguest();
var clean_title = kpCleanTitle(card.title);
var search_date = card.release_date || card.first_air_date || card.last_air_date || '0000';
var search_year = parseInt((search_date + '').slice(0, 4));
var orig = card.original_title || card.original_name;
var kp_prox = '';
var params = {
id: card.id,
url: kp_prox + 'https://kinopoiskapiunofficial.tech/',
rating_url: kp_prox + 'https://rating.kinopoisk.ru/',
headers: {
'X-API-KEY': decodeSecret([85, 4, 115, 118, 107, 125, 10, 70, 85, 67, 82, 14, 32, 110, 102, 43, 9, 19, 85, 73, 4, 83, 33, 110, 52, 44, 92, 21, 72, 22, 87, 1, 118, 32, 100, 127], atob('X0tQM3Bhc3N3b3Jk'))
},
cache_time: 60 * 60 * 24 * 1000 //86400000 сек = 1день Время кэша в секундах
};
getRating();
function getRating() {
var movieRating = _getCache(params.id);
if (movieRating) {
return _showRating(movieRating[params.id]);
} else {
searchFilm();
}
}
function searchFilm() {
var url = params.url;
var url_by_title = Lampa.Utils.addUrlComponent(url + 'api/v2.1/films/search-by-keyword', 'keyword=' + encodeURIComponent(clean_title));
if (card.imdb_id) url = Lampa.Utils.addUrlComponent(url + 'api/v2.2/films', 'imdbId=' + encodeURIComponent(card.imdb_id));
else url = url_by_title;
network.clear();
network.timeout(15000);
network.silent(url, function (json) {
if (json.items && json.items.length) chooseFilm(json.items);
else if (json.films && json.films.length) chooseFilm(json.films);
else if (url !== url_by_title) {
network.clear();
network.timeout(15000);
network.silent(url_by_title, function (json) {
if (json.items && json.items.length) chooseFilm(json.items);
else if (json.films && json.films.length) chooseFilm(json.films);
else chooseFilm([]);
}, function (a, c) {
showError(network.errorDecode(a, c));
}, false, {
headers: params.headers
});
} else chooseFilm([]);
}, function (a, c) {
showError(network.errorDecode(a, c));
}, false, {
headers: params.headers
});
}
function chooseFilm(items) {
if (items && items.length) {
var is_sure = false;
var is_imdb = false;
items.forEach(function (c) {
var year = c.start_date || c.year || '0000';
c.tmp_year = parseInt((year + '').slice(0, 4));
});
if (card.imdb_id) {
var tmp = items.filter(function (elem) {
return (elem.imdb_id || elem.imdbId) == card.imdb_id;
});
if (tmp.length) {
items = tmp;
is_sure = true;
is_imdb = true;
}
}
var cards = items;
if (cards.length) {
if (orig) {
var _tmp = cards.filter(function (elem) {
return containsTitle(elem.orig_title || elem.nameOriginal, orig) || containsTitle(elem.en_title || elem.nameEn, orig) || containsTitle(elem.title || elem.ru_title || elem.nameRu, orig);
});
if (_tmp.length) {
cards = _tmp;
is_sure = true;
}
}
if (card.title) {
var _tmp2 = cards.filter(function (elem) {
return containsTitle(elem.title || elem.ru_title || elem.nameRu, card.title) || containsTitle(elem.en_title || elem.nameEn, card.title) || containsTitle(elem.orig_title || elem.nameOriginal, card.title);
});
if (_tmp2.length) {
cards = _tmp2;
is_sure = true;
}
}
if (cards.length > 1 && search_year) {
var _tmp3 = cards.filter(function (c) {
return c.tmp_year == search_year;
});
if (!_tmp3.length) _tmp3 = cards.filter(function (c) {
return c.tmp_year && c.tmp_year > search_year - 2 && c.tmp_year < search_year + 2;
});
if (_tmp3.length) cards = _tmp3;
}
}
if (cards.length == 1 && is_sure && !is_imdb) {
if (search_year && cards[0].tmp_year) {
is_sure = cards[0].tmp_year > search_year - 2 && cards[0].tmp_year < search_year + 2;
}
if (is_sure) {
is_sure = false;
if (orig) {
is_sure |= equalTitle(cards[0].orig_title || cards[0].nameOriginal, orig) || equalTitle(cards[0].en_title || cards[0].nameEn, orig) || equalTitle(cards[0].title || cards[0].ru_title || cards[0].nameRu, orig);
}
if (card.title) {
is_sure |= equalTitle(cards[0].title || cards[0].ru_title || cards[0].nameRu, card.title) || equalTitle(cards[0].en_title || cards[0].nameEn, card.title) || equalTitle(cards[0].orig_title || cards[0].nameOriginal, card.title);
}
}
}
if (cards.length == 1 && is_sure) {
var id = cards[0].kp_id || cards[0].kinopoisk_id || cards[0].kinopoiskId || cards[0].filmId;
var base_search = function base_search() {
network.clear();
network.timeout(15000);
network.silent(params.url + 'api/v2.2/films/' + id, function (data) {
var movieRating = _setCache(params.id, {
kp: data.ratingKinopoisk,
imdb: data.ratingImdb,
timestamp: new Date().getTime()
}); // Кешируем данные
return _showRating(movieRating);
}, function (a, c) {
showError(network.errorDecode(a, c));
}, false, {
headers: params.headers
});
};
network.clear();
network.timeout(5000);
network["native"](params.rating_url + id + '.xml', function (str) {
if (str.indexOf('<rating>') >= 0) {
try {
var ratingKinopoisk = 0;
var ratingImdb = 0;
var xml = $($.parseXML(str));
var kp_rating = xml.find('kp_rating');
if (kp_rating.length) {
ratingKinopoisk = parseFloat(kp_rating.text());
}
var imdb_rating = xml.find('imdb_rating');
if (imdb_rating.length) {
ratingImdb = parseFloat(imdb_rating.text());
}
var movieRating = _setCache(params.id, {
kp: ratingKinopoisk,
imdb: ratingImdb,
timestamp: new Date().getTime()
}); // Кешируем данные
return _showRating(movieRating);
} catch (ex) {
}
}
base_search();
}, function (a, c) {
base_search();
}, false, {
dataType: 'text'
});
} else {
var movieRating = _setCache(params.id, {
kp: 0,
imdb: 0,
timestamp: new Date().getTime()
}); // Кешируем данные
return _showRating(movieRating);
}
} else {
var _movieRating = _setCache(params.id, {
kp: 0,
imdb: 0,
timestamp: new Date().getTime()
}); // Кешируем данные
return _showRating(_movieRating);
}
}
function cleanTitle(str){
return str.replace(/[\s.,:;’'`!?]+/g, ' ').trim();
}
function kpCleanTitle(str){
return cleanTitle(str).replace(/^[ \/\\]+/, '').replace(/[ \/\\]+$/, '').replace(/\+( *[+\/\\])+/g, '+').replace(/([+\/\\] *)+\+/g, '+').replace(/( *[\/\\]+ *)+/g, '+');
}
function normalizeTitle(str){
return cleanTitle(str.toLowerCase().replace(/[\-\u2010-\u2015\u2E3A\u2E3B\uFE58\uFE63\uFF0D]+/g, '-').replace(/ё/g, 'е'));
}
function equalTitle(t1, t2){
return typeof t1 === 'string' && typeof t2 === 'string' && normalizeTitle(t1) === normalizeTitle(t2);
}
function containsTitle(str, title){
return typeof str === 'string' && typeof title === 'string' && normalizeTitle(str).indexOf(normalizeTitle(title)) !== -1;
}
function showError(error) {
Lampa.Noty.show('Рейтинг KP: ' + error);
}
function _getCache(movie) {
var timestamp = new Date().getTime();
var cache = Lampa.Storage.cache('kp_rating', 500, {}); //500 это лимит ключей
if (cache[movie]) {
if ((timestamp - cache[movie].timestamp) > params.cache_time) {
// Если кеш истёк, чистим его
delete cache[movie];
Lampa.Storage.set('kp_rating', cache);
return false;
}
} else return false;
return cache;
}
function _setCache(movie, data) {
var timestamp = new Date().getTime();
var cache = Lampa.Storage.cache('kp_rating', 500, {}); //500 это лимит ключей
if (!cache[movie]) {
cache[movie] = data;
Lampa.Storage.set('kp_rating', cache);
} else {
if ((timestamp - cache[movie].timestamp) > params.cache_time) {
data.timestamp = timestamp;
cache[movie] = data;
Lampa.Storage.set('kp_rating', cache);
} else data = cache[movie];
}
return data;
}
function _showRating(data) {
if (data) {
var kp_rating = !isNaN(data.kp) && data.kp !== null ? parseFloat(data.kp).toFixed(1) : '0.0';
var imdb_rating = !isNaN(data.imdb) && data.imdb !== null ? parseFloat(data.imdb).toFixed(1) : '0.0';
var render = Lampa.Activity.active().activity.render();
$('.wait_rating', render).remove();
$('.rate--imdb', render).removeClass('hide').find('> div').eq(0).text(imdb_rating);
$('.rate--kp', render).removeClass('hide').find('> div').eq(0).text(kp_rating);
}
}
}
function startPlugin() {
window.rating_plugin = true;
if (isDebug()) return;
Lampa.Listener.follow('full', function (e) {
if (e.type == 'complite') {
var render = e.object.activity.render();
if ($('.rate--kp', render).hasClass('hide') && !$('.wait_rating', render).length) {
$('.info__rate', render).after('<div style="width:2em;margin-top:1em;margin-right:1em" class="wait_rating"><div class="broadcast__scan"><div></div></div><div>');
rating_kp_imdb(e.data.movie);
}
}
});
}
if (!window.rating_plugin) startPlugin();
})();
+250
View File
File diff suppressed because one or more lines are too long
+5
View File
@@ -0,0 +1,5 @@
(function () {
'use strict';
Lampa.Storage.set('webos_subs_params','{}');
})();
+399
View File
@@ -0,0 +1,399 @@
(function () {
//BDVBuriлk.github.io
//2025
("use strict");
let year;
let namemovie;
let savedHTML = null;
function getSettings() {
let host = (Lampa.Storage.get('rezka_comment_host', 'https://rezka.ag') || 'https://rezka.ag').trim().replace(/\/+$/, '');
let cookie = (Lampa.Storage.get('rezka_comment_cookie', '') || '').trim();
let proxy = (Lampa.Storage.get('rezka_comment_proxy', 'https://worker-patient-dream-26d8.bdvburik.workers.dev:8443/') || 'https://worker-patient-dream-26d8.bdvburik.workers.dev:8443/').trim();
if (proxy && !proxy.endsWith('/')) {
proxy += '/';
}
return { host, cookie, proxy };
}
// Функция для поиска на сайте hdrezka
async function searchRezka(name, ye) {
try {
let { host, cookie, proxy } = getSettings();
let path = host + "/search/?do=search&subaction=search&q=" + encodeURIComponent(name) + (ye ? "+" + ye : "");
let searchUrl = proxy;
if (cookie) {
searchUrl += "param/Cookie=" + encodeURIComponent(cookie) + "/";
}
searchUrl += path;
console.log('[RezkaComment] searching hdrezka with url:', searchUrl);
let fc = await fetch(searchUrl, {
method: "GET",
headers: { "Content-Type": "text/html" }
}).then((response) => {
if (!response.ok) {
throw new Error('HTTP status ' + response.status);
}
return response.text();
});
let dom = new DOMParser().parseFromString(fc, "text/html");
const item = dom.querySelector(".b-content__inline_item");
if (!item) {
console.warn('[RezkaComment] show not found on Rezka:', name, ye);
if (fc.indexOf("Проверяем, что вы не бот") !== -1 || fc.indexOf("Anubis") !== -1) {
Lampa.Noty.show('Защита от ботов на Rezka. Настройте Cookie в настройках плагина.');
} else {
Lampa.Noty.show('Фильм/сериал не найден на Rezka');
}
Lampa.Loading.stop();
return;
}
namemovie =
item.querySelector(".b-content__inline_item-link")?.innerText || "";
let itemUrl = item.querySelector(".b-content__inline_item-link")?.getAttribute("href") || "";
await comment_rezka(item.dataset.id, itemUrl);
} catch (e) {
console.error('[RezkaComment] searchRezka error:', e);
Lampa.Noty.show('Ошибка поиска на Rezka: ' + e.message);
Lampa.Loading.stop();
}
}
// Функция для получения английского названия фильма или сериала
async function getEnTitle(id, type) {
try {
var tmdbType = type === 'movie' ? 'movie' : 'tv';
var tmdbCacheKey = tmdbType + '_' + id;
// Спочатку перевіряємо спільний кеш (заповнює title.js)
window.__tmdbTranslationsCache = window.__tmdbTranslationsCache || {};
var cachedTr = window.__tmdbTranslationsCache[tmdbCacheKey];
var tr;
if (cachedTr) {
console.log('[RezkaComment] using shared translations cache for', tmdbCacheKey);
tr = cachedTr;
} else {
const data = await new Promise((res, rej) =>
Lampa.Api.sources.tmdb.get(
`${tmdbType}/${id}?append_to_response=translations`,
{},
res,
rej,
),
);
tr = data.translations?.translations || [];
window.__tmdbTranslationsCache[tmdbCacheKey] = tr;
}
const enTranslation = tr.find((t) => t.iso_3166_1 === 'US' || t.iso_639_1 === 'en');
const enTitle = enTranslation?.data?.title || enTranslation?.data?.name;
if (enTitle) {
await searchRezka(normalizeTitle(enTitle), year);
} else {
console.warn('[RezkaComment] English title not found for', tmdbCacheKey, tr);
Lampa.Noty.show('Английское название не найдено');
Lampa.Loading.stop();
}
} catch (e) {
console.error('[RezkaComment] TMDB error', e);
Lampa.Noty.show('Ошибка получения данных TMDB');
Lampa.Loading.stop();
}
}
// Функция для очистки заголовка от лишних символов
function cleanTitle(str) {
return str.replace(/[\s.,:;’'`!?]+/g, " ").trim();
}
// Функция для нормализации заголовка
function normalizeTitle(str) {
return cleanTitle(
str
.toLowerCase()
.replace(/[\-\u2010-\u2015\u2E3A\u2E3B\uFE58\uFE63\uFF0D]+/g, "-")
.replace(/ё/g, "е"),
);
}
// Создаёт один комментарий
function buildCommentNode(item) {
const q = (s) => item.querySelector(s);
const avatar = q(".ava img")?.dataset.src || q(".ava img")?.src || "";
const user = q(".name, .b-comment__user")?.innerText || "Без имени";
const date = q(".date, .b-comment__time")?.innerText || "";
const text = q(".message .text, .text")?.innerHTML || "";
const wrapper = document.createElement("div");
wrapper.className = "message";
wrapper.innerHTML = `
<div class="comment-wrap">
<div class="avatar-column">
<img src="${avatar}" class="avatar-img" alt="${user}">
</div>
<div class="comment-card">
<div class="comment-header">
<span class="name">${user}</span>
<span class="date">${date}</span>
</div>
<div class="comment-text">
<div class="text">${text}</div>
</div>
</div>
</div>
`;
return wrapper;
}
// Рекурсивно строит дерево
function buildTree(root) {
const fragment = document.createDocumentFragment();
for (let li of root.children) {
const indent = parseInt(li.dataset.indent || 0, 10);
const wrapper = document.createElement("li");
wrapper.className = "comments-tree-item";
wrapper.style.marginLeft = indent > 0 ? "20px" : "0";
wrapper.appendChild(buildCommentNode(li));
const childrenList = li.querySelector("ol.comments-tree-list");
if (childrenList) wrapper.appendChild(buildTree(childrenList));
fragment.appendChild(wrapper);
}
return fragment;
}
// === Основная обработка комментариев Rezka с storage на сутки ===
async function comment_rezka(id, pageUrl) {
try {
let { host, cookie, proxy } = getSettings();
let t = Date.now();
let path = host + "/ajax/get_comments/?t=" + t + "&news_id=" + (id ? id : "1") + "&cstart=1&type=0&comment_id=0&skin=hdrezka";
let commentsUrl = proxy;
if (cookie) {
commentsUrl += "param/Cookie=" + encodeURIComponent(cookie) + "/";
}
if (pageUrl) {
commentsUrl += "param/Referer=" + encodeURIComponent(pageUrl) + "/";
}
commentsUrl += path;
console.log('[RezkaComment] fetching comments from:', commentsUrl);
let fc = await fetch(commentsUrl, {
method: "GET",
headers: { "Content-Type": "text/plain" },
}).then((r) => {
if (!r.ok) {
throw new Error('HTTP status ' + r.status);
}
return r.text();
});
// Check if the response is actually HTML challenge instead of JSON
if (fc.indexOf("Проверяем, что вы не бот") !== -1 || fc.indexOf("Anubis") !== -1) {
Lampa.Noty.show('Защита от ботов на Rezka. Настройте Cookie в настройках плагина.');
Lampa.Loading.stop();
return;
}
let json = JSON.parse(fc);
if (!json || !json.comments) {
throw new Error('Пустой ответ от сервера комментариев');
}
let dom = new DOMParser().parseFromString(json.comments, "text/html");
dom
.querySelectorAll(".actions, i, .share-link")
.forEach((elem) => elem.remove());
let rootList = dom.querySelector(".comments-tree-list");
if (!rootList) {
console.warn('[RezkaComment] comments-tree-list not found in parsed HTML for', id);
Lampa.Noty.show('Комментарии к фильму/сериалу отсутствуют');
Lampa.Loading.stop();
return;
}
let newTree = buildTree(rootList);
openModal(newTree);
} catch (e) {
console.error('[RezkaComment] comment_rezka error:', e);
Lampa.Noty.show('Ошибка получения комментариев: ' + e.message);
Lampa.Loading.stop();
}
function openModal(treeContent) {
Lampa.Loading.stop();
let modal = $(
`<div><div class="broadcast__text" style="text-align:left;"><div class="comment"></div></div></div>`,
);
modal.find(".comment").append(treeContent);
// Стили модалки (если ещё не добавлены)
if (!document.getElementById("rezka-comment-style")) {
const styleEl = document.createElement("style");
styleEl.id = "rezka-comment-style";
styleEl.textContent = `
.comments-tree-list{list-style:none;margin:0;padding:0;}
.comments-tree-item{list-style:none;margin:0;padding:0;}
.comment-wrap{display:flex;margin-bottom:5px;}
.avatar-column{margin-right:10px;}
.avatar-img{width:48px;height:48px;border-radius:4px;}
.comment-card{background:#1b1b1b;padding:5px 12px;border-radius:6px;border:1px solid #2a2a2a;width:100%;}
.comment-header{display:flex;justify-content:space-between;margin-bottom:6px;}
.comment-header .name{font-weight:600;color:#fff;}
.comment-header .date{opacity:.7;font-size:11px;}
.comment-text .text{color:#ddd;line-height:1.45;}
.rc-children{margin-left:30px;border-left:1px solid #333;padding-left:14px;}
.title_spoiler{display:inline-flex;align-items:center;background:#2a2a2a;border-radius:6px;padding:1px 4px;margin:0 2px;font-size:13px;color:#e0e0e0;cursor:pointer;box-shadow:0 0 2px rgba(0,0,0,.4);}
.title_spoiler a{color:#e0e0e0!important;text-decoration:none!important;}
.title_spoiler img{height:14px;width:auto;vertical-align:middle;margin:0 2px;}
.title_spoiler .attention{height:14px;width:14px;margin-left:4px;vertical-align:middle;}
.modal-close-btn{background:#2a2a2a;border:1px solid #444;color:#ddd;border-radius:6px;font-size:18px;line-height:18px;cursor:pointer;transition:.15s;}
.modal-close-btn:hover{background:#3a3a3a;color:#fff;}
`;
document.head.appendChild(styleEl);
}
if (!window.rezkaSpoilerInit) {
window.rezkaSpoilerInit = true;
const Script = document.createElement("script");
Script.textContent =
"function ShowOrHide(id){var t=$('#'+id);t.prev('.title_spoiler').remove();t.css('display','inline');}";
document.head.appendChild(Script);
}
Lampa.Modal.open({
title: ``,
html: modal,
size: "large",
style: "margin-top:10px;",
mask: true,
onBack: function () {
Lampa.Modal.close();
$(".modal--large").remove();
Lampa.Controller.toggle("content");
},
});
document
.querySelector(".modal__head")
?.insertAdjacentHTML(
"afterend",
`<button class="modal-close-btn selector" onclick="$('.modal--large').remove()">&times;</button> ${namemovie}`,
);
}
}
// Функция для начала работы плагина
function startPlugin() {
window.comment_plugin = true;
try {
// Регистрация настроек
Lampa.SettingsApi.addComponent({
component: 'rezka_comment',
name: 'Rezka Comments',
icon: '<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>'
});
Lampa.SettingsApi.addParam({
component: 'rezka_comment',
param: {
name: 'rezka_comment_host',
type: 'input',
placeholder: 'https://rezka.ag',
values: Lampa.Storage.get('rezka_comment_host', 'https://rezka.ag'),
default: 'https://rezka.ag'
},
field: {
name: 'Зеркало hdrezka',
description: 'Адрес зеркала hdrezka (например, https://hdrezka.me)'
},
onChange: function(value) {
Lampa.Storage.set('rezka_comment_host', value);
}
});
Lampa.SettingsApi.addParam({
component: 'rezka_comment',
param: {
name: 'rezka_comment_cookie',
type: 'input',
placeholder: 'вставьте cookie',
values: Lampa.Storage.get('rezka_comment_cookie', ''),
default: ''
},
field: {
name: 'Cookie авторизации',
description: 'Cookie из вашего браузера для обхода защиты (Anubis / PHPSESSID)'
},
onChange: function(value) {
Lampa.Storage.set('rezka_comment_cookie', value);
}
});
Lampa.SettingsApi.addParam({
component: 'rezka_comment',
param: {
name: 'rezka_comment_proxy',
type: 'input',
placeholder: 'https://worker-patient-dream-26d8.bdvburik.workers.dev:8443/',
values: Lampa.Storage.get('rezka_comment_proxy', 'https://worker-patient-dream-26d8.bdvburik.workers.dev:8443/'),
default: 'https://worker-patient-dream-26d8.bdvburik.workers.dev:8443/'
},
field: {
name: 'CORS Прокси',
description: 'Ваш Cloudflare Worker прокси (обязательно с / на конце)'
},
onChange: function(value) {
Lampa.Storage.set('rezka_comment_proxy', value);
}
});
} catch (e) {
console.error('[RezkaComment] Settings init error:', e);
}
Lampa.Listener.follow("full", function (e) {
if (e.type == "complite") {
$(".button--comment").remove();
$(".full-start-new__buttons").append(
`<div class="full-start__button selector button--comment"><svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 356.484 356.484"><g><path d="M293.984 7.23H62.5C28.037 7.23 0 35.268 0 69.731v142.78c0 34.463 28.037 62.5 62.5 62.5l147.443.001 70.581 70.58a12.492 12.492 0 0 0 13.622 2.709 12.496 12.496 0 0 0 7.717-11.547v-62.237c30.759-3.885 54.621-30.211 54.621-62.006V69.731c0-34.463-28.037-62.501-62.5-62.501zm37.5 205.282c0 20.678-16.822 37.5-37.5 37.5h-4.621c-6.903 0-12.5 5.598-12.5 12.5v44.064l-52.903-52.903a12.493 12.493 0 0 0-8.839-3.661H62.5c-20.678 0-37.5-16.822-37.5-37.5V69.732c0-20.678 16.822-37.5 37.5-37.5h231.484c20.678 0 37.5 16.822 37.5 37.5v142.78z" fill="currentcolor"/></g></svg><span>${Lampa.Lang.translate(
"title_comments",
)}</span></div>`,
);
$(".button--comment").on("hover:enter", function (card) {
year = 0;
if (e.data.movie.release_date) {
year = e.data.movie.release_date.slice(0, 4);
} else if (e.data.movie.first_air_date) {
year = e.data.movie.first_air_date.slice(0, 4);
}
Lampa.Loading.start();
getEnTitle(e.data.movie.id, e.object.method);
});
}
});
}
if (!window.comment_plugin) startPlugin();
})();
+225
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+17
View File
@@ -0,0 +1,17 @@
(function() {
'use strict';
var script = document.currentScript;
if (!script) {
var scripts = document.getElementsByTagName('script');
script = scripts[scripts.length - 1];
}
var src = script && script.src ? script.src : '';
var match = src.match(/^(https?:\/\/[^\/]+)/);
var host = 'http://showy.online';
var version = new Date().getTime();
if (!host) return;
Lampa.Utils.putScriptAsync([host + '/online.js?v=' + version], function() {});
})();
+1199
View File
File diff suppressed because one or more lines are too long
+32
View File
@@ -0,0 +1,32 @@
{
"arkmv_vod.js": "http://arkmv.ru/vod",
"bwa_rc.js": "http://bwa.ad/rc",
"bwa_re.js": "http://bwa.ad/re",
"diesel.js": "https://andreyurl54.github.io/diesel5/diesel.js",
"etor.js": "http://cub.best/plugin/etor",
"filmix_fx.js": "https://lampaplugins.github.io/store/fx.js",
"kinopoisk.js": "https://and7ey.github.io/lampa/kinopoisk.js",
"kulik.js": "http://cdn.kulik.uz/cors",
"llpp_vod.js": "http://llpp.in/v/vod.js",
"logo.js": "https://lampaplugins.github.io/store/logo.js",
"modss.js": "https://lampa.stream/modss (локальный патч isPWA; upstream мёртв)",
"nc.js": "https://lampame.github.io/main/nc/nc.js",
"not_mobile.js": "https://nb557.github.io/plugins/not_mobile.js",
"online_mod.js": "https://nb557.github.io/plugins/online_mod.js",
"podbor.js": "https://lampaplugins.github.io/store/p.js",
"pubtorr.js": "https://lampame.github.io/main/pubtorr/pubtorr.js",
"rating.js": "https://nb557.github.io/plugins/rating.js",
"record.js": "https://lampaplugins.github.io/store/record.js",
"reset_subs.js": "https://nb557.github.io/plugins/reset_subs.js",
"rezkacomment.js": "https://bdvburik.github.io/rezkacomment.js",
"rr.js": "https://nemiroff.github.io/lampa/rr.js",
"shikimori.js": "https://lampame.github.io/main/Shikimori/Shikimori.js",
"showy.js": "http://showy.online/m.js (локальный патч: подгрузка с showy.online, а не с текущего хоста)",
"soma.js": "https://tsynik.github.io/lampa/soma.js",
"td.js": "https://raw.githubusercontent.com/lampame/td/main/td/td.js",
"title.js": "https://bdvburik.github.io/title.js",
"torrentmanager.js": "https://lampame.github.io/main/torrentmanager/torrentmanager.js",
"ts-preload.plugin.js": "https://dmitryzemlyuk.github.io/lampa-ts-preload/ts-preload.plugin.js",
"wsoff.js": "http://plugin.rootu.top/wsoff.js",
"xsena.js": "http://e.xsena.red"
}
+2080
View File
File diff suppressed because one or more lines are too long
+365
View File
@@ -0,0 +1,365 @@
(function () {
"use strict";
// ===== Logging Helper =====
function log(message, data) {
console.log("[Title Plugin]", message, data || "");
}
function logError(message, error) {
console.error("[Title Plugin]", message, error || "");
}
// ===== Safe Property Access =====
function safeGet(obj, path, defaultValue) {
try {
return path.split('.').reduce((acc, part) => acc && acc[part], obj) || defaultValue;
} catch (e) {
return defaultValue;
}
}
// ===== Version Check =====
function checkCompatibility() {
if (!window.Lampa) {
logError("Lampa not found");
return false;
}
if (!Lampa.Lang || !Lampa.Storage) {
logError("Required APIs not available");
return false;
}
return true;
}
// ===== Локалізація =====
Lampa.Lang.add({
title_plugin: {
ru: "Title Plugin",
en: "Title Plugin",
uk: "Title Plugin",
be: "Title Plugin",
},
reset_to_default: {
ru: "Сбросить по умолчанию",
en: "Reset to Default",
uk: "Скинути за замовчуванням",
be: "Скінуць па змаўчанні",
},
show_en: {
ru: 'Показывать <img src="https://flagcdn.com/us.svg" style="width:1.15em;height:auto;vertical-align:middle;"> EN',
en: 'Show <img src="https://flagcdn.com/us.svg" style="width:1.15em;height:auto;vertical-align:middle;"> EN',
uk: 'Показувати <img src="https://flagcdn.com/us.svg" style="width:1.15em;height:auto;vertical-align:middle;"> EN',
be: 'Паказваць <img src="https://flagcdn.com/us.svg" style="width:1.15em;height:auto;vertical-align:middle;"> EN',
},
show_tl: {
ru: "Показывать Romaji (transliteration)",
en: "Show Romaji (transliteration)",
uk: "Показувати Romaji (transliteration)",
be: "Паказваць Romaji (transliteration)",
},
show_uk: {
ru: 'Показывать <img src="https://flagcdn.com/ua.svg" style="width:1.15em;height:auto;vertical-align:middle;"> UA',
en: 'Show <img src="https://flagcdn.com/ua.svg" style="width:1.15em;height:auto;vertical-align:middle;"> UA',
uk: 'Показувати <img src="https://flagcdn.com/ua.svg" style="width:1.15em;height:auto;vertical-align:middle;"> UA',
be: 'Паказваць <img src="https://flagcdn.com/ua.svg" style="width:1.15em;height:auto;vertical-align:middle;"> UA',
},
show_be: {
ru: 'Показывать <img src="https://flagcdn.com/by.svg" style="width:1.15em;height:auto;vertical-align:middle;"> BE',
en: 'Show <img src="https://flagcdn.com/by.svg" style="width:1.15em;height:auto;vertical-align:middle;"> BE',
uk: 'Показувати <img src="https://flagcdn.com/by.svg" style="width:1.15em;height:auto;vertical-align:middle;"> BE',
be: 'Паказваць <img src="https://flagcdn.com/by.svg" style="width:1.15em;height:auto;vertical-align:middle;"> BE',
},
show_ru: {
ru: 'Показывать <img src="https://flagcdn.com/ru.svg" style="width:1.15em;height:auto;vertical-align:middle;"> RU',
en: 'Show <img src="https://flagcdn.com/ru.svg" style="width:1.15em;height:auto;vertical-align:middle;"> RU',
uk: 'Показувати <img src="https://flagcdn.com/ru.svg" style="width:1.15em;height:auto;vertical-align:middle;"> RU',
be: 'Паказваць <img src="https://flagcdn.com/ru.svg" style="width:1.15em;height:auto;vertical-align:middle;"> RU',
},
});
const LANGS = ["en", "tl", "uk", "be", "ru"];
const STORAGE_ORDER_KEY = "title_plugin_order";
const STORAGE_HIDDEN_KEY = "title_plugin_hidden";
function startPlugin() {
// ===== Settings button =====
Lampa.SettingsApi.addParam({
component: "interface",
param: { type: "button" },
field: {
name: Lampa.Lang.translate("title_plugin"),
description: "Title Plugin settings",
},
onChange: openEditor,
});
// ===== Title display logic =====
const CACHE_TTL = 30 * 24 * 60 * 60 * 1000;
let titleCache = Lampa.Storage.get("title_cache") || {};
function showTitles(card) {
try {
var orig = card.original_title || card.original_name;
var altTitles = card.alternative_titles || {};
var alt = altTitles.titles || altTitles.results || [];
function countryFlag(code) {
if (!code) return '';
return ' <img src="https://flagcdn.com/' + code.toLowerCase() + '.svg"'
+ ' style="width:1.15em;height:auto;vertical-align:inherit;" alt="' + code.toUpperCase() + '">';
}
var TRANSLIT_TYPES = ['Transliteration', 'romaji', 'Romanization', 'Latynization',
'pinyin', 'kana', 'romaji_japanese', 'romaji_korean', 'romaji_chinese', 'latinization'];
var translitObj = alt.find(function (t) { return TRANSLIT_TYPES.indexOf(t.type) !== -1; });
var translit = (translitObj && (translitObj.title || (translitObj.data && (translitObj.data.title || translitObj.data.name)))) || '';
var ru = '', en = '', uk = '', be = '';
var now = Date.now();
var cache = titleCache[card.id];
if (cache && now - cache.timestamp < CACHE_TTL) {
en = cache.en || '';
uk = cache.uk || '';
be = cache.be || '';
ru = cache.ru || '';
translit = translit || cache.tl || '';
console.log('[TitlePlugin] cache hit for id:', card.id);
}
function findLang(list, codes) {
var t = list.find(function (t) { return codes.indexOf(t.iso_3166_1) !== -1 || codes.indexOf(t.iso_639_1) !== -1; });
return t && t.data && (t.data.title || t.data.name) || '';
}
function applyAndRender(tr) {
var translitData = tr.find(function (t) { return ['Transliteration', 'romaji'].indexOf(t.type) !== -1; });
if (translitData) translit = (translitData.title || (translitData.data && (translitData.data.title || translitData.data.name))) || translit;
en = en || findLang(tr, ['US', 'en']);
uk = uk || findLang(tr, ['UA', 'uk']);
be = be || findLang(tr, ['BY', 'be']);
ru = ru || findLang(tr, ['RU', 'ru']);
// fallback из alternative_titles
en = en || (alt.find(function (t) { return t.iso_3166_1 === 'US'; }) || {}).title || '';
uk = uk || (alt.find(function (t) { return t.iso_3166_1 === 'UA'; }) || {}).title || '';
be = be || (alt.find(function (t) { return t.iso_3166_1 === 'BY'; }) || {}).title || '';
ru = ru || (alt.find(function (t) { return t.iso_3166_1 === 'RU'; }) || {}).title || '';
titleCache[card.id] = { ru: ru, en: en, tl: translit, uk: uk, be: be, timestamp: now };
try { Lampa.Storage.set('title_cache', titleCache); } catch (e) { console.error('[TitlePlugin] storage error:', e); }
renderTitles();
}
function renderTitles() {
var active = Lampa.Activity.active();
if (!active || !active.activity) {
console.warn('[TitlePlugin] no active activity');
return;
}
var render = active.activity.render();
if (!render) { console.warn('[TitlePlugin] render is null'); return; }
$('.original_title', render).remove();
var showOrder = Lampa.Storage.get(STORAGE_ORDER_KEY, LANGS.slice());
var hiddenLangs = Lampa.Storage.get(STORAGE_HIDDEN_KEY, []);
var originCountry = (card.origin_country || [])[0] || '';
var lines = ['<div style="font-size:1.25em;">' + orig + ' ' + countryFlag(originCountry) + '</div>'];
var langFlags = { ru: 'RU', en: 'US', uk: 'UA', be: 'BY' };
var langVals = { en: en, uk: uk, be: be, ru: ru };
showOrder.forEach(function (lang) {
if (hiddenLangs.indexOf(lang) !== -1) return;
var val = lang === 'tl' ? translit : langVals[lang];
if (val) lines.push('<div style="font-size:1.25em;">' + val + ' ' + countryFlag(langFlags[lang]) + '</div>');
});
$('.full-start-new__title', render).after(
'<div class="original_title" style="margin-bottom:7px;text-align:right;"><div>'
+ lines.join('') + '</div></div>'
);
}
if (!ru || !en || !translit || !uk || !be) {
var type = card.first_air_date ? 'tv' : 'movie';
var tmdbCacheKey = type + '_' + card.id;
// Спільний кеш трансляцій з іншими плагінами (наприклад rezkacomment.js)
window.__tmdbTranslationsCache = window.__tmdbTranslationsCache || {};
if (window.__tmdbTranslationsCache[tmdbCacheKey]) {
console.log('[TitlePlugin] using shared translations cache for', tmdbCacheKey);
applyAndRender(window.__tmdbTranslationsCache[tmdbCacheKey]);
} else {
console.log('[TitlePlugin] fetching translations for', type, card.id);
Lampa.Api.sources.tmdb.get(
type + '/' + card.id + '?append_to_response=translations',
{},
function (data) {
var tr = (data.translations && data.translations.translations) || [];
window.__tmdbTranslationsCache[tmdbCacheKey] = tr;
applyAndRender(tr);
},
function (e) {
console.error('[TitlePlugin] tmdb error:', e);
applyAndRender([]);
}
);
}
} else {
renderTitles();
}
} catch (e) {
console.error('[TitlePlugin] showTitles crash:', e.message, e.stack);
}
}
// ===== Listener =====
if (!window.title_plugin) {
window.title_plugin = true;
Lampa.Listener.follow("full", (e) => {
if (e.type !== "complite" || !e.data.movie) return;
showTitles(e.data.movie);
});
}
}
// ===== Editor modal =====
function openEditor() {
const order = Lampa.Storage.get(STORAGE_ORDER_KEY, LANGS.slice());
const hidden = Lampa.Storage.get(STORAGE_HIDDEN_KEY, []);
const list = $('<div class="menu-edit-list"></div>');
const style = $(`
<style>
.menu-edit-list__item { display:flex; align-items:center; justify-content:space-between; margin:0.3em 0; }
.menu-edit-list__title { flex:1; font-size:1.1em; padding-left:0.5em; }
.menu-edit-list__move { width:1.8em; height:1.8em; display:flex; align-items:center; justify-content:center; cursor:pointer; font-weight:bold; user-select:none; }
.menu-edit-list__toggle { width:1.8em; height:1.8em; display:flex; align-items:center; justify-content:center; cursor:pointer; margin-left:0.5em; border:2px solid rgba(255,255,255,0.5); border-radius:3px; }
.menu-edit-list__toggle .dot { width:1em; height:1em; }
.folder-reset-button { background: rgba(200,100,100,0.3); margin-top:1em; border-radius:0.3em; padding:0.5em; text-align:center; cursor:pointer; }
</style>
`);
$("body").append(style);
order.forEach((lang) => {
const title = Lampa.Lang.translate("show_" + lang);
const isHidden = hidden.includes(lang);
const item = $(`
<div class="menu-edit-list__item">
<div class="menu-edit-list__title">${title}</div>
<div class="menu-edit-list__move move-up selector">▲</div>
<div class="menu-edit-list__move move-down selector">▼</div>
<div class="menu-edit-list__toggle selector">
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="1.89111" y="1.78369" width="21.793" height="21.793" rx="3.5" stroke="currentColor" stroke-width="3"/>
<path d="M7.44873 12.9658L10.8179 16.3349L18.1269 9.02588" stroke="currentColor" stroke-width="3" class="dot" opacity="${isHidden ? 0 : 1
}" stroke-linecap="round"/>
</svg>
</div>
</div>`);
// ===== Toggle hide/show =====
item.find(".menu-edit-list__toggle").on("hover:enter", function () {
const idx = hidden.indexOf(lang);
if (idx !== -1) {
hidden.splice(idx, 1);
item.find(".dot").attr("opacity", "1");
} else {
hidden.push(lang);
item.find(".dot").attr("opacity", "0");
}
Lampa.Storage.set(STORAGE_HIDDEN_KEY, hidden);
});
// ===== Move up/down =====
item.find(".move-up").on("hover:enter", function () {
const prev = item.prev();
if (prev.length) {
item.insertBefore(prev);
updateOrder();
}
});
item.find(".move-down").on("hover:enter", function () {
const next = item.next();
if (next.length) {
item.insertAfter(next);
updateOrder();
}
});
list.append(item);
});
const resetBtn = $(
'<div class="selector folder-reset-button" style="margin-top:1em;padding:1em;text-align:center;">' +
Lampa.Lang.translate("reset_to_default") +
"</div>"
);
resetBtn.on("hover:enter", function () {
Lampa.Storage.set(STORAGE_ORDER_KEY, LANGS.slice());
Lampa.Storage.set(STORAGE_HIDDEN_KEY, []);
Lampa.Modal.close();
Lampa.Controller.toggle("settings");
});
list.append(resetBtn);
function updateOrder() {
const newOrder = [];
list.find(".menu-edit-list__item").each(function () {
const title = $(this).find(".menu-edit-list__title").text();
const key = LANGS.find(
(l) => Lampa.Lang.translate("show_" + l) === title
);
if (key) newOrder.push(key);
});
Lampa.Storage.set(STORAGE_ORDER_KEY, newOrder);
}
Lampa.Modal.open({
title: Lampa.Lang.translate("title_plugin"),
html: list,
size: "small",
scroll_to_center: true,
onBack: function () {
Lampa.Modal.close();
Lampa.Controller.toggle("settings");
},
});
}
// ===== Init plugin =====
if (window.appready) {
if (typeof Lampa !== 'undefined' &&
Lampa.SettingsApi &&
Lampa.Api &&
Lampa.Api.sources &&
Lampa.Api.sources.tmdb &&
typeof $ !== 'undefined') {
startPlugin();
} else {
console.error('Title Plugin: Required Lampa APIs not available');
}
} else {
Lampa.Listener.follow("app", (e) => {
if (e.type === "ready") {
if (typeof Lampa !== 'undefined' &&
Lampa.SettingsApi &&
Lampa.Api &&
Lampa.Api.sources &&
Lampa.Api.sources.tmdb &&
typeof $ !== 'undefined') {
startPlugin();
} else {
console.error('Title Plugin: Required Lampa APIs not available');
}
}
});
}
})();
File diff suppressed because one or more lines are too long
+418
View File
@@ -0,0 +1,418 @@
(function($, Lampa) {
var Modal = /** @class */function(){
var modalID = 0;
function Modal(params) {
this.id = ++modalID;
this.active = params;
this.html = Lampa.Template.get('modal', {title: params.title});
this.scroll = new Lampa.Scroll({over: true, mask: params.mask});
this.last = false;
}
Modal.prototype.open = function(){
var _this = this;
this.html.on('click',function(e){
if(!$(e.target).closest($('.modal__content', _this.html)).length && Lampa.DeviceInput.canClick(e.originalEvent)) window.history.back();
})
this.title(this.active.title);
this.html.toggleClass('modal--medium', this.active.size === 'medium');
this.html.toggleClass('modal--large', this.active.size === 'large');
this.html.toggleClass('modal--full', this.active.size === 'full');
this.html.toggleClass('modal--overlay', !!this.active.overlay);
this.html.toggleClass('modal--align-center', this.active.align === 'center');
if(this.active.zIndex) this.html.css('z-index', this.active.zIndex);
this.scroll.render().toggleClass('layer--height', this.active.size === 'full')
this.html.find('.modal__body').append(this.scroll.render())
this.bind(this.active.html);
this.scroll.onWheel = function(step){
this.roll(step > 0 ? 'down' : 'up');
}
this.scroll.append(this.active.html);
if(this.active.buttons) this.buttons();
$('body').append(this.html);
this.max();
this.toggle(this.active.select);
}
Modal.prototype.max = function(){
this.scroll.render().find('.scroll__content').css('max-height', Math.round(window.innerHeight - this.scroll.render().offset().top - (window.innerHeight * 0.1)) + 'px');
}
Modal.prototype.buttons = function(){
var footer = $('<div class="modal__footer"></div>');
this.active.buttons.forEach(function(button){
var btn = $('<div class="modal__button selector" style="width: 50%;text-align: center"></div>');
btn.text(button.name);
btn.on('click hover:enter',function(){
button.onSelect();
});
footer.append(btn);
});
this.scroll.append(footer);
}
Modal.prototype.bind = function(where){
var _this = this;
where.find('.selector')
.on('hover:focus', function(e){
_this.last = e.target;
_this.scroll.update($(e.target));
})
.on('hover:enter', function(e){
_this.last = e.target;
if (_this.active.onSelect) _this.active.onSelect($(e.target));
});
}
Modal.prototype.jump = function(tofoward){
var select = this.scroll.render().find('.selector.focus');
if (tofoward) select = select.nextAll().filter('.selector');
else select = select.prevAll().filter('.selector');
select = select.slice(0, 10).last();
if (select.length){
Lampa.Controller.collectionFocus(select[0], this.scroll.render());
}
}
Modal.prototype.roll = function(direction){
var select = this.scroll.render().find('.selector');
if(select.length){
Navigator.move(direction);
}
else{
var step = Math.round(window.innerHeight * 0.15);
this.scroll.wheel(direction === 'down' ? step : -step);
}
}
Modal.prototype.toggle = function(need_select){
var _this = this;
Lampa.Controller.add('Modal-' + this.id, {
invisible: true,
toggle: function(){
Lampa.Controller.collectionSet(_this.scroll.render());
Lampa.Controller.collectionFocus(need_select || _this.last, _this.scroll.render());
Lampa.Layer.visible(_this.scroll.render(true));
},
up: function(){
_this.roll('up');
},
down: function(){
_this.roll('down');
},
right: function(){
if(Navigator.canmove('right')) Navigator.move('right');
else _this.jump(true);
},
left: function(){
if(Navigator.canmove('left')) Navigator.move('left');
else _this.jump(false);
},
back: function(){
if(_this.active.onBack) _this.active.onBack();
}
});
Lampa.Controller.toggle('Modal-' + this.id);
}
Modal.prototype.update = function(new_html) {
this.last = false;
this.scroll.clear();
this.scroll.append(new_html);
this.bind(new_html);
this.max();
this.toggle(this.active.select);
}
Modal.prototype.title = function(title){
this.html.find('.modal__title').text(title);
this.html.toggleClass('modal--empty-title',!title);
}
Modal.prototype.destroy = function(){
this.last = false;
this.scroll.destroy();
this.html.remove();
}
Modal.prototype.close = function(){
this.destroy();
}
Modal.prototype.render = function(){
return this.html;
}
return Modal;
}();
Lampa.Lang.add({
ts_preload_preload: {
en: 'Preload',
ru: 'Предзагрузка',
be: 'Перадзагрузка',
uk: 'Передзавантаження',
pt: 'Pré-carregar',
zh: '预加载'
},
ts_preload_speed: {
en: 'Speed',
ru: 'Скорость загрузки',
be: 'Хуткасць загрузкі',
uk: 'Швидкість',
pt: 'Velocidade',
zh: '速度'
},
ts_preload_seeds: {
en: 'seeds',
ru: 'раздают',
be: 'раздаюць',
uk: 'роздають',
pt: 'entregam',
zh: '种子数'
},
ts_preload_peers: {
en: 'Peers',
ru: 'Подключились',
be: 'Падключыліся',
uk: 'Підключилися',
pt: 'Conectado',
zh: '连接数'
}
});
function tsIP(){
return (!!Lampa.Torserver && !!Lampa.Torserver.ip)
? Lampa.Torserver.ip()
: Lampa.Storage.get(Lampa.Storage.field('torrserver_use_link') === 'two' ? 'torrserver_url_two' : 'torrserver_url');
}
if (!!Lampa.Torserver && !!Lampa.Torserver.stream && !!Lampa.Torserver.url) {
Lampa.Torserver.stream = function(path, hash, id) {
return Lampa.Torserver.url() + '/stream/'+ encodeURIComponent(path.split('\\').pop().split('/').pop()) +'?link=' + hash + '&index=' + id + '&play'
}
}
var lampaPlay = Lampa.Player.play;
var lampaCallback = Lampa.Player.callback;
var lampaPlaylist = Lampa.Player.playlist;
var lampaStat = Lampa.Player.stat;
var player = null;
var Player = /** @class */function(){
function Player(data) {
data.url = parseUrl(data.url).clearUrl + '&play';
this.playerData = data;
this.playList = null;
this.statUrl = null;
this.callback = null;
}
Player.prototype.setPlayList = function(playlist){
playlist.map(function(data){data.url = parseUrl(data.url).clearUrl + '&play'});
this.playList = playlist;
};
Player.prototype.setStatUrl = function(url){this.statUrl = url};
Player.prototype.setCallback = function(callback){this.callback = callback};
Player.prototype.play = function(){
lampaPlay(this.playerData);
this.playList && lampaPlaylist(this.playList);
this.callback && lampaCallback(this.callback);
this.statUrl && lampaStat(this.statUrl);
player = null;
}
return Player;
}();
Lampa.Player.playlist = function(playlist) {
if (player) player.setPlayList(playlist);
else lampaPlaylist(playlist);
};
Lampa.Player.stat = function(url) {
if (player) player.setStatUrl(url);
else lampaStat(url);
};
Lampa.Player.callback = function(callback) {
if (player) player.setCallback(callback);
else lampaCallback(callback);
};
Lampa.Player.play = function(data) {
if (Lampa.Storage.field('torrserver_preload')
&& data.url
&& tsIP()
&& data.url.indexOf(tsIP()) > -1
&& (
Lampa.Storage.field('player_timecode') === 'again'
|| !data.timeline || !data.timeline.time
|| parseFloat('0' + data.timeline.time) < 60
|| true
)
) preload(data);
else lampaPlay(data);
};
function params(obj) {
var prop, pairs = [];
for (prop in obj) pairs.push(prop + (obj[prop] ? '=' + obj[prop] : ''));
return pairs.join('&');
}
function parseUrl(url) {
var m, base_url, stream, args, arg = {};
if (!!(m = url.match(/^(https?:\/\/.+?)(\/stream\/[^?]+)\?(.+)$/i))) {
base_url = m[1];
stream = m[2];
args = m[3];
args.split('&').map(function(v){var p=v.split('=');arg[p[0]] = p[1] || null;});
delete(arg['play']);delete(arg['preload']);delete(arg['stat']);
}
args = params(arg);
return {
clearUrl: base_url + stream + '?' + args,
base_url: base_url,
stream: stream,
args: '?' + args,
arg: arg
}
}
function preload(data) {
var u = parseUrl(data.url);
if (!u.arg.link) return lampaPlay(data);
player = new Player(data);
var controller = Lampa.Controller.enabled().name;
var network = new Lampa.Reguest();
var modalHtml = $('<div>' +
'<div class="broadcast__text" style="text-align: left">' +
'<span class="js-peer">&nbsp;</span><br>' +
'<span class="js-buff">&nbsp;</span><br>' +
'<span class="js-speed">&nbsp;</span>' +
'</div>' +
'<div class="broadcast__scan"><div></div></div>' +
'</div>');
var peer = modalHtml.find('.js-peer');
var buff = modalHtml.find('.js-buff');
var speed = modalHtml.find('.js-speed');
var modal = new Modal({
title: Lampa.Lang.translate('loading'),
html: modalHtml,
onBack: cancel,
buttons: [
{
name: Lampa.Lang.translate('cancel'),
onSelect: cancel
},
{
name: Lampa.Lang.translate('player_lauch'),
onSelect: play
}
]
});
modal.open();
var launchBtn = modal.render()
.find('.modal__button')
.filter(function(){
return $(this).text() === Lampa.Lang.translate('player_lauch');
});
var focusedOnReady = false;
/* =============================================================== */
function destroy() {
network.clear();
modal.close();
Lampa.Controller.toggle(controller);
}
function cancel(){
if (player) {
destroy();
player.callback && player.callback();
player = null;
}
}
function play(){
if (player) {
destroy();
player.play();
}
}
network.timeout(1800 * 1000);
network.silent(u.clearUrl + '&preload');
network.timeout(2000);
var stat = function(data) {
if (!player) return;
if (data && data.Torrent) {
var t = data.Torrent;
var p = Math.floor((t.preloaded_bytes || 0) * 100 / (t.preload_size || 1));
peer.html(
Lampa.Lang.translate('ts_preload_peers') + ': ' +
(t.active_peers || 0) + ' / ' +
(t.pending_peers || 0)
);
buff.html(
Lampa.Lang.translate('ts_preload_preload') + ': ' +
Lampa.Utils.bytesToSize(t.preloaded_bytes || 0) + ' / ' +
Lampa.Utils.bytesToSize(t.preload_size || 0) +
' (' + p + '%)'
);
speed.text(
Lampa.Lang.translate('ts_preload_speed') + ': ' +
Lampa.Utils.bytesToSize((t.download_speed || 0) * 8, true)
);
if (p >= 100 && !focusedOnReady && launchBtn.length) {
focusedOnReady = true;
Lampa.Controller.collectionFocus(
launchBtn[0],
modal.scroll.render()
);
}
}
network.silent(
u.base_url + '/cache',
stat,
stat,
JSON.stringify({ action: 'get', hash: u.arg.link })
);
};
stat({ Torrent: {
active_peers:0,
pending_peers:0,
total_peers:0,
connected_seeders:0,
preloaded_bytes:0,
preload_size:0,
download_speed:0
}});
}
})(jQuery, Lampa);
+13
View File
@@ -0,0 +1,13 @@
;(function() {
var ua = navigator.userAgent || '';
if (/Android\s+[4-6]/i.test(ua) && /Crosswalk/.test(ua)) {
Lampa.Socket.init = function () {
console.log('Socket', 'initialization disabled by wsoff.js plugin')
};
Lampa.Socket.send = function (method, data) {
console.log('Socket', 'Method "' + method + '" send disabled by wsoff.js plugin')
};
} else {
console.log('Socket', 'The wsoff.js plugin cannot work on this device because it is designed for older devices with expired root certificates.')
}
})();
+1360
View File
File diff suppressed because it is too large Load Diff