commit 6f80f87409bb9bbda8bf04c2e16b263364f6aa31 Author: Fedorov Dmitriy Date: Wed Mar 19 20:33:57 2025 +0300 first commit diff --git a/configs/init.conf b/configs/init.conf new file mode 100644 index 0000000..858f2fa --- /dev/null +++ b/configs/init.conf @@ -0,0 +1,74 @@ +{ + //"listenip": "127.0.0.1", // nginx + "listenport": 9118, + "pirate_store": true, // Плагины + "multiaccess": true, // Многопользовательский режим > 100 пользователей + "apikey": "gsu53it69rg", // ключ к jacred + "puppeteer": { + "keepopen": true + }, + "storage": { // хранилище для синхронизации, бекапа + "enable": true + }, + "LampaWeb": { + "tree": "8e721c9f465f3392ec075a80e406613c873b0145", // Версия https://github.com/yumata/lampa/tree/8e721c9f465f3392ec075a80e406613c873b0145 + "appReplace": { + + // Расширенные закладки + "checkPremium\\(\\) \\{": "checkPremium() { return 1;", + + // Убираем кнопку добавить комментарий + "this.add = function \\(\\) \\{": "this.add = function () { return;", + + // Убираем подписки cub на озвучку/персону + "full-start__button selector button--subscribe": "full-start__button selector button--subscribe hide", + + // Загружаем локальный плагин vast + "\\[[^\n\r]+'/plugin/vast'": "['{localhost}/vast.js'", + } + }, + "online": { + "component": "huyampa", + "name": "HuYampa" + }, + "accsdb": { + "enable": true, + "maxip_hour": 15, + "maxrequest_hour": 300, + "maxlock_day": 3, + "blocked_hour": 36, + "denyGroupMesage": "У вас нет прав для просмотра этой страницы", + "expiresMesage": "Время доступа для {account_email} истекло в {expires}", // в {account_email} указан пароль/uid/token/cub_email + "users": [ + { + "id": "prodik.sun@gmail.com", + "expires": "2040-10-17T00:00:00", + "group": 1, + "params": { "имя": Prodik + "adult": true + } + }, + { + "id": "123456", + "expires": "2040-10-17T00:00:00", + "group": 1, + "params": { // кастомное поле, можно указать любые данные - "имя": значение + "adult": true + } + }, + { + "id": "654321", + "expires": "2040-10-17T00:00:00" + } + ], + "params": { // кастомное поле, можно указать любые данные - "имя": значение + "iptv": { + "epg": "http://epg.one/ru2.xml.gz", + "m3u": "https://smolnp.github.io/IPTVru//IPTVstable.m3u8" + } + } + }, + "Filmix": { + "group": 1 // балансер доступен пользователю 123456 + } +} \ No newline at end of file diff --git a/configs/manifest.json b/configs/manifest.json new file mode 100644 index 0000000..5451ef5 --- /dev/null +++ b/configs/manifest.json @@ -0,0 +1 @@ +[{"enable":true,"dll":"Online.dll"},{"enable":true,"dll":"SISI.dll"},{"enable":false,"dll":"DLNA.dll"},{"enable":true,"initspace":"Tracks.ModInit","dll":"Tracks.dll"},{"enable":false,"initspace":"TorrServer.ModInit","dll":"TorrServer.dll"}] diff --git a/configs/sisi.js b/configs/sisi.js new file mode 100644 index 0000000..c8fa1e8 --- /dev/null +++ b/configs/sisi.js @@ -0,0 +1,1018 @@ +(function() { + 'use strict'; + + var Defined = { + use_api: 'lampac', + localhost: '{localhost}/sisi', + vip_site: '', + framework: '' + }; + + var luid = Lampa.Storage.get('lampac_unic_id', ''); + if (!luid) { + luid = Lampa.Utils.uid(8).toLowerCase(); + Lampa.Storage.set('lampac_unic_id', luid); + } + + Lampa.Lang.add({ + lampac_sisiname: { + ru: 'Settings', + en: 'Strawberry', + uk: 'Полуничка', + zh: '草莓' + } + }); + + var network = new Lampa.Reguest(); + var preview_timer, preview_video; + + function sourceTitle(title) { + return Lampa.Utils.capitalizeFirstLetter(title.split('.')[0]); + } + + function isVIP(element) { + return /vip.mp4/.test(element.video); + } + + if (window.rchtype == undefined) { + window.rchtype = 'web'; + var check = function check(good) { + window.rchtype = Lampa.Platform.is('android') ? 'apk' : good ? 'cors' : 'web'; + } + + if (Lampa.Platform.is('android') || Lampa.Platform.is('tizen')) check(true); + else { + var net = new Lampa.Reguest(); + net.silent('{localhost}'.indexOf(location.host) >= 0 ? 'https://github.com/' : '{localhost}/cors/check', function() { + check(true); + }, function() { + check(false); + }, false, { + dataType: 'text' + }); + } + } + + var hubConnection; + var hub_timer + + function rchInvoke(json, call) { + if (hubConnection) { + hubConnection.stop(); + hubConnection = null; + } + hubConnection = new signalR.HubConnectionBuilder().withUrl(json.ws).build(); + hubConnection.start().then(function() { + hubConnection.invoke("RchRegistry", JSON.stringify({version: 138, host: location.host, rchtype: window.rchtype})).then(function() { + call() + hubConnection.on("RchClient", function(rchId, url, data, headers, returnHeaders) { + function result(html) { + if (Lampa.Arrays.isObject(html) || Lampa.Arrays.isArray(html)) html = JSON.stringify(html); + network.silent(json.result, false, false, { + id: rchId, + value: html + }, { + dataType: 'text', + timeout: 1000 * 5 + }); + } + + if (url == 'eval') + result(eval(data)) + else { + network["native"](url, result, function() { + result(''); + }, data, { + dataType: 'text', + timeout: 1000 * json.timeout, + headers: headers, + returnHeaders: returnHeaders + }); + } + }); + }); + })["catch"](function(err) { + //return console.error(err.toString()); + }); + if (json.keepalive > 0) { + hub_timer = setTimeout(function() { + hubConnection.stop(); + }, 1000 * json.keepalive); + } + } + + function rchRun(json, call) { + if (typeof signalR == 'undefined') { + Lampa.Utils.putScript(["{localhost}/signalr-6.0.25_es5.js"], function() {}, false, function() { + rchInvoke(json, call); + }, true); + } else { + rchInvoke(json, call); + } + } + + function modal() { + var id = Lampa.Storage.get('sisi_unic_id', '').toLowerCase(); + var controller = Lampa.Controller.enabled().name; + var content = "
\n
\u042D\u0442\u043E \u0432\u0438\u0434\u0435\u043E \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u0441 VIP \u043F\u043E\u0434\u043F\u0438\u0441\u043A\u043E\u0439. \u0414\u043B\u044F \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F VIP \u043F\u043E\u0434\u043F\u0438\u0441\u043A\u0438, \u043F\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043D\u0430 \u0441\u0430\u0439\u0442 \u043A\u043E\u0442\u043E\u0440\u044B\u0439 \u0443\u043A\u0430\u0437\u0430\u043D \u043D\u0438\u0436\u0435 \u0438 \u0443\u043A\u0430\u0436\u0438\u0442\u0435 \u0432\u0430\u0448 ID
\n
\n
\n \u0421\u0430\u0439\u0442
\n ".concat(Defined.vip_site, "\n
\n\n
\n \u0412\u0430\u0448 ID
\n ").concat(id, "\n
\n
\n
"); + Lampa.Modal.open({ + title: 'VIP Контент', + html: $(content), + size: 'medium', + onBack: function onBack() { + Lampa.Modal.close(); + Lampa.Controller.toggle(controller); + } + }); + } + + function qualityDefault(qualitys) { + var preferably = Lampa.Storage.get('video_quality_default', '1080') + 'p'; + var url; + + if (qualitys) { + for (var q in qualitys) { + if (q.indexOf(preferably) == 0) url = qualitys[q]; + } + + if (!url) url = qualitys[Lampa.Arrays.getKeys(qualitys)[0]]; + } + + return url; + } + + function play(element) { + var controller_enabled = Lampa.Controller.enabled().name; + + if (isVIP(element)) { + return modal(); + } + + if (element.json) { + Lampa.Loading.start(function() { + network.clear(); + Lampa.Loading.stop(); + }); + Api.account(element.video + '&json=true'); + Api.qualitys(element.video, function(data) { + if (data.error) { + Lampa.Noty.show(Lampa.Lang.translate('torrent_parser_nofiles')); + Lampa.Loading.stop(); + return; + } + + var qualitys = data.qualitys || data; + var recomends = data.recomends || []; + Lampa.Loading.stop(); + + for (var i in qualitys) { + qualitys[i] = Api.account(qualitys[i], true); + } + + var video = { + title: element.name, + url: Api.account(qualityDefault(qualitys), true), + url_reserve: data.qualitys_proxy ? Api.account(qualityDefault(data.qualitys_proxy), true) : false, + quality: qualitys + }; + Lampa.Player.play(video); + + if (recomends.length) { + recomends.forEach(function(a) { + a.title = Lampa.Utils.shortText(a.name, 50); + a.icon = ''; + a.template = 'selectbox_icon'; + + a.url = function(call) { + if (a.json) { + Api.qualitys(a.video, function(data) { + a.quality = data.qualitys; + a.url = Api.account(qualityDefault(data.qualitys), true); + if (data.qualitys_proxy) a.url_reserve = Api.account(qualityDefault(data.qualitys_proxy), true); + call(); + }); + } else { + a.url = a.video; + call(); + } + }; + }); + Lampa.Player.playlist(recomends); + } else { + Lampa.Player.playlist([video]); + } + + Lampa.Player.callback(function() { + Lampa.Controller.toggle(controller_enabled); + }); + }, function() { + Lampa.Noty.show(Lampa.Lang.translate('torrent_parser_nofiles')); + Lampa.Loading.stop(); + }); + } else { + if (element.qualitys) { + for (var i in element.qualitys) { + element.qualitys[i] = Api.account(element.qualitys[i], true); + } + } + + var video = { + title: element.name, + url: Api.account(qualityDefault(element.qualitys) || element.video, true), + url_reserve: Api.account(qualityDefault(element.qualitys_proxy) || element.video_reserve || '', true), + quality: element.qualitys + }; + Lampa.Player.play(video); + Lampa.Player.playlist([video]); + Lampa.Player.callback(function() { + Lampa.Controller.toggle(controller_enabled); + }); + } + } + + function fixCards(json) { + json.forEach(function(m) { + m.background_image = m.picture; + m.poster = m.picture; + m.img = m.picture; + m.name = Lampa.Utils.capitalizeFirstLetter(m.name).replace(/\&(.*?);/g, ''); + }); + } + + function hidePreview() { + clearTimeout(preview_timer); + + if (preview_video) { + preview_video.find('video').pause(); + preview_video.addClass('hide'); + preview_video = false; + } + } + + function preview(target, element) { + hidePreview(); + preview_timer = setTimeout(function() { + if (!element.preview || !Lampa.Storage.field('sisi_preview')) return; + var video = target.find('video'); + var container = target.find('.sisi-video-preview'); + + if (!video) { + video = document.createElement('video'); + container = document.createElement('div'); + container.addClass('sisi-video-preview'); + container.style.position = 'absolute'; + container.style.width = '100%'; + container.style.height = '100%'; + container.style.left = '0'; + container.style.top = '0'; + container.style.overflow = 'hidden'; + container.style.borderRadius = '1em'; + video.style.position = 'absolute'; + video.style.width = '100%'; + video.style.height = '100%'; + video.style.left = '0'; + video.style.top = '0'; + video.style.objectFit = 'cover'; + container.append(video); + target.find('.card__view').append(container); + video.src = element.preview; // 'https://thumb-v4.xhcdn.com/a/og0z25CtaTIZXgzkV7qJ8Q/023/463/094/526x298.44.t.webm' + + video.load(); + } + + preview_video = container; + video.play(); + container.removeClass('hide'); + }, 1500); + } + + function fixList(list) { + list.forEach(function(a) { + if (!a.quality && a.time) a.quality = a.time; + }); + return list; + } + + function menu$2(target, card_data) { + if (!card_data.bookmark) return; + var cm = [{ + title: !card_data.bookmark.uid ? 'В закладки' : 'Удалить из закладок' + }]; + + if (card_data.related) { + cm.push({ + title: 'Похожие', + related: true + }); + } + + if (card_data.model) { + cm.push({ + title: card_data.model.name, + model: true + }); + } + + Lampa.Select.show({ + title: 'Меню', + items: cm, + onSelect: function onSelect(m) { + if (m.model) { + Lampa.Activity.push({ + url: Defined.localhost.replace('/sisi', '') + '/' + card_data.model.uri, + title: 'Модель - ' + card_data.model.name, + component: 'sisi_view_' + Defined.use_api, + page: 1 + }); + } else if (m.related) { + Lampa.Activity.push({ + url: card_data.video + '&related=true', + title: 'Похожие - ' + card_data.title, + component: 'sisi_view_' + Defined.use_api, + page: 1 + }); + } else { + Api.bookmark(card_data, !card_data.bookmark.uid, function(status) { + Lampa.Noty.show('Успешно'); + }); + Lampa.Controller.toggle('content'); + } + }, + onBack: function onBack() { + Lampa.Controller.toggle('content'); + } + }); + } + + var Utils = { + sourceTitle: sourceTitle, + play: play, + fixCards: fixCards, + isVIP: isVIP, + preview: preview, + hidePreview: hidePreview, + fixList: fixList, + menu: menu$2 + }; + + var menu$1; + + function ApiPWA() { + var _this = this; + + var network = new Lampa.Reguest(); + + this.menu = function(success, error) { + if (menu$1) return success(menu$1); + DotNet.invokeMethodAsync("JinEnergy", 'sisi', '').then(function(data) { + if (data) { + menu$1 = data; + success(menu$1); + } else { + error(data.msg); + } + })["catch"](function() { + console.log('Sisi', 'no load menu'); + error(); + }); + }; + + this.view = function(params, success, error) { + var u = this.account(Lampa.Utils.addUrlComponent(params.url, 'pg=' + (params.page || 1))); + DotNet.invokeMethodAsync("JinEnergy", u.path, u.query).then(function(json) { + if (json.list) { + json.results = Utils.fixList(json.list); + json.collection = true; + json.total_pages = json.total_pages || 30; + Utils.fixCards(json.results); + delete json.list; + success(json); + } else { + error(); + } + })["catch"](function() { + console.log('Sisi', 'no load', u.path + '+' + u.query); + error(); + }); + }; + + this.bookmark = function(element, add, call) { + call(true); + }; + + this.account = function(u, join) { + if (join) { + if (Defined.use_api == 'lampac' && u.indexOf(Defined.localhost.replace('/sisi', '')) == -1) return u; + } + + var unic_id = Lampa.Storage.get('sisi_unic_id', ''); + var uid = Lampa.Storage.get('lampac_unic_id', ''); + var email = Lampa.Storage.get('account', {}).email; + + if (u.indexOf('box_mac=') == -1) u = Lampa.Utils.addUrlComponent(u, 'box_mac=' + unic_id); + + if (email) { + if (u.indexOf('account_email=') == -1) u = Lampa.Utils.addUrlComponent(u, 'account_email=' + encodeURIComponent(email)); + } + + if (uid) { + if (u.indexOf('&uid=') == -1) u = Lampa.Utils.addUrlComponent(u, 'uid=' + encodeURIComponent(uid)); + } + + if (u.indexOf('token=') == -1) { + var token = '{token}'; + if (token != '') u = Lampa.Utils.addUrlComponent(u, 'token={token}'); + } + + if (join) return u; + return { + path: u.split('?')[0], + query: u.split('?')[1] + }; + }; + + this.playlist = function(add_url_query, oncomplite, error) { + var load = function load() { + var status = new Lampa.Status(menu$1.length); + + status.onComplite = function(data) { + var items = []; + menu$1.forEach(function(m) { + if (data[m.playlist_url] && data[m.playlist_url].results.length) items.push(data[m.playlist_url]); + }); + if (items.length) oncomplite(items); + else error(); + }; + + menu$1.forEach(function(m, i) { + var u = _this.account(m.playlist_url + add_url_query); + + var b = false; + var w = setTimeout(function() { + b = true; + status.error(); + }, 1000 * 8); + DotNet.invokeMethodAsync("JinEnergy", u.path, u.query).then(function(json) { + clearTimeout(w); + if (b) return; + + if (json.list) { + json.title = Utils.sourceTitle(m.title); + json.results = Utils.fixList(json.list); + json.url = m.playlist_url; + json.collection = true; + json.line_type = 'none'; + json.card_events = { + onMenu: Utils.menu, + onEnter: function onEnter(card, element) { + Utils.hidePreview(); + Utils.play(element); + } + }; + Utils.fixCards(json.results); + delete json.list; + status.append(m.playlist_url, json); + } else { + status.error(); + } + })["catch"](function() { + console.log('Sisi', 'no load', u.path + '+' + u.query); + clearTimeout(w); + status.error(); + }); + }); + }; + + if (menu$1) load(); + else { + _this.menu(load, error); + } + }; + + this.main = function(params, oncomplite, error) { + this.playlist('', oncomplite, error); + }; + + this.search = function(params, oncomplite, error) { + this.playlist('?search=' + encodeURIComponent(params.query), oncomplite, error); + }; + + this.qualitys = function(video_url, oncomplite, error) { + var u = this.account(video_url + '&json=true'); + DotNet.invokeMethodAsync("JinEnergy", u.path, u.query).then(oncomplite)["catch"](function(e) { + console.log('Sisi', 'no load', u.path + '+' + u.query); + error(); + }); + }; + + this.clear = function() { + network.clear(); + }; + } + + var ApiPWA$1 = new ApiPWA(); + + var menu; + + function ApiHttp() { + var _this = this; + + var network = new Lampa.Reguest(); + + this.menu = function(success, error) { + if (menu) return success(menu); + network.silent(this.account(Defined.localhost)+'&rchtype='+window.rchtype, function(data) { + if (data.channels) { + menu = data.channels; + success(menu); + } else { + error(data.msg); + } + }, error); + }; + + this.view = function(params, success, error) { + var u = Lampa.Utils.addUrlComponent(params.url, 'pg=' + (params.page || 1)); + network.silent(this.account(u), function(json) { + if (json.rch) { + rchRun(json, function() { + _this.view(params, success, error) + }) + } else if (json.list) { + json.results = Utils.fixList(json.list); + json.collection = true; + json.total_pages = json.total_pages || 30; + Utils.fixCards(json.results); + delete json.list; + success(json); + } else { + error(); + } + }, error); + }; + + this.bookmark = function(element, add, call) { + var u = Defined.localhost + '/bookmark/' + (add ? 'add' : 'remove?buid=' + element.bookmark.uid); + network.silent(this.account(u), function(e) { + call(true); + }, function() { + call(false); + }, JSON.stringify(element), { + headers: { + 'Content-Type': 'application/json' + } + }); + }; + + this.account = function(u) { + if (Defined.use_api == 'lampac' && u.indexOf(Defined.localhost.replace('/sisi', '')) == -1 && window.location.hostname !== 'localhost') return u; + + var unic_id = Lampa.Storage.get('sisi_unic_id', ''); + var uid = Lampa.Storage.get('lampac_unic_id', ''); + var email = Lampa.Storage.get('account', {}).email; + + if (u.indexOf('box_mac=') == -1) u = Lampa.Utils.addUrlComponent(u, 'box_mac=' + unic_id); + else u = u.replace(/box_mac=[^&]+/, 'box_mac=' + unic_id); + + if (email) { + if (u.indexOf('account_email=') == -1) u = Lampa.Utils.addUrlComponent(u, 'account_email=' + encodeURIComponent(email)); + else u = u.replace(/account_email=[^&]+/, 'account_email=' + encodeURIComponent(email)); + } + + if (uid) { + if (u.indexOf('&uid=') == -1) u = Lampa.Utils.addUrlComponent(u, 'uid=' + encodeURIComponent(uid)); + else u = u.replace(/uid=[^&]+/, 'uid=' + encodeURIComponent(uid)); + } + + if (u.indexOf('token=') == -1) { + var token = '{token}'; + if (token != '') u = Lampa.Utils.addUrlComponent(u, 'token={token}'); + } + + return u; + }; + + this.playlist = function(add_url_query, oncomplite, error) { + var load = function load() { + var status = new Lampa.Status(menu.length); + + status.onComplite = function(data) { + var items = []; + menu.forEach(function(m) { + if (data[m.playlist_url] && data[m.playlist_url].results.length) items.push(data[m.playlist_url]); + }); + if (items.length) oncomplite(items); + else error(); + }; + + menu.forEach(function(m) { + function loadThis() { + network.silent(_this.account(m.playlist_url + add_url_query), function(json) { + if (json.rch) { + rchRun(json, function() { + loadThis() + }) + } else if (json.list) { + json.title = Utils.sourceTitle(m.title); + json.results = Utils.fixList(json.list); + json.url = m.playlist_url; + json.collection = true; + json.line_type = 'none'; + json.card_events = { + onMenu: Utils.menu, + onEnter: function onEnter(card, element) { + Utils.hidePreview(); + Utils.play(element); + } + }; + Utils.fixCards(json.results); + delete json.list; + status.append(m.playlist_url, json); + } else { + status.error(); + } + }, status.error.bind(status)); + } + + loadThis() + }); + }; + + if (menu) load(); + else { + _this.menu(load, error); + } + }; + + this.main = function(params, oncomplite, error) { + this.playlist('', oncomplite, error); + }; + + this.search = function(params, oncomplite, error) { + this.playlist('?search=' + encodeURIComponent(params.query), oncomplite, error); + }; + + this.qualitys = function(video_url, oncomplite, error) { + network.silent(this.account(video_url + '&json=true'), function(json) { + if (json.rch) { + rchRun(json, function() { + _this.qualitys(video_url, oncomplite, error) + }) + } else oncomplite(json) + }, error); + }; + + this.clear = function() { + network.clear(); + }; + } + + var ApiHttp$1 = new ApiHttp(); + + var Api = ApiHttp$1; //Defined.use_api == 'pwa' ? ApiPWA$1 : ApiHttp$1; + + function Sisi(object) { + var comp = new Lampa.InteractionMain(object); + + comp.create = function() { + this.activity.loader(true); + Api.main(object, this.build.bind(this), this.empty.bind(this)); + return this.render(); + }; + + comp.empty = function(er) { + var _this = this; + + var empty = new Lampa.Empty({ + descr: typeof er == 'string' ? er : Lampa.Lang.translate('empty_text_two') + }); + Lampa.Activity.all().forEach(function(active) { + if (_this.activity == active.activity) active.activity.render().find('.activity__body > div')[0].appendChild(empty.render(true)); + }); + this.start = empty.start; + this.activity.loader(false); + this.activity.toggle(); + }; + + comp.onMore = function(data) { + Lampa.Activity.push({ + url: data.url, + title: data.title, + component: 'sisi_view_' + Defined.use_api, + page: 2 + }); + }; + + comp.onAppend = function(line, element) { + line.onAppend = function(card) { + var origFocus = card.onFocus; + + card.onFocus = function(target, card_data) { + origFocus(target, card_data); + Utils.preview(target, card_data); + }; + }; + }; + + return comp; + } + + function View(object) { + var comp = new Lampa.InteractionCategory(object); + var menu; + + comp.create = function() { + var _this = this; + + this.activity.loader(true); + Api.view(object, function(data) { + menu = data.menu; + + if (menu) { + menu.forEach(function(m) { + var spl = m.title.split(':'); + m.title = spl[0].trim(); + if (spl[1]) m.subtitle = Lampa.Utils.capitalizeFirstLetter(spl[1].trim().replace(/all/i, 'Любой')); + + if (m.submenu) { + m.submenu.forEach(function(s) { + s.title = Lampa.Utils.capitalizeFirstLetter(s.title.trim().replace(/all/i, 'Любой')); + }); + } + }); + } + + _this.build(data); + + if (!data.results.length && object.url.indexOf('/bookmarks')) { + Lampa.Noty.show('Удерживайте ОК на видео для добавления в закладки.', { + time: 10000 + }); + } + }, this.empty.bind(this)); + }; + + comp.nextPageReuest = function(object, resolve, reject) { + Api.view(object, resolve.bind(this), reject.bind(this)); + }; + + comp.cardRender = function(object, element, card) { + card.onMenu = function(target, card_data) { + return Utils.menu(target, card_data); + }; + + card.onEnter = function() { + Utils.hidePreview(); + Utils.play(element); + }; + + var origFocus = card.onFocus; + + card.onFocus = function(target, card_data) { + origFocus(target, card_data); + Utils.preview(target, element); + }; + }; + + comp.filter = function() { + if (menu) { + var items = menu.filter(function(m) { + return !m.search_on; + }); + var search = menu.find(function(m) { + return m.search_on; + }); + if (!search) search = object.search_start; + if (!items.length && !search) return; + + if (search) { + Lampa.Arrays.insert(items, 0, { + title: 'Найти', + onSelect: function onSelect() { + Lampa.Input.edit({ + title: 'Поиск', + value: '', + free: true, + nosave: true + }, function(value) { + Lampa.Controller.toggle('content'); + + if (value) { + Lampa.Activity.push({ + url: search.playlist_url + '?search=' + encodeURIComponent(value), + title: 'Поиск - ' + value, + component: 'sisi_view_' + Defined.use_api, + search_start: search, + page: 1 + }); + } + }); + } + }); + } + + Lampa.Select.show({ + title: 'Фильтр', + items: items, + onBack: function onBack() { + Lampa.Controller.toggle('content'); + }, + onSelect: function onSelect(a) { + menu.forEach(function(m) { + m.selected = m == a ? true : false; + }); + + if (a.submenu) { + Lampa.Select.show({ + title: a.title, + items: a.submenu, + onBack: function onBack() { + comp.filter(); + }, + onSelect: function onSelect(b) { + Lampa.Activity.push({ + title: object.title, + url: b.playlist_url, + component: 'sisi_view_' + Defined.use_api, + page: 1 + }); + } + }); + } else { + comp.filter(); + } + } + }); + } + }; + + comp.onRight = comp.filter.bind(comp); + return comp; + } + + function startPlugin() { + window['plugin_sisi_' + Defined.use_api + '_ready'] = true; + var unic_id = Lampa.Storage.get('sisi_unic_id', ''); + + if (!unic_id) { + unic_id = Lampa.Utils.uid(8).toLowerCase(); + Lampa.Storage.set('sisi_unic_id', unic_id); + } + + Lampa.Component.add('sisi_' + Defined.use_api, Sisi); + Lampa.Component.add('sisi_view_' + Defined.use_api, View); //Lampa.Search.addSource(Search) + + function addFilter() { + var activi; + var timer; + var button = $("
\n \n \n \n \n \n \n \n \n \n
"); + button.hide().on('hover:enter', function() { + if (activi) { + activi.activity.component().filter(); + } + }); + $('.head .open--search').after(button); + Lampa.Listener.follow('activity', function(e) { + if (e.type == 'start') activi = e.object; + clearTimeout(timer); + timer = setTimeout(function() { + if (activi) { + if (activi.component !== 'sisi_view_' + Defined.use_api) { + button.hide(); + activi = false; + } + } + }, 1000); + + if (e.type == 'start' && e.component == 'sisi_view_' + Defined.use_api) { + button.show(); + activi = e.object; + } + }); + } + + function addSettings() { + if (window.sisi_add_param_ready) return; + window.sisi_add_param_ready = true; + Lampa.SettingsApi.addComponent({ + component: 'sisi', + name: Lampa.Lang.translate('lampac_sisiname'), + icon: "" + }); + Lampa.SettingsApi.addParam({ + component: 'sisi', + param: { + name: 'sisi_preview', + type: 'trigger', + values: '', + "default": true + }, + field: { + name: 'Предпросмотр', + description: 'Показывать предпросмотр при наведение на карточку' + }, + onRender: function onRender(item) {} + }); + } + + function add() { + var button = $("
  • \n
    \n \n
    \n
    " + Lampa.Lang.translate('lampac_sisiname') + "
    \n
  • "); + + if (Defined.use_api == 'pwa') { + var pw = $('
    p
    '); + pw.css({ + position: 'absolute', + right: '-0.3em', + bottom: '-0.5em', + backgroundColor: '#fff', + color: '#000', + padding: '0.2em 0.4em', + fontSize: '0.6em', + borderRadius: '0.5em', + fontWeight: 900, + textTransform: 'uppercase' + }); + button.find('.menu__ico').css('position', 'relative').append(pw); + } + + button.on('hover:enter', function() { + Lampa.ParentalControl.query(function() { + Api.menu(function(data) { + // let items = [{ + // title: 'Все' + // }] + var items = []; + + if ({push_all} && (Defined.use_api == 'lampac' || Lampa.Platform.is('android'))) { + items.push({ + title: 'Все' + }); + } + + data.forEach(function(a) { + a.title = Utils.sourceTitle(a.title); + }); + items = items.concat(data); + Lampa.Select.show({ + title: 'Сайты', + items: items, + onSelect: function onSelect(a) { + if (a.playlist_url) { + Lampa.Activity.push({ + url: a.playlist_url, + title: a.title, + component: 'sisi_view_' + Defined.use_api, + page: 1 + }); + } else { + Lampa.Activity.push({ + url: '', + title: Lampa.Lang.translate('lampac_sisiname'), + component: 'sisi_' + Defined.use_api, + page: 1 + }); + } + }, + onBack: function onBack() { + Lampa.Controller.toggle('menu'); + } + }); + }, function() {}); + }, function() {}) + }); + $('.menu .menu__list').eq(0).append(button); + addFilter(); + addSettings(); + } + + if (window.appready) add(); + else { + Lampa.Listener.follow('app', function(e) { + if (e.type == 'ready') add(); + }); + } + } + + if (!window['plugin_sisi_' + Defined.use_api + '_ready']) { + startPlugin(); + /* + if(Defined.use_api == 'pwa'){ + let s = document.createElement('script') + s.onload = function(){ + Blazor.start({ + loadBootResource: function (type, name, defaultUri, integrity) { + return Defined.framework+'/_framework/' + name + } + }) + startPlugin() + } + s.setAttribute('autostart', 'false') + s.setAttribute('src', Defined.framework+'/_framework/blazor.webassembly.js') + + document.body.appendChild(s) + } + else startPlugin() + */ + } + +})(); diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1f0df5b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +--- +services: + + lampac: + image: immisterio/lampac:latest + container_name: lampac + restart: always + ports: + - 9118:9118 + volumes: +# - /HDD1/Torrents:/home/dlna + # - /srv/docker/lampac/sisi.js:/home/plugins/sisi.js + # - /srv/docker/lampac/manifest.json:/home/module/manifest.json + - /root/lampac/plugins/extensions.json:/home/plugins/extensions.json + - type: bind + source: /root/lampac/configs/init.conf + target: /home/init.conf + read_only: true diff --git a/lampac.code-workspace b/lampac.code-workspace new file mode 100644 index 0000000..9ab06f0 --- /dev/null +++ b/lampac.code-workspace @@ -0,0 +1,11 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../../srv/docker/lampac" + } + ], + "settings": {} +} \ No newline at end of file diff --git a/plugins/extensions.json b/plugins/extensions.json new file mode 100644 index 0000000..2c9ce2e --- /dev/null +++ b/plugins/extensions.json @@ -0,0 +1,109 @@ +{ + "secuses": true, + "results": [ + { + "title": "Рекомендуем", + "results": [ + { + "name": "MODS's", + "author": "@modss_group", + "link": "http://lampa.stream/modss", + "descr": "Фильмы и сериалы в онлайн. Плюс различные дополнения через меню настроек Modss", + "available_lampa": 1 + }, + { + "name": "Клубничка 18+", + "author": "bwa.to", + "link": "http://bwa.to/re", + "descr": "Онлайн просмотр контента для взрослых, больше 30 сайтов", + "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": "@VitalikPVA", + "link": "{localhost}/plugins/torrents.js", + "descr": "Плагин добавляет вторую кнопку Торренты", + "available_lampa": 1 + }, + { + "name": "Кинопоиск", + "author": "and7ey", + "link": "https://and7ey.github.io/lampa/kinopoisk.js", + "descr": "Отображает в приложении список фильмов из папки Буду смотреть на Кинопоиске", + "available_lampa": 1 + }, + { + "name": "Оригинальные названия", + "author": "@BDV_Burik", + "link": "https://bdvburik.github.io/title.js", + "descr": "Добавляет оригинальные названия к фильмам, сериалам.", + "available_lampa": 1 + }, + { + "name": "Отзывы и рецензии", + "author": "@elenatv99", + "link": "https://lampaplugins.github.io/store/o.js", + "descr": "Добавляет кнопку чтения отзывов с КиноПоиск в карточку фильма или сериала", + "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.js", + "descr": "Плагин визуализации предзагрузки торрентов для встроенного клиента TorrServer", + "available_lampa": 1 + }, + { + "name": "Торрент1", + "author": "@rootu", + "link": "https://lampame.github.io/main/torrentmanager.js", + "descr": "Плагин управления торрентами", + "available_lampa": 1 + }, + { + "name": "Торрент1", + "author": "@rootu", + "link": "https://lampame.github.io/td/td.js", + "descr": "Плагин управления торрентами", + "available_lampa": 1 + }, + { + "name": "Поиск локального TorrServer", + "author": "@AndreyURL54", + "link": "{localhost}/plugins/checker.js", + "descr": "Плагин позволяет произвести поиск вашего локального TorrServer", + "available_lampa": 1 + } + ], + "hpu": "best" + } + ] + } \ No newline at end of file diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..05e5d99 --- /dev/null +++ b/update.sh @@ -0,0 +1,5 @@ +#!/bin/bash +cd /root/Lampac +docker compose pull +docker compose up -d --remove-orphans +docker image prune -f