stremiok 2.3.5 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +18 -15
- package/config.xml +2 -1
- package/css/style.css +1 -0
- package/index.html +43 -42
- package/js/lang/ar.js +94 -5
- package/js/lang/de.js +102 -13
- package/js/lang/es.js +92 -3
- package/js/lang/fi.js +98 -9
- package/js/lang/fr.js +102 -13
- package/js/lang/he.js +94 -5
- package/js/lang/hi.js +94 -5
- package/js/lang/it.js +94 -5
- package/js/lang/ja.js +94 -5
- package/js/lang/ko.js +92 -3
- package/js/lang/pl.js +118 -29
- package/js/lang/pt-BR.js +92 -3
- package/js/lang/ru.js +94 -5
- package/js/lang/tr.js +94 -5
- package/js/lang/zh-CN.js +96 -7
- package/js/local.js +63 -18
- package/js/netfolders.js +76 -8
- package/js/player-audio.js +16 -8
- package/js/player-controls.js +68 -0
- package/js/player-core.js +129 -9
- package/js/player-lang.js +16 -0
- package/js/player-store.js +7 -2
- package/js/player-subs.js +267 -17
- package/js/plugins.js +306 -0
- package/js/stremio.js +57 -8
- package/js/util.js +10 -1
- package/js/vendor/quickjs/LICENSES.md +412 -0
- package/js/vendor/quickjs/crypto-js.js +6659 -0
- package/js/vendor/quickjs/plugin-worker-legacy.js +1364 -0
- package/js/vendor/quickjs/plugin-worker.js +8774 -0
- package/js/vendor/quickjs/quickjs.wasm +0 -0
- package/js/view-core.js +2 -2
- package/js/view-detail.js +18 -7
- package/js/view-settings.js +251 -15
- package/js/ytplay.js +60 -7
- package/package.json +1 -1
- package/service/index.js +1884 -67
- package/tizenbrew.html +1 -1
|
Binary file
|
package/js/view-core.js
CHANGED
|
@@ -144,7 +144,7 @@ var ViewParts = {};
|
|
|
144
144
|
// that shows it to copy or download; kept open while the QR is on screen (asked every
|
|
145
145
|
// GIVE_POLL_MS, which also says once the phone has it), closed with Done.
|
|
146
146
|
var GIVE_POLL_MS = 3000;
|
|
147
|
-
function phoneGive(title, text, note) {
|
|
147
|
+
function phoneGive(title, text, note, kind) { // (kind: 'logs' for the logs' own page; else a configuration)
|
|
148
148
|
var existing = document.querySelector('.modal-overlay');
|
|
149
149
|
if (existing) { existing.parentNode.removeChild(existing); }
|
|
150
150
|
var overlay = U.el('div', 'modal-overlay'), box = U.el('div', 'modal-box qr-box');
|
|
@@ -171,7 +171,7 @@ var ViewParts = {};
|
|
|
171
171
|
}, GIVE_POLL_MS);
|
|
172
172
|
}
|
|
173
173
|
if (typeof YTPlay === 'undefined' || !YTPlay.entryGive) { how.textContent = U.t('It needs StremioK’s service on the TV (not in a desktop browser).'); return; }
|
|
174
|
-
YTPlay.entryGive(text).then(function (r) {
|
|
174
|
+
YTPlay.entryGive(text, kind).then(function (r) {
|
|
175
175
|
if (over) { if (r && r.token) { YTPlay.entryClose(r.token); } return; }
|
|
176
176
|
if (!r || !r.url) { throw new Error('no page'); }
|
|
177
177
|
token = r.token;
|
package/js/view-detail.js
CHANGED
|
@@ -1629,15 +1629,19 @@
|
|
|
1629
1629
|
U.store.set(UNSUIT_KEY, all);
|
|
1630
1630
|
}
|
|
1631
1631
|
// Hold OK on a source: Play from the start (a place to resume), Play through StremioK's service
|
|
1632
|
-
// (
|
|
1632
|
+
// (see serviceHlsOk), Not suitable (or back), and
|
|
1633
1633
|
// with a USB drive plugged in, Download to it (js/downloads.js). With only Not suitable to
|
|
1634
1634
|
// offer, it's asked at once.
|
|
1635
|
-
//
|
|
1636
|
-
//
|
|
1635
|
+
// A source on the internet (not YouTube, DRM, a USB file or the service's own links): Play
|
|
1636
|
+
// through StremioK's service, this once. An HLS one through its relay (Settings › Playback ›
|
|
1637
|
+
// Seeking & buffering › HLS through StremioK's service, for all of them; not under TizenBrew,
|
|
1638
|
+
// whose page player can't take it), a file through the file relay (player-core's fileViaService).
|
|
1637
1639
|
function serviceHlsOk(stream) {
|
|
1638
1640
|
if (!stream || stream._yt || stream._localFile || stream._drm || typeof YTPlay === 'undefined' || YTPlay.installMode() === 'browser') { return false; }
|
|
1639
1641
|
var url = '' + (stream.url || '');
|
|
1640
|
-
|
|
1642
|
+
if (!/^https?:\/\//i.test(url) || /^http:\/\/(localhost|127\.0\.0\.1)[:\/]/i.test(url) || /\.mpd(?:[?#]|$)/i.test(url)) { return false; }
|
|
1643
|
+
var hls = /\.m3u8?(?:[?#]|$)/i.test(url) || Stremio.streamInfo(stream).container === 'hls';
|
|
1644
|
+
return !hls || YTPlay.installMode() !== 'tizenbrew';
|
|
1641
1645
|
}
|
|
1642
1646
|
function sourceMenu(stream) {
|
|
1643
1647
|
var canStart = !howHere() && savedPlace(_d.streamId);
|
|
@@ -2115,19 +2119,26 @@
|
|
|
2115
2119
|
// how.converted: played converted by the streaming server, so its formats aren't learned
|
|
2116
2120
|
// (they didn't play on the TV); Played before and the kept source still are.
|
|
2117
2121
|
function learnFor(st, how) {
|
|
2118
|
-
var info = Stremio.streamInfo(st)
|
|
2122
|
+
var info = Stremio.streamInfo(st);
|
|
2123
|
+
// (the formats learned: the file's own, its header read by then — the player's
|
|
2124
|
+
// formatInfo, corrected by it — else as its name says)
|
|
2125
|
+
function fkeysOf(playing) {
|
|
2126
|
+
if (how && how.converted) { return []; }
|
|
2127
|
+
var p = playing || ctx, fi = p && p.stream === st && p.formatInfo && p.formatInfo.fromFile ? p.formatInfo : info;
|
|
2128
|
+
return Stremio.formatKeys(fi);
|
|
2129
|
+
}
|
|
2119
2130
|
return {
|
|
2120
2131
|
// (private viewing: nothing about this playback remembered or forgotten — its own
|
|
2121
2132
|
// flag, set when it started, see player-store; what plays on this TV is still learned)
|
|
2122
2133
|
// (playing: the playback it's about, as it is now — another source's is a copy)
|
|
2123
2134
|
onStarted: function (err, playing) {
|
|
2124
|
-
Stremio.recordFormats(
|
|
2135
|
+
Stremio.recordFormats(fkeysOf(playing), true);
|
|
2125
2136
|
if ((playing || ctx || {}).private) { return; }
|
|
2126
2137
|
if (remembers) { rememberPlayed(titleId, st, info); Stremio.keepSource(vtype, videoId, st); } // (kept: listed when its addon is late, see Stremio.keptSources)
|
|
2127
2138
|
if (series && st._addon) { rememberSeriesSource(titleId, st); }
|
|
2128
2139
|
},
|
|
2129
2140
|
onFailed: function (err, playing) {
|
|
2130
|
-
Stremio.recordFormats(
|
|
2141
|
+
Stremio.recordFormats(fkeysOf(playing), false, err, fileIdentity(st));
|
|
2131
2142
|
if (remembers && !(playing || ctx || {}).private) { forgetPlayed(titleId, st, info); Stremio.forgetSource(vtype, videoId, st); }
|
|
2132
2143
|
if (page) { page.directFailed = true; } // (played straight away and failed: its source list next)
|
|
2133
2144
|
}
|
package/js/view-settings.js
CHANGED
|
@@ -404,6 +404,7 @@
|
|
|
404
404
|
[U.t('USB drive'), U.t('The Local tab: what\'s on your drive, matched to titles; hidden files'), 'usb'],
|
|
405
405
|
[U.t('Network folders'), U.t('Folders a NAS or computer shares over WebDAV, in the Local tab: their videos as sources'), 'netfolders'],
|
|
406
406
|
[U.t('Media servers'), U.t('Your Jellyfin or Emby server: its libraries on Home, its files as sources'), 'mediaservers'],
|
|
407
|
+
[U.t('Nuvio plugins'), U.t('Programs written for the Nuvio apps that look for sources: someone else’s code, run on your TV'), 'plugins'],
|
|
407
408
|
[U.t('Import configuration file'), U.t('Import addons, API keys & IPTV playlists'), 'import'],
|
|
408
409
|
[U.t('Export configuration'), U.t('Your addons, playlists, API keys and settings, to your phone'), 'export']] },
|
|
409
410
|
playback: { title: U.t('Playback'), rows: [
|
|
@@ -467,6 +468,7 @@
|
|
|
467
468
|
else if (_settingsSection === 'usb') { settingsUsb(wrap); }
|
|
468
469
|
else if (_settingsSection === 'netfolders') { settingsNetFolders(wrap); }
|
|
469
470
|
else if (_settingsSection === 'mediaservers') { settingsMediaServers(wrap); }
|
|
471
|
+
else if (_settingsSection === 'plugins') { settingsPlugins(wrap); }
|
|
470
472
|
else if (_settingsSection === 'private') { settingsPrivate(wrap); }
|
|
471
473
|
else if (_settingsSection === 'appshortcuts') { settingsAppShortcuts(wrap); }
|
|
472
474
|
else if (_settingsSection === 'import') { settingsImport(wrap); }
|
|
@@ -533,7 +535,10 @@
|
|
|
533
535
|
function settingsGroup(wrap, key) {
|
|
534
536
|
var g = SETTINGS_GROUPS[key];
|
|
535
537
|
wrap.appendChild(U.el('h2', null, g.title));
|
|
536
|
-
g.rows.forEach(function (row) {
|
|
538
|
+
g.rows.forEach(function (row) {
|
|
539
|
+
if (row[2] === 'plugins' && !(typeof Plugins !== 'undefined' && Plugins.supported())) { return; } // (a TV that can't run them: not offered)
|
|
540
|
+
wrap.appendChild(sectionRow(row[0], row[1], row[2]));
|
|
541
|
+
});
|
|
537
542
|
if (key === 'diagnostics') {
|
|
538
543
|
if (typeof YTPlay !== 'undefined' && YTPlay.installMode && YTPlay.installMode() === 'tizenbrew') { wrap.appendChild(U.el('div', 'hint', TIZENBREW_NOTE)); }
|
|
539
544
|
// How StremioK was installed, and whether its YouTube service (channels, trailers) answers
|
|
@@ -937,10 +942,11 @@
|
|
|
937
942
|
if (imported.tmdb) { parts.push(U.t('TMDB key')); }
|
|
938
943
|
if (imported.mdblist) { parts.push(U.t('MDBList key')); }
|
|
939
944
|
if (imported.settings) { parts.push(U.t('your settings')); }
|
|
945
|
+
if (imported.history) { parts.push(U.t('your history')); }
|
|
940
946
|
if (imported.addons || imported.playlists) { clearCatalogCache(); }
|
|
941
947
|
var message = parts.length ? U.t('Imported: {what}', { what: parts.join(', ') }) : U.t('Nothing imported');
|
|
942
948
|
if (parsed.ignored) { message += ' ' + U.t('({n} ignored)', { n: parsed.ignored }); }
|
|
943
|
-
if (imported.settings) { // (every part of StremioK reads them afresh)
|
|
949
|
+
if (imported.settings || imported.history) { // (every part of StremioK reads them afresh)
|
|
944
950
|
U.toast(message + '. StremioK starts again with them…', 4000);
|
|
945
951
|
setTimeout(function () { try { window.location.reload(); } catch (e) {} }, 2500);
|
|
946
952
|
return;
|
|
@@ -949,7 +955,27 @@
|
|
|
949
955
|
renderSettings();
|
|
950
956
|
});
|
|
951
957
|
}
|
|
952
|
-
//
|
|
958
|
+
// A USB drive to save to or read from (the only one, else picked): then(drive). None: said so.
|
|
959
|
+
function usbDrive(then) {
|
|
960
|
+
if (typeof LocalMedia === 'undefined' || !LocalMedia.drives) { U.toast(U.t('No USB drive found'), 3000); return; }
|
|
961
|
+
LocalMedia.drives().then(function (list) {
|
|
962
|
+
var usb = (list || []).filter(function (d) { return /^\/opt\/media\/[^\/]+$/.test(d.root || ''); });
|
|
963
|
+
if (!usb.length) { U.toast(U.t('No USB drive found'), 3000); return; }
|
|
964
|
+
if (usb.length === 1) { then(usb[0]); return; }
|
|
965
|
+
pickList(U.t('Which USB drive?'), usb.map(function (d) { return [d.root, d.label || d.root]; }), null, function (root) {
|
|
966
|
+
then(usb.filter(function (d) { return d.root === root; })[0]);
|
|
967
|
+
});
|
|
968
|
+
}, function () { U.toast(U.t('No USB drive found'), 3000); });
|
|
969
|
+
}
|
|
970
|
+
// Written to a drive's StremioK folder (the service: YTPlay.bakWrite), said so.
|
|
971
|
+
function saveToDrive(d, kind, text) {
|
|
972
|
+
U.toast(U.t('Saving to {drive}…', { drive: d.label || d.root }), 3000);
|
|
973
|
+
YTPlay.bakWrite(d.root, kind, text).then(function (r) {
|
|
974
|
+
U.toast(U.t('Saved to {drive}: {file}. Wait a few seconds before you take the drive out.', { drive: d.label || d.root, file: r && r.file || 'StremioK' }), 6000);
|
|
975
|
+
}, function (e) { U.toast(U.t('Couldn’t save to the drive: {why}', { why: U.problem(e) }), 6000); });
|
|
976
|
+
}
|
|
977
|
+
function canUseDrives() { return typeof YTPlay !== 'undefined' && YTPlay.bakWrite && YTPlay.installMode() !== 'browser'; }
|
|
978
|
+
// Settings › Content › Export configuration: what goes in, ticked at first (not your history), given to your
|
|
953
979
|
// phone (V.phoneGive) as the file Import configuration file reads (Stremio.exportSetup).
|
|
954
980
|
function settingsExport(wrap) {
|
|
955
981
|
wrap.appendChild(U.el('h2', null, U.t('Export configuration')));
|
|
@@ -959,12 +985,25 @@
|
|
|
959
985
|
row.__onselect = function () {
|
|
960
986
|
var groups = Stremio.exportGroups();
|
|
961
987
|
pickMany(U.t('Tick what to export'), groups.map(function (g) { return { key: g.key, label: g.label }; }),
|
|
962
|
-
{ on: groups.map(function (g) { return g.key; }), button: function (n) { return U.t('Export {n}', { n: n }); } }, function (keys) {
|
|
988
|
+
{ on: groups.filter(function (g) { return !g.off; }).map(function (g) { return g.key; }), button: function (n) { return U.t('Export {n}', { n: n }); } }, function (keys) {
|
|
963
989
|
V.phoneGive(U.t('Export configuration'), Stremio.exportSetup(keys, appVersion()),
|
|
964
|
-
U.t('It holds your addon links, playlist logins, API keys and MAC addresses: keep the file private. Not in it: your Trakt sign-in
|
|
990
|
+
U.t('It holds your addon links, playlist logins, API keys and MAC addresses: keep the file private. Not in it: your Trakt sign-in.'));
|
|
965
991
|
});
|
|
966
992
|
};
|
|
967
993
|
wrap.appendChild(row);
|
|
994
|
+
if (canUseDrives()) { // (the same file on a USB drive, for when the phone's page can't be reached)
|
|
995
|
+
var usb = U.el('div', 'addon-item focusable add-row');
|
|
996
|
+
usb.appendChild(U.el('div', 'a-name', U.t('⇩ Save to a USB drive')));
|
|
997
|
+
usb.appendChild(U.el('div', 'a-url', U.t('The same file, in a StremioK folder on the drive (the last one replaced)')));
|
|
998
|
+
usb.__onselect = function () {
|
|
999
|
+
var groups = Stremio.exportGroups();
|
|
1000
|
+
pickMany(U.t('Tick what to export'), groups.map(function (g) { return { key: g.key, label: g.label }; }),
|
|
1001
|
+
{ on: groups.filter(function (g) { return !g.off; }).map(function (g) { return g.key; }), button: function (n) { return U.t('Export {n}', { n: n }); } }, function (keys) {
|
|
1002
|
+
usbDrive(function (d) { saveToDrive(d, 'backup', Stremio.exportSetup(keys, appVersion())); });
|
|
1003
|
+
});
|
|
1004
|
+
};
|
|
1005
|
+
wrap.appendChild(usb);
|
|
1006
|
+
}
|
|
968
1007
|
wrap.appendChild(U.el('div', 'hint', U.t('To restore it (after a reinstall, or on another TV): Import configuration file › ▣ From your phone, then choose the file there (or paste it).')));
|
|
969
1008
|
focusSettings();
|
|
970
1009
|
}
|
|
@@ -992,7 +1031,7 @@
|
|
|
992
1031
|
// you're on stays: back to Settings only from this entry, still showing)
|
|
993
1032
|
var entry = scr('addaddon'), mine = ++_importGen;
|
|
994
1033
|
function here() { return mine === _importGen && !/\bhidden\b/.test(entry.className); }
|
|
995
|
-
U.getText(v, 15000,
|
|
1034
|
+
U.getText(v, 15000, 1536 * 1024).then(function (text) { // (a list of URLs and keys, your history too: 1.5 MB at most)
|
|
996
1035
|
importText(text, here);
|
|
997
1036
|
}, function (err) {
|
|
998
1037
|
if (!here()) { return; }
|
|
@@ -1007,6 +1046,22 @@
|
|
|
1007
1046
|
});
|
|
1008
1047
|
};
|
|
1009
1048
|
wrap.appendChild(listRow);
|
|
1049
|
+
if (canUseDrives()) { // (a backup Export configuration saved on a USB drive)
|
|
1050
|
+
var fromUsb = U.el('div', 'addon-item focusable add-row');
|
|
1051
|
+
fromUsb.appendChild(U.el('div', 'a-name', U.t('⇧ Restore from a USB drive')));
|
|
1052
|
+
fromUsb.appendChild(U.el('div', 'a-url', U.t('A backup saved there: StremioK/stremiok-backup.txt')));
|
|
1053
|
+
fromUsb.__onselect = function () {
|
|
1054
|
+
usbDrive(function (d) {
|
|
1055
|
+
YTPlay.bakRead(d.root).then(function (r) {
|
|
1056
|
+
++_importGen;
|
|
1057
|
+
importText(r && typeof r.text === 'string' ? r.text : '', function () { return false; });
|
|
1058
|
+
}, function (e) {
|
|
1059
|
+
U.toast(/HTTP 404/.test((e && e.message) || '') ? U.t('No backup on {drive}', { drive: d.label || d.root }) : U.t('Couldn’t read the drive: {why}', { why: U.problem(e) }), 5000);
|
|
1060
|
+
});
|
|
1061
|
+
});
|
|
1062
|
+
};
|
|
1063
|
+
wrap.appendChild(fromUsb);
|
|
1064
|
+
}
|
|
1010
1065
|
wrap.appendChild(U.el('div', 'hint',
|
|
1011
1066
|
U.t('Accepted lines: addon URLs, M3U/M3U8 URLs, and OMDb, TMDB or MDBList API keys.')));
|
|
1012
1067
|
focusSettings();
|
|
@@ -1712,6 +1767,85 @@
|
|
|
1712
1767
|
}
|
|
1713
1768
|
|
|
1714
1769
|
// ---- Media servers: your Jellyfin servers ----
|
|
1770
|
+
// Settings › Content › Nuvio plugins (js/plugins.js): on / off (after a warning), the
|
|
1771
|
+
// repositories you added, each one's plugins on / off. Only on a TV that can run them.
|
|
1772
|
+
function settingsPlugins(wrap) {
|
|
1773
|
+
wrap.appendChild(U.el('h2', null, U.t('Nuvio plugins')));
|
|
1774
|
+
if (typeof Plugins === 'undefined' || !Plugins.supported()) {
|
|
1775
|
+
wrap.appendChild(U.el('div', 'hint', U.t('Nuvio plugins need a 2017 or newer TV and the sideloaded app.')));
|
|
1776
|
+
focusSettings(); return;
|
|
1777
|
+
}
|
|
1778
|
+
var on = Plugins.isEnabled(), focus = null;
|
|
1779
|
+
var sw = U.el('div', 'addon-item focusable cfg-row');
|
|
1780
|
+
sw.appendChild(U.el('div', 'a-name', U.t('Nuvio plugins:') + ' ' + (on ? U.t('On') : U.t('Off'))));
|
|
1781
|
+
sw.appendChild(U.el('div', 'a-url', (on ? U.t('Your plugins look for sources on title pages') : U.t('Off: no plugin runs'))
|
|
1782
|
+
+ ' · ' + (on ? U.t('OK to turn off') : U.t('OK to turn on'))));
|
|
1783
|
+
sw.__onselect = function () {
|
|
1784
|
+
_focusChild = 'pl:switch';
|
|
1785
|
+
if (on) { Plugins.setEnabled(false); renderSettings(); return; }
|
|
1786
|
+
confirm(U.t('Nuvio plugins are someone else’s code, run on your TV. StremioK keeps them apart from your settings and files, but they can reach any website, they learn which titles you open, and they’re given your TMDB key. StremioK doesn’t check what they find, and gives no help with any particular plugin. Turn them on?'),
|
|
1787
|
+
U.t('Turn on'), function () { Plugins.setEnabled(true); renderSettings(); });
|
|
1788
|
+
};
|
|
1789
|
+
if (_focusChild === 'pl:switch') { focus = sw; }
|
|
1790
|
+
wrap.appendChild(sw);
|
|
1791
|
+
if (!Stremio.getIntegrations().tmdb) { wrap.appendChild(U.el('div', 'hint', U.t('Plugins look titles up by their TMDB number: add a TMDB key in Settings › Content › Integrations.'))); }
|
|
1792
|
+
if (Plugins.experimental()) { wrap.appendChild(U.el('div', 'hint', U.t('Experimental on this TV: plugins haven’t been tried on its generation yet, and run slower here (one at a time).'))); }
|
|
1793
|
+
else if (Plugins.slower()) { wrap.appendChild(U.el('div', 'hint', U.t('Plugins run slower on this TV than on 2021 and newer ones (one at a time).'))); }
|
|
1794
|
+
var add = U.el('div', 'addon-item focusable cfg-row');
|
|
1795
|
+
add.appendChild(U.el('div', 'a-name', U.t('+ Add a repository')));
|
|
1796
|
+
add.appendChild(U.el('div', 'a-url', U.t('Its address (a manifest.json): its plugins are listed, each off until you turn it on')));
|
|
1797
|
+
add.__onselect = function () {
|
|
1798
|
+
App.openEntry({
|
|
1799
|
+
title: U.t('Nuvio plugins: repository'), hint: U.t('Its address, like https://example.com/plugins/manifest.json. RETURN cancels.'),
|
|
1800
|
+
value: 'https://', placeholder: 'https://example.com/plugins/manifest.json', phone: 'plugins',
|
|
1801
|
+
validate: function (v) { return Plugins.addressProblem(v); },
|
|
1802
|
+
onConfirm: function (url) {
|
|
1803
|
+
App.back();
|
|
1804
|
+
U.spinner(true, U.t('Reading the repository…'));
|
|
1805
|
+
Plugins.addRepo(url).then(function (r) {
|
|
1806
|
+
U.spinner(false);
|
|
1807
|
+
U.toast(U.tn(r.repo.plugins.length, 'Added “{name}”: {n} plugin (off until you turn it on)', 'Added “{name}”: {n} plugins (off until you turn them on)', { name: r.repo.name }), 5000);
|
|
1808
|
+
_focusChild = 'pl:' + r.repo.id;
|
|
1809
|
+
renderSettings();
|
|
1810
|
+
}, function (e) { U.spinner(false); U.toast(U.t('Couldn’t add it: {why}', { why: U.problem(e) }), 6000); });
|
|
1811
|
+
}
|
|
1812
|
+
});
|
|
1813
|
+
};
|
|
1814
|
+
wrap.appendChild(add);
|
|
1815
|
+
Plugins.repos().forEach(function (r) {
|
|
1816
|
+
var row = U.el('div', 'addon-item focusable cfg-row');
|
|
1817
|
+
row.appendChild(U.el('div', 'a-name', '📦 ' + r.name));
|
|
1818
|
+
row.appendChild(U.el('div', 'a-url', r.url + ' · ' + U.tn(r.plugins.length, '{n} plugin', '{n} plugins') + ' · ' + U.t('OK: refresh or remove')));
|
|
1819
|
+
row.__onselect = function () {
|
|
1820
|
+
pickList(r.name, [['refresh', U.t('↻ Refresh')], ['remove', U.t('Remove')]], null, function (v) {
|
|
1821
|
+
_focusChild = 'pl:' + r.id;
|
|
1822
|
+
if (v === 'refresh') {
|
|
1823
|
+
U.spinner(true, U.t('Reading the repository…'));
|
|
1824
|
+
Plugins.refreshRepo(r.id).then(function (x) {
|
|
1825
|
+
U.spinner(false);
|
|
1826
|
+
U.toast(U.t('“{name}”: {added} new, {changed} changed', { name: r.name, added: x.added, changed: x.changed }) + (x.failed ? ' · ' + U.tn(x.failed, '{n} didn’t come (kept as it was)', '{n} didn’t come (kept as they were)') : ''), 5000);
|
|
1827
|
+
renderSettings();
|
|
1828
|
+
}, function (e) { U.spinner(false); U.toast(U.t('Couldn’t refresh it: {why}', { why: U.problem(e) }), 6000); });
|
|
1829
|
+
} else {
|
|
1830
|
+
confirm(U.t('Remove “{name}” and its plugins?', { name: r.name }), U.t('Remove'), function () { Plugins.removeRepo(r.id); renderSettings(); });
|
|
1831
|
+
}
|
|
1832
|
+
});
|
|
1833
|
+
};
|
|
1834
|
+
if (_focusChild === 'pl:' + r.id) { focus = row; }
|
|
1835
|
+
wrap.appendChild(row);
|
|
1836
|
+
r.plugins.forEach(function (p) {
|
|
1837
|
+
var pr = U.el('div', 'addon-item focusable cfg-row');
|
|
1838
|
+
pr.appendChild(U.el('div', 'a-name', ' ' + (p.on ? '✓ ' : '○ ') + p.name + (p.version ? ' ' + p.version : '')));
|
|
1839
|
+
var kinds = p.types.map(function (t) { return t === 'tv' ? U.t('Series') : U.t('Movies'); }).join(', ');
|
|
1840
|
+
pr.appendChild(U.el('div', 'a-url', ' ' + kinds + ' · ' + (p.on ? U.t('On') : U.t('Off')) + (p.authorOff ? ' · ' + U.t('off in its repository (often broken)') : '') + ' · ' + (p.on ? U.t('OK to turn off') : U.t('OK to turn on'))));
|
|
1841
|
+
pr.__onselect = function () { _focusChild = 'pp:' + r.id + '.' + p.id; Plugins.setPlugin(r.id, p.id, !p.on); renderSettings(); };
|
|
1842
|
+
if (_focusChild === 'pp:' + r.id + '.' + p.id) { focus = pr; }
|
|
1843
|
+
wrap.appendChild(pr);
|
|
1844
|
+
});
|
|
1845
|
+
});
|
|
1846
|
+
wrap.appendChild(U.el('div', 'hint', U.t('Repositories come only from addresses you add. Their sources show with your addons’ (From: Nuvio plugins). The plugin format is the Nuvio project’s; StremioK isn’t affiliated with it.')));
|
|
1847
|
+
if (focus) { _focusChild = null; Focus.setScope(scr('settings'), focus); } else { focusSettings(); }
|
|
1848
|
+
}
|
|
1715
1849
|
function settingsMediaServers(wrap) {
|
|
1716
1850
|
wrap.appendChild(U.el('h2', null, U.t('Media servers')));
|
|
1717
1851
|
var have = typeof Jellyfin !== 'undefined';
|
|
@@ -1927,6 +2061,7 @@
|
|
|
1927
2061
|
wrap.appendChild(subPickRow(U.t('Edge'), plain(Player.SUB_EDGES), 'edge'));
|
|
1928
2062
|
wrap.appendChild(subPickRow(U.t('Position'), plain(Player.SUB_POSITIONS), 'pos'));
|
|
1929
2063
|
wrap.appendChild(subPickRow(U.t('Font'), Player.SUB_FONTS, 'font'));
|
|
2064
|
+
wrap.appendChild(subPickRow(U.t('The file\'s colors'), SUB_ONLY, 'fileColors')); // (a file's own colors instead of Color: player-subs' drawCues)
|
|
1930
2065
|
focusSettings();
|
|
1931
2066
|
}
|
|
1932
2067
|
|
|
@@ -1942,14 +2077,16 @@
|
|
|
1942
2077
|
var RECONNECTS = [['off', U.t('Off')], ['few', U.t('A few times (3 in 5 minutes)')], ['always', U.t('Keep trying')]];
|
|
1943
2078
|
// (an HLS source through the service, with its own headers on every piece: see player-core's viaService)
|
|
1944
2079
|
var HLS_ROUTES = [['off', U.t('Off')], ['headers', U.t('Sources that need headers')], ['all', U.t('All HLS sources')]];
|
|
2080
|
+
var FILE_INFOS = [['usb', U.t('USB drives only')], ['all', U.t('All files')], ['off', U.t('Off')]];
|
|
1945
2081
|
function settingsSeeking(wrap) {
|
|
1946
2082
|
wrap.appendChild(U.el('h2', null, U.t('Seeking & buffering')));
|
|
1947
|
-
var store = { get: function () { var c = Player.playerCfg(); return { seek: '' + c.seek, buffer: c.buffer, reconnect: c.reconnect, hls: c.hls }; },
|
|
1948
|
-
set: function (cfg) { Player.setPlayerCfg({ seek: +cfg.seek || 10, buffer: cfg.buffer, reconnect: cfg.reconnect, hls: cfg.hls }); } };
|
|
2083
|
+
var store = { get: function () { var c = Player.playerCfg(); return { seek: '' + c.seek, buffer: c.buffer, reconnect: c.reconnect, hls: c.hls, fileInfo: c.fileInfo }; },
|
|
2084
|
+
set: function (cfg) { Player.setPlayerCfg({ seek: +cfg.seek || 10, buffer: cfg.buffer, reconnect: cfg.reconnect, hls: cfg.hls, fileInfo: cfg.fileInfo }); } };
|
|
1949
2085
|
wrap.appendChild(subPickRow(U.t('Seek step'), [['5', '5 s'], ['10', '10 s'], ['15', '15 s'], ['30', '30 s']], 'seek', store));
|
|
1950
2086
|
wrap.appendChild(subPickRow(U.t('Buffer'), [['normal', U.t('Normal (the TV’s own)')], ['more', U.t('More')], ['most', U.t('Most')]], 'buffer', store));
|
|
1951
2087
|
wrap.appendChild(subPickRow(U.t('Reconnect live channels'), RECONNECTS, 'reconnect', store));
|
|
1952
2088
|
wrap.appendChild(subPickRow(U.t('HLS through StremioK’s service'), HLS_ROUTES, 'hls', store));
|
|
2089
|
+
wrap.appendChild(subPickRow(U.t('Read the file’s details'), FILE_INFOS, 'fileInfo', store)); // (its codec, HDR, tracks and their names: player-core's fileInfoAsk)
|
|
1953
2090
|
wrap.appendChild(U.el('div', 'hint', 'Seek step: FF / REW jump three. Buffer: More or Most starts slower but stops less on a slow connection. Reconnect: a live channel that drops opens again (BACK stops it). HLS through StremioK’s service: for a host that wants headers the TV’s player can’t send; a step more before it starts.'));
|
|
1954
2091
|
focusSettings();
|
|
1955
2092
|
}
|
|
@@ -1990,6 +2127,20 @@
|
|
|
1990
2127
|
clear.__onselect = function () { U.clearLog(); renderSettings(); };
|
|
1991
2128
|
wrap.appendChild(clear);
|
|
1992
2129
|
}
|
|
2130
|
+
var send = U.el('div', 'addon-item focusable');
|
|
2131
|
+
send.appendChild(U.el('div', 'a-name', U.t('⇧ Send to your phone')));
|
|
2132
|
+
send.appendChild(U.el('div', 'a-url', U.t('These logs and Startup, with StremioK’s version and the TV’s, as a text file to attach to a report')));
|
|
2133
|
+
send.__onselect = function () {
|
|
2134
|
+
V.phoneGive(U.t('Send the logs to your phone'), logsText(), U.t('Keys and passwords are masked; still, look it over before sharing it publicly.'), 'logs');
|
|
2135
|
+
};
|
|
2136
|
+
wrap.appendChild(send);
|
|
2137
|
+
if (canUseDrives()) {
|
|
2138
|
+
var toUsb = U.el('div', 'addon-item focusable');
|
|
2139
|
+
toUsb.appendChild(U.el('div', 'a-name', U.t('⇩ Save to a USB drive')));
|
|
2140
|
+
toUsb.appendChild(U.el('div', 'a-url', U.t('The same text file, in a StremioK folder on the drive')));
|
|
2141
|
+
toUsb.__onselect = function () { usbDrive(function (d) { saveToDrive(d, 'logs', logsText()); }); };
|
|
2142
|
+
wrap.appendChild(toUsb);
|
|
2143
|
+
}
|
|
1993
2144
|
startupLines(wrap);
|
|
1994
2145
|
focusSettings();
|
|
1995
2146
|
}
|
|
@@ -2072,8 +2223,12 @@
|
|
|
2072
2223
|
}
|
|
2073
2224
|
var add = U.el('div', 'addon-item focusable cfg-row');
|
|
2074
2225
|
add.appendChild(U.el('div', 'a-name', U.t('+ Add a network folder')));
|
|
2075
|
-
add.appendChild(U.el('div', 'a-url', U.t('
|
|
2076
|
-
add.__onselect = function () {
|
|
2226
|
+
add.appendChild(U.el('div', 'a-url', U.t('A WebDAV folder, a Windows / NAS share (SMB) or a media server (DLNA)')));
|
|
2227
|
+
add.__onselect = function () {
|
|
2228
|
+
pickList(U.t('Add a network folder'), [['dav', U.t('WebDAV folder (http:// or https://)')], ['smb', U.t('Windows / NAS share (SMB)')], ['dlna', U.t('Media server on your network (DLNA)')]], null, function (k) {
|
|
2229
|
+
if (k === 'smb') { askSmbHost(''); } else if (k === 'dlna') { findDlna(); } else { askNetAddress(''); }
|
|
2230
|
+
});
|
|
2231
|
+
};
|
|
2077
2232
|
wrap.appendChild(add);
|
|
2078
2233
|
var focus = null;
|
|
2079
2234
|
NetFolders.all().forEach(function (f) {
|
|
@@ -2106,13 +2261,13 @@
|
|
|
2106
2261
|
if (_focusChild === 'nf:' + f.id) { focus = r; }
|
|
2107
2262
|
wrap.appendChild(r);
|
|
2108
2263
|
});
|
|
2109
|
-
wrap.appendChild(U.el('div', 'hint', 'A NAS (Synology, QNAP), Nextcloud,
|
|
2264
|
+
wrap.appendChild(U.el('div', 'hint', 'A NAS (Synology, QNAP), Nextcloud, a Windows share or rclone (rclone serve webdav). Home › Local shows each folder; its videos play as they are (nothing converted), so the TV must play their format.'));
|
|
2110
2265
|
if (focus) { _focusChild = null; Focus.setScope(scr('settings'), focus); } else { focusSettings(); }
|
|
2111
2266
|
}
|
|
2112
2267
|
function netFolderLine(f) {
|
|
2113
2268
|
if (f.off) { return f.url + ' · ' + U.t('its sources set aside, its index kept'); }
|
|
2114
2269
|
var st = LocalMedia.status(NetFolders.driveOf(f));
|
|
2115
|
-
return f.url + (f.user ? ' · ' + U.t('as {user}', { user: f.user }) : '') + (f.cert ? ' · ' + U.t('its certificate trusted') : '') + ' · ' + usbDriveLine(st, true);
|
|
2270
|
+
return (NetFolders.isDlna(f) ? 'DLNA · ' + ((('' + f.control).match(/^https?:\/\/([^\/]+)/) || [])[1] || '') : f.url) + (f.user ? ' · ' + U.t('as {user}', { user: f.user }) : '') + (f.cert ? ' · ' + U.t('its certificate trusted') : '') + ' · ' + usbDriveLine(st, true);
|
|
2116
2271
|
}
|
|
2117
2272
|
function askNetAddress(value) {
|
|
2118
2273
|
App.openEntry({
|
|
@@ -2138,10 +2293,61 @@
|
|
|
2138
2293
|
}
|
|
2139
2294
|
});
|
|
2140
2295
|
}
|
|
2296
|
+
// A Windows / NAS share: its server, a user name (none: a guest) and password, then one of
|
|
2297
|
+
// its shares to pick (the server's own list).
|
|
2298
|
+
function askSmbHost(value) {
|
|
2299
|
+
App.openEntry({
|
|
2300
|
+
title: U.t('Share: the server'),
|
|
2301
|
+
hint: U.t('Its name or address on your network, like 192.168.0.50 or nas.local. RETURN cancels.'),
|
|
2302
|
+
value: value || '', placeholder: '192.168.0.50',
|
|
2303
|
+
validate: function (v) { return NetFolders.smbHostOf(v) ? null : U.t('A name or address on your network, like 192.168.0.50'); },
|
|
2304
|
+
onConfirm: function (v) {
|
|
2305
|
+
var host = NetFolders.smbHostOf(v);
|
|
2306
|
+
App.back();
|
|
2307
|
+
App.openEntry({
|
|
2308
|
+
title: U.t('Share: user name'), hint: U.t('Its user name (DOMAIN\\name for a domain); leave it empty to go in as a guest. RETURN cancels.'), value: '', placeholder: U.t('user name'),
|
|
2309
|
+
validate: function () { return null; },
|
|
2310
|
+
onConfirm: function (user) {
|
|
2311
|
+
App.back();
|
|
2312
|
+
user = ('' + user).trim();
|
|
2313
|
+
if (!user) { smbShares(host, '', ''); return; }
|
|
2314
|
+
App.openEntry({
|
|
2315
|
+
title: U.t('Share: password'), hint: U.t('Its password (kept on the TV, sent only to that server). RETURN cancels.'), value: '', placeholder: U.t('password'), secret: true,
|
|
2316
|
+
validate: function () { return null; },
|
|
2317
|
+
onConfirm: function (pass) { App.back(); smbShares(host, user, '' + pass); }
|
|
2318
|
+
});
|
|
2319
|
+
}
|
|
2320
|
+
});
|
|
2321
|
+
}
|
|
2322
|
+
});
|
|
2323
|
+
}
|
|
2324
|
+
// The media servers on your network, looked for now (a few seconds), one to pick: added as a
|
|
2325
|
+
// network folder (none added unasked).
|
|
2326
|
+
function findDlna() {
|
|
2327
|
+
U.spinner(true, U.t('Looking for media servers on your network…'));
|
|
2328
|
+
NetFolders.discover().then(function (list) {
|
|
2329
|
+
U.spinner(false);
|
|
2330
|
+
if (!list.length) { U.toast(U.t('No media server answered (or all are added already)'), 6000); return; }
|
|
2331
|
+
pickList(U.t('Media servers: pick one'), list.map(function (x, i) { return ['' + i, x.name + ' · ' + (('' + x.control).match(/^https?:\/\/([^\/:]+)/) || [])[1]]; }), null, function (i) {
|
|
2332
|
+
var srv = list[+i];
|
|
2333
|
+
netProbe('', '', '', '', 'dlna', srv);
|
|
2334
|
+
});
|
|
2335
|
+
}, function (e) { U.spinner(false); U.toast((e && e.message) || U.t('It failed'), 7000); });
|
|
2336
|
+
}
|
|
2337
|
+
function smbShares(host, user, pass) {
|
|
2338
|
+
U.spinner(true, U.t('Asking the server for its shares…'));
|
|
2339
|
+
NetFolders.shares(host, user, pass).then(function (list) {
|
|
2340
|
+
U.spinner(false);
|
|
2341
|
+
if (!list.length) { U.toast(U.t('It lists no shares you can open'), 6000); return; }
|
|
2342
|
+
pickList(U.t('Its shares: pick one'), list.map(function (x) { return [x.name, x.name + (x.remark ? ' · ' + x.remark : '')]; }), null, function (name) {
|
|
2343
|
+
netProbe('smb://' + host + '/' + name + '/', user, pass, '', 'smb');
|
|
2344
|
+
});
|
|
2345
|
+
}, function (e) { U.spinner(false); U.toast((e && e.message) || U.t('It failed'), 7000); });
|
|
2346
|
+
}
|
|
2141
2347
|
// Ask the folder with that sign-in; a certificate it made itself: asked about first.
|
|
2142
|
-
function netProbe(url, user, pass, cert) {
|
|
2348
|
+
function netProbe(url, user, pass, cert, kind, server) {
|
|
2143
2349
|
U.spinner(true, U.t('Asking the folder…'));
|
|
2144
|
-
NetFolders.probe(url, user, pass, cert).then(function (p) {
|
|
2350
|
+
NetFolders.probe(url, user, pass, cert, kind, server).then(function (p) {
|
|
2145
2351
|
U.spinner(false);
|
|
2146
2352
|
var f;
|
|
2147
2353
|
try { f = NetFolders.add(p); } catch (e) { U.toast(e.message, 5000); return; }
|
|
@@ -2363,6 +2569,36 @@
|
|
|
2363
2569
|
STARTUP_STEPS.forEach(function (st) { if (m && typeof m[st[0]] === 'number') { parts.push(st[1] + ' ' + (m[st[0]] / 1000).toFixed(1) + ' s'); } });
|
|
2364
2570
|
return parts.join(' · ');
|
|
2365
2571
|
}
|
|
2572
|
+
// Settings › Diagnostics › Logs › Send to your phone: the logs (masked as they are in the list),
|
|
2573
|
+
// Startup, StremioK's version and how it's installed, and the TV (its browser, which names its
|
|
2574
|
+
// Tizen version; model and firmware where the TV says), as plain text in English.
|
|
2575
|
+
function logsText() {
|
|
2576
|
+
function two(n) { return (n < 10 ? '0' : '') + n; }
|
|
2577
|
+
function when(t) { var d = new Date(t); return d.getFullYear() + '-' + two(d.getMonth() + 1) + '-' + two(d.getDate()) + ' ' + two(d.getHours()) + ':' + two(d.getMinutes()) + ':' + two(d.getSeconds()); }
|
|
2578
|
+
// (the model: Samsung's productinfo (config.xml's productinfo privilege), else Tizen's own system info)
|
|
2579
|
+
var tv = [], pi = window.webapis && webapis.productinfo, model = '', ver = '';
|
|
2580
|
+
function cap(k) { try { return typeof tizen !== 'undefined' && tizen.systeminfo && tizen.systeminfo.getCapability ? '' + (tizen.systeminfo.getCapability(k) || '') : ''; } catch (e) { return ''; } }
|
|
2581
|
+
try { model = pi && pi.getRealModel ? pi.getRealModel() : pi && pi.getModel ? pi.getModel() : ''; } catch (e) { model = ''; }
|
|
2582
|
+
if (!model) { model = cap('http://tizen.org/system/model_name'); }
|
|
2583
|
+
if (model) { tv.push('Model: ' + model); }
|
|
2584
|
+
try { if (pi && pi.getFirmware) { tv.push('Firmware: ' + pi.getFirmware()); } } catch (e2) {}
|
|
2585
|
+
ver = cap('http://tizen.org/feature/platform.version');
|
|
2586
|
+
var tz = ver ? [ver, ver] : /Tizen (\d+(?:\.\d+)*)/.exec(navigator.userAgent || '');
|
|
2587
|
+
var lines = ['StremioK logs', 'StremioK ' + (appVersion() || '?') + ' · Installed as: ' + (typeof YTPlay !== 'undefined' && YTPlay.installLabel ? YTPlay.installLabel() : '?') +
|
|
2588
|
+
' · Video player: ' + ((window.webapis && webapis.avplay) ? 'the TV’s own' : 'the page’s'),
|
|
2589
|
+
'TV: ' + (tz ? 'Tizen ' + tz[1] : 'not a Tizen TV') + (tv.length ? ' · ' + tv.join(' · ') : ''),
|
|
2590
|
+
'Browser: ' + (navigator.userAgent || '?'), 'Sent: ' + when(Date.now()), ''];
|
|
2591
|
+
var now = U.startupMarks ? startupText(U.startupMarks()) : '', before = U.startupMarks ? startupText(U.startupMarks(true)) : '';
|
|
2592
|
+
lines.push('Startup');
|
|
2593
|
+
lines.push(' This launch: ' + (now || '—'));
|
|
2594
|
+
lines.push(' Launch before: ' + (before || '—'));
|
|
2595
|
+
lines.push('');
|
|
2596
|
+
var list = (U.logEntries ? U.logEntries() : []).slice().reverse(); // (the file reads oldest first, as they happened; the page shows the newest first)
|
|
2597
|
+
lines.push('Logs (' + list.length + ', oldest first)');
|
|
2598
|
+
list.forEach(function (e) { lines.push(when(e.t) + ' ' + e.src + (e.n > 1 ? ' ×' + e.n : '') + ' ' + e.msg); });
|
|
2599
|
+
if (!list.length) { lines.push(' (none since StremioK started)'); }
|
|
2600
|
+
return lines.join('\n') + '\n';
|
|
2601
|
+
}
|
|
2366
2602
|
function startupLines(wrap) {
|
|
2367
2603
|
if (!U.startupMarks) { return; }
|
|
2368
2604
|
var now = startupText(U.startupMarks()), before = startupText(U.startupMarks(true));
|
|
@@ -2525,7 +2761,7 @@
|
|
|
2525
2761
|
list: function () {
|
|
2526
2762
|
return Promise.resolve(V.menuOrder().map(function (k) {
|
|
2527
2763
|
var t = (V.HOME_TABS || []).filter(function (x) { return x.key === k; })[0];
|
|
2528
|
-
return { key: k, name: MENU_FIXED[k] || (t ? t.label : k) + (k === 'local' ? ' ' + U.t('(with a USB drive
|
|
2764
|
+
return { key: k, name: MENU_FIXED[k] || (t ? t.label : k) + (k === 'local' ? ' ' + U.t('(with a USB drive or network folder)') : k === 'guide' ? ' ' + U.t('(once a TV guide is read)') : '') };
|
|
2529
2765
|
}));
|
|
2530
2766
|
},
|
|
2531
2767
|
keyOf: function (x) { return x.key; },
|
package/js/ytplay.js
CHANGED
|
@@ -53,23 +53,43 @@ var YTPlay = (function () {
|
|
|
53
53
|
// An export (a configuration file) given to the phone: a one-time page to copy or download it
|
|
54
54
|
// -> { url, token } (polled like an entry: { seen }; closed with entryClose). POSTed: the token,
|
|
55
55
|
// or the guide ticket (the page's POST carries an Origin the header alone doesn't pass).
|
|
56
|
-
|
|
56
|
+
// kind: 'logs' for Settings › Diagnostics › Logs › Send to your phone (its own page and file name).
|
|
57
|
+
function entryGive(text, kind) {
|
|
57
58
|
if (MODE === 'browser') { return Promise.reject(new Error('no service')); }
|
|
58
59
|
return ensureService().then(entryAuth).then(function (a) {
|
|
59
60
|
return (a.q ? Promise.resolve(a.q) : ticketOf(a)).then(function (cred) {
|
|
60
|
-
|
|
61
|
+
var q = (cred ? cred.replace(/^&/, '') : '') + (kind === 'logs' ? (cred ? '&' : '') + 'kind=logs' : '');
|
|
62
|
+
return U.postJSON(PROXY + '/entry/give' + (q ? '?' + q : ''), text, 10000, 65536, a.h);
|
|
61
63
|
});
|
|
62
64
|
});
|
|
63
65
|
}
|
|
66
|
+
// A backup (kind 'backup') or the logs ('logs') written to a USB drive (its mount point,
|
|
67
|
+
// /opt/media/…), into its StremioK folder: -> { file, size }. POSTed as entryGive is.
|
|
68
|
+
function bakWrite(drive, kind, text) {
|
|
69
|
+
if (MODE === 'browser') { return Promise.reject(new Error('no service')); }
|
|
70
|
+
return ensureService().then(entryAuth).then(function (a) {
|
|
71
|
+
return (a.q ? Promise.resolve(a.q) : ticketOf(a)).then(function (cred) {
|
|
72
|
+
var q = 'drive=' + encodeURIComponent(drive) + '&kind=' + (kind === 'logs' ? 'logs' : 'backup') + (cred ? '&' + cred.replace(/^&/, '') : '');
|
|
73
|
+
return U.postJSON(PROXY + '/bak/write?' + q, text, 20000, 4096, a.h);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// The backup on a USB drive -> { text, at }; rejects when there's none.
|
|
78
|
+
function bakRead(drive) {
|
|
79
|
+
if (MODE === 'browser') { return Promise.reject(new Error('no service')); }
|
|
80
|
+
return ensureService().then(entryAuth).then(function (a) {
|
|
81
|
+
return U.getJSON(PROXY + '/bak/read?drive=' + encodeURIComponent(drive) + a.q, 15000, 3 * 1048576, null, a.h);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
64
84
|
function entryOpen(what) {
|
|
65
85
|
return entryAuth().then(function (a) { return U.getJSON(PROXY + '/entry/open?what=' + encodeURIComponent(what || 'link') + a.q, 8000, undefined, null, a.h); });
|
|
66
86
|
}
|
|
67
87
|
function entryPoll(token) {
|
|
68
|
-
return entryAuth().then(function (a) { return U.getJSON(PROXY + '/entry/poll?t=' + encodeURIComponent(token) + a.q, 5000,
|
|
88
|
+
return entryAuth().then(function (a) { return U.getJSON(PROXY + '/entry/poll?t=' + encodeURIComponent(token) + a.q, 5000, 4194304, null, a.h); })
|
|
69
89
|
.then(function (r) { return (r && typeof r.text === 'string') ? r.text : null; });
|
|
70
90
|
}
|
|
71
91
|
function entrySeen(token) { // (an export's page: kept open by asking, and whether the phone has opened it)
|
|
72
|
-
return entryAuth().then(function (a) { return U.getJSON(PROXY + '/entry/poll?t=' + encodeURIComponent(token) + a.q, 5000,
|
|
92
|
+
return entryAuth().then(function (a) { return U.getJSON(PROXY + '/entry/poll?t=' + encodeURIComponent(token) + a.q, 5000, 4194304, null, a.h); })
|
|
73
93
|
.then(function (r) { return !!(r && r.seen); });
|
|
74
94
|
}
|
|
75
95
|
function entryClose(token) {
|
|
@@ -82,11 +102,44 @@ var YTPlay = (function () {
|
|
|
82
102
|
// Referer ({ ua, ref }). opts (with force): { fix: false (the sound as it is), cc: the caption
|
|
83
103
|
// channels to add as subtitle tracks }. cancel (a U.cancelToken): the look stopped, the
|
|
84
104
|
// service's downloads with it (another channel, the player closed).
|
|
105
|
+
// A source's own headers (h: U.sanitizeHeaders's) as the service's query, each in the link's
|
|
106
|
+
// own query: User-Agent, Referer, Cookie, Origin, Accept, Accept-Language.
|
|
107
|
+
function headerQuery(h) {
|
|
108
|
+
if (!h) { return ''; }
|
|
109
|
+
return (h.ua ? '&ua=' + encodeURIComponent(h.ua) : '') + (h.ref ? '&ref=' + encodeURIComponent(h.ref) : '') + (h.cookie ? '&cookie=' + encodeURIComponent(h.cookie) : '') +
|
|
110
|
+
(h.origin ? '&origin=' + encodeURIComponent(h.origin) : '') + (h.accept ? '&accept=' + encodeURIComponent(h.accept) : '') + (h.lang ? '&lang=' + encodeURIComponent(h.lang) : '');
|
|
111
|
+
}
|
|
112
|
+
// A file (not HLS) through the service's file relay, with its headers and the player's byte
|
|
113
|
+
// range: { url } the player opens. lan: redirects into the home network allowed
|
|
114
|
+
// (Settings › Content › Addons › Local-network links from internet addons).
|
|
115
|
+
function fileOpen(url, h, lan) {
|
|
116
|
+
if (MODE === 'browser') { return Promise.reject(new Error('no service')); }
|
|
117
|
+
return ensureService().then(entryAuth).then(function (a) {
|
|
118
|
+
return U.getJSON(PROXY + '/live/file?u=' + encodeURIComponent(url) + headerQuery(h) + (lan ? '&lan=1' : '') + a.q, 5000, 65536, null, a.h);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
// What's in a source's file, from its header (the service's /live/mi: its container, codecs,
|
|
122
|
+
// audio and subtitle tracks with their names; see the service's mediaInfo). h, lan: as fileOpen.
|
|
123
|
+
function mediaInfo(url, h, lan, cancel) {
|
|
124
|
+
if (MODE === 'browser') { return Promise.reject(new Error('no service')); }
|
|
125
|
+
return ensureService().then(entryAuth).then(function (a) {
|
|
126
|
+
return U.getJSON(PROXY + '/live/mi?u=' + encodeURIComponent(url) + headerQuery(h) + (lan ? '&lan=1' : '') + a.q, 25000, 262144, cancel, a.h, null, true);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
// Where a Nuvio plugin's Worker sends its requests (js/plugins.js): { url, headers }, the
|
|
130
|
+
// token in the link (a Worker's POST then needs no preflight). lan: home-network requests
|
|
131
|
+
// allowed (Local-network links from internet addons).
|
|
132
|
+
function pluginNet(lan) {
|
|
133
|
+
if (MODE === 'browser') { return Promise.reject(new Error('no service')); }
|
|
134
|
+
return ensureService().then(entryAuth).then(function (a) {
|
|
135
|
+
return { url: PROXY + '/plug/fetch?' + (a.q || '').replace(/^&/, '') + (lan ? '&lan=1' : ''), headers: a.h || {} };
|
|
136
|
+
});
|
|
137
|
+
}
|
|
85
138
|
function liveOpen(url, h, force, opts, cancel) {
|
|
86
139
|
if (MODE === 'browser') { return Promise.reject(new Error('no service')); }
|
|
87
140
|
var cc = opts && opts.cc ? opts.cc.map(function (c) { return c.ch + (c.lang ? '-' + c.lang : ''); }).join(',') : '';
|
|
88
141
|
return ensureService().then(entryAuth).then(function (a) {
|
|
89
|
-
var q = '/live/open?u=' + encodeURIComponent(url) + (h
|
|
142
|
+
var q = '/live/open?u=' + encodeURIComponent(url) + headerQuery(h) + (force ? '&force=1' : '') +
|
|
90
143
|
(force && opts && opts.fix === false ? '&fix=0' : '') + (force && cc ? '&cc=' + encodeURIComponent(cc) : '') + (force && opts && opts.film ? '&film=1' : '') + (force && opts && opts.raw ? '&raw=1' : '');
|
|
91
144
|
return U.getJSON(PROXY + q + a.q, force ? 5000 : 30000, 65536, cancel || null, a.h);
|
|
92
145
|
});
|
|
@@ -96,7 +149,7 @@ var YTPlay = (function () {
|
|
|
96
149
|
function hlsMaster(url, h) {
|
|
97
150
|
if (MODE === 'browser') { return Promise.reject(new Error('no service')); }
|
|
98
151
|
return ensureService().then(entryAuth).then(function (a) {
|
|
99
|
-
var q = '/live/master?u=' + encodeURIComponent(url) + (h
|
|
152
|
+
var q = '/live/master?u=' + encodeURIComponent(url) + headerQuery(h);
|
|
100
153
|
return U.getText(PROXY + q + a.q, 12000, 524288, null, false, a.h);
|
|
101
154
|
});
|
|
102
155
|
}
|
|
@@ -304,6 +357,6 @@ var YTPlay = (function () {
|
|
|
304
357
|
return MODE === 'tizenbrew' ? U.t('TizenBrew module') : MODE === 'wgt' ? U.t('Sideloaded app (.wgt)') : U.t('Browser (development)');
|
|
305
358
|
}
|
|
306
359
|
|
|
307
|
-
return { ensureService: ensureService, resolverUrl: resolverUrl, infoUrl: infoUrl, canPlay: canPlay, liveOpen: liveOpen, hlsMaster: hlsMaster, aiomAddons: aiomAddons, stalkerList: stalkerList, stalkerVod: stalkerVod, drmLicense: drmLicense, stalkerPlayUrl: stalkerPlayUrl, stalkerGenres: stalkerGenres, stalkerLink: stalkerLink, xtvodAsk: xtvodAsk, epgLoad: epgLoad, epgGet: epgGet, epgFiles: epgFiles, epgClear: epgClear, entryOpen: entryOpen, entryGive: entryGive, entrySeen: entrySeen, entryPoll: entryPoll, entryClose: entryClose, subsUrl: subsUrl, audioLang: audioLang, setAudioLang: setAudioLang, installMode: function () { return MODE; },
|
|
360
|
+
return { ensureService: ensureService, resolverUrl: resolverUrl, infoUrl: infoUrl, canPlay: canPlay, liveOpen: liveOpen, fileOpen: fileOpen, mediaInfo: mediaInfo, pluginNet: pluginNet, hlsMaster: hlsMaster, aiomAddons: aiomAddons, stalkerList: stalkerList, stalkerVod: stalkerVod, drmLicense: drmLicense, stalkerPlayUrl: stalkerPlayUrl, stalkerGenres: stalkerGenres, stalkerLink: stalkerLink, xtvodAsk: xtvodAsk, epgLoad: epgLoad, epgGet: epgGet, epgFiles: epgFiles, epgClear: epgClear, entryOpen: entryOpen, entryGive: entryGive, bakWrite: bakWrite, bakRead: bakRead, entrySeen: entrySeen, entryPoll: entryPoll, entryClose: entryClose, subsUrl: subsUrl, audioLang: audioLang, setAudioLang: setAudioLang, installMode: function () { return MODE; },
|
|
308
361
|
installLabel: installLabel, unavailableMessage: unavailableMessage, isRunning: isRunning, port: PORT };
|
|
309
362
|
})();
|