stremiok 2.2.9 → 2.3.1
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 +18 -0
- package/README.md +1 -0
- package/config.xml +1 -1
- package/css/style.css +10 -2
- package/index.html +39 -37
- package/js/jellyfin.js +642 -0
- package/js/player-audio.js +61 -4
- package/js/player-controls.js +29 -1
- package/js/player-core.js +28 -4
- package/js/plex.js +530 -0
- package/js/stremio.js +42 -5
- package/js/util.js +21 -2
- package/js/view-core.js +3 -1
- package/js/view-detail.js +3 -3
- package/js/view-home.js +2 -0
- package/js/view-settings.js +172 -1
- package/package.json +1 -1
package/js/util.js
CHANGED
|
@@ -21,7 +21,7 @@ var U = (function () {
|
|
|
21
21
|
are read %-decoded (%70assword is password), and a #fragment is masked the same way
|
|
22
22
|
(name=value pairs, or one token). Scheme, host, port and the rest of the path stay
|
|
23
23
|
readable. */
|
|
24
|
-
var SECRET_PARAM = /^(pass(word)?|pwd|passwd|user(name)?|login|token|access_token|refresh_token|auth(orization)?|key|apikey|api_key|api-key|secret|client_secret|sig|signature|session|sid|hash|mac)$/i;
|
|
24
|
+
var SECRET_PARAM = /^(pass(word)?|pwd|passwd|user(name)?|login|token|access_token|refresh_token|auth(orization)?|key|apikey|api_key|api-key|secret|client_secret|sig|signature|session|sid|hash|mac|x-plex-token)$/i;
|
|
25
25
|
function looksLikeToken(seg) {
|
|
26
26
|
if (seg.length < 20 || !/^[A-Za-z0-9._~+=%-]+$/.test(seg)) { return false; }
|
|
27
27
|
if (/%3A%2F%2F/i.test(seg)) { return false; } // an encoded URL (a YouTube page for the service), not a token
|
|
@@ -603,6 +603,25 @@ var U = (function () {
|
|
|
603
603
|
});
|
|
604
604
|
}
|
|
605
605
|
|
|
606
|
+
/* n random hex digits, for ids sent to servers (a device id, a playback session's): the TV's
|
|
607
|
+
secure random numbers (crypto.getRandomValues); without them (tests), a generator seeded
|
|
608
|
+
by the clock and a count, so two ids still differ. */
|
|
609
|
+
var _randSeed = 0;
|
|
610
|
+
function randomHex(n) {
|
|
611
|
+
var out = '', bytes = null, i;
|
|
612
|
+
try {
|
|
613
|
+
var c = typeof crypto !== 'undefined' ? crypto : (typeof window !== 'undefined' ? window.crypto : null);
|
|
614
|
+
if (c && c.getRandomValues) { bytes = new Uint8Array(Math.ceil(n / 2)); c.getRandomValues(bytes); }
|
|
615
|
+
} catch (e) { bytes = null; }
|
|
616
|
+
if (!bytes) {
|
|
617
|
+
bytes = [];
|
|
618
|
+
var x = ((Date.now() % 2147483647) ^ (++_randSeed * 2654435761)) >>> 0 || 1;
|
|
619
|
+
for (i = 0; i < Math.ceil(n / 2); i++) { x ^= x << 13; x ^= x >>> 17; x ^= x << 5; x >>>= 0; bytes.push(x & 255); }
|
|
620
|
+
}
|
|
621
|
+
for (i = 0; i < bytes.length; i++) { out += (bytes[i] < 16 ? '0' : '') + bytes[i].toString(16); }
|
|
622
|
+
return out.slice(0, n);
|
|
623
|
+
}
|
|
624
|
+
|
|
606
625
|
/* A small most-recently-used cache: keeps the last `max` entries. The TV keeps the
|
|
607
626
|
app running for days, so session caches must not grow without limit. */
|
|
608
627
|
function lru(max) {
|
|
@@ -1659,7 +1678,7 @@ var U = (function () {
|
|
|
1659
1678
|
|
|
1660
1679
|
return {
|
|
1661
1680
|
byId: byId, el: el, clear: clear, moveIn: moveIn, getJSON: getJSON, getText: getText,
|
|
1662
|
-
postJSON: postJSON, redactUrl: redactUrl, problem: problem, problemDetail: problemDetail, listOf: listOf, lru: lru, cachedJSON: cachedJSON,
|
|
1681
|
+
postJSON: postJSON, redactUrl: redactUrl, problem: problem, problemDetail: problemDetail, listOf: listOf, lru: lru, randomHex: randomHex, cachedJSON: cachedJSON,
|
|
1663
1682
|
parseUrl: parseUrl, urlProblem: urlProblem, isPlaylistUrl: isPlaylistUrl, isManifestUrl: isManifestUrl,
|
|
1664
1683
|
isPrivateHost: isPrivateHost, urlIsPrivate: urlIsPrivate, setLocalPolicy: setLocalPolicy, sanitizeHeaders: sanitizeHeaders, drawable: drawable,
|
|
1665
1684
|
look: look, setLook: setLook, canBlur: canBlur, heroImages: heroImages, log: log, logEntries: logEntries, clearLog: clearLog, bigStore: bigStore, diskInfo: diskInfo,
|
package/js/view-core.js
CHANGED
|
@@ -672,11 +672,13 @@ var ViewParts = {};
|
|
|
672
672
|
if (isLive()) {
|
|
673
673
|
App.openLive(t, meta.id, meta, rowChannels(c));
|
|
674
674
|
} else {
|
|
675
|
-
App.openDetail(t, meta.id, meta);
|
|
675
|
+
App.openDetail(t, meta.id, meta, t === 'series' && meta._openEp ? meta._openEp : null); // (Jellyfin's Next up: at that episode)
|
|
676
676
|
}
|
|
677
677
|
};
|
|
678
678
|
// the remote's Play key: a movie's or channel's top source; a series has no one episode, so its page
|
|
679
|
+
// (one with an episode of its own, Jellyfin's Next up: that episode's top source)
|
|
679
680
|
if (titleType(kind) === 'movie') { c.__onplay = function () { App.openDetail('movie', meta.id, meta, null, { playBest: true }); }; }
|
|
681
|
+
else if (titleType(kind) === 'series' && meta._openEp) { c.__onplay = function () { App.openDetail('series', meta.id, meta, meta._openEp, { playBest: true }); }; }
|
|
680
682
|
else if (titleType(kind) === 'series') { c.__onplay = function () { c.__onselect(); }; }
|
|
681
683
|
else if (fallbackType !== 'local' && isLive()) { c.__onplay = function () { App.openLive(titleType(kind), meta.id, meta, rowChannels(c), { playBest: true }); }; } // (a channel)
|
|
682
684
|
return c;
|
package/js/view-detail.js
CHANGED
|
@@ -1433,8 +1433,8 @@
|
|
|
1433
1433
|
// then ones with a format marked "not working" on this TV (Settings > Formats), then
|
|
1434
1434
|
// links that don't play here.
|
|
1435
1435
|
var TIERS = ['2160', '1440', '1080', '720', 'sd', 'other'];
|
|
1436
|
-
var GROUPS = ['local', 'played'].concat(TIERS, ['ranked', 'unsuitable', 'worded', 'sized', 'bad', 'where']);
|
|
1437
|
-
var GROUP_TITLES = { local: 'On your USB drive', played: 'Played before', '2160': '4K', '1440': '1440p', '1080': '1080p', '720': '720p',
|
|
1436
|
+
var GROUPS = ['local', 'server', 'emby', 'plex', 'played'].concat(TIERS, ['ranked', 'unsuitable', 'worded', 'sized', 'bad', 'where']);
|
|
1437
|
+
var GROUP_TITLES = { local: 'On your USB drive', server: 'On your Jellyfin server', emby: 'On your Emby server', plex: 'On your Plex server', played: 'Played before', '2160': '4K', '1440': '1440p', '1080': '1080p', '720': '720p',
|
|
1438
1438
|
sd: 'SD', other: 'Other', ranked: 'Sources', unsuitable: 'Marked not suitable', worded: 'Hidden by your words', sized: 'Outside your size limits', bad: 'Not working or not allowed on this TV', where: 'Where to watch · other apps' };
|
|
1439
1439
|
var KIND_SCORE = { remux: 4, bluray: 3, web: 2, hdtv: 1, '': 1.5, cam: -5 };
|
|
1440
1440
|
function tierOf(info) {
|
|
@@ -1470,7 +1470,7 @@
|
|
|
1470
1470
|
var bad = usable ? Stremio.badFormats(st, info) : [];
|
|
1471
1471
|
var blocked = usable ? Stremio.blockedRes(st, info) : ''; // a resolution you don't allow
|
|
1472
1472
|
var pr = (usable && !unsuitable && !worded && !sized && !bad.length && !blocked) ? playedIndex(hist, st, info) : -1;
|
|
1473
|
-
var group = !usable ? 'where' : unsuitable ? 'unsuitable' : worded ? 'worded' : sized ? 'sized' : (bad.length || blocked) ? 'bad' : st._localFile ? 'local' : pr >= 0 ? 'played' : byRes ? tierOf(info) : 'ranked';
|
|
1473
|
+
var group = !usable ? 'where' : unsuitable ? 'unsuitable' : worded ? 'worded' : sized ? 'sized' : (bad.length || blocked) ? 'bad' : st._localFile ? 'local' : st._jf ? (st._jf.kind === 'emby' ? 'emby' : st._jf.kind === 'plex' ? 'plex' : 'server') : pr >= 0 ? 'played' : byRes ? tierOf(info) : 'ranked';
|
|
1474
1474
|
var app = group === 'where' ? whereApp(st) : null; // links that open an app here come first
|
|
1475
1475
|
return { st: st, i: i, info: info, bad: bad, blocked: blocked, pr: pr, group: group, tier: tierOf(info), app: app, unsuitable: unsuitable, worded: worded, sized: sized };
|
|
1476
1476
|
});
|
package/js/view-home.js
CHANGED
|
@@ -1506,6 +1506,8 @@
|
|
|
1506
1506
|
if (typeof Stremio !== 'undefined' && Stremio.onIptvReady) { Stremio.onIptvReady(function () { refreshAddonRows('local:iptv'); }); }
|
|
1507
1507
|
if (typeof XtVod !== 'undefined' && XtVod.onChange) { XtVod.onChange(function () { refreshAddonRows('local:xtvod'); }); } // (an Xtream account's films and series, once its categories came)
|
|
1508
1508
|
if (typeof StVod !== 'undefined' && StVod.onChange) { StVod.onChange(function () { refreshAddonRows('local:stvod'); }); } // (a Stalker portal's, the same)
|
|
1509
|
+
if (typeof Jellyfin !== 'undefined' && Jellyfin.onChange) { Jellyfin.onChange(function () { refreshAddonRows('local:jellyfin'); refreshAddonRows('local:emby'); }); } // (a Jellyfin or Emby server's libraries)
|
|
1510
|
+
if (typeof Plex !== 'undefined' && Plex.onChange) { Plex.onChange(function () { refreshAddonRows('local:plex'); }); } // (a Plex server's)
|
|
1509
1511
|
var PARTIAL_DELAY = 150; // coalesces catalogs that arrive together into one redraw
|
|
1510
1512
|
function loadHomeCatalogs() {
|
|
1511
1513
|
if (_homeLoading) { return; }
|
package/js/view-settings.js
CHANGED
|
@@ -378,6 +378,7 @@
|
|
|
378
378
|
['YouTube', 'Your YouTube channels, playlists and searches; YouTube in Search', 'youtube'],
|
|
379
379
|
['Streaming apps', 'Your apps (Prime Video, Netflix, …) that open a title\'s "where to watch" sources', 'appshortcuts'],
|
|
380
380
|
['USB drive', 'The Local tab: what\'s on your drive, matched to titles; hidden files', 'usb'],
|
|
381
|
+
['Media servers', 'Your Jellyfin or Emby server: its libraries on Home, its files as sources', 'mediaservers'],
|
|
381
382
|
['Import configuration file', 'Import addons, API keys & IPTV playlists', 'import'],
|
|
382
383
|
['Export configuration', 'Your addons, playlists, API keys and settings, to your phone', 'export']] },
|
|
383
384
|
playback: { title: 'Playback', rows: [
|
|
@@ -439,6 +440,7 @@
|
|
|
439
440
|
else if (_settingsSection === 'storage') { settingsStorage(wrap); }
|
|
440
441
|
else if (_settingsSection === 'tvapps') { settingsTvApps(wrap); }
|
|
441
442
|
else if (_settingsSection === 'usb') { settingsUsb(wrap); }
|
|
443
|
+
else if (_settingsSection === 'mediaservers') { settingsMediaServers(wrap); }
|
|
442
444
|
else if (_settingsSection === 'private') { settingsPrivate(wrap); }
|
|
443
445
|
else if (_settingsSection === 'appshortcuts') { settingsAppShortcuts(wrap); }
|
|
444
446
|
else if (_settingsSection === 'import') { settingsImport(wrap); }
|
|
@@ -486,7 +488,7 @@
|
|
|
486
488
|
var TIZENBREW_NOTE = '⚠ Installed with TizenBrew: other TizenBrew modules can read what StremioK saves, including API keys and addon links with their tokens. Only install modules you trust; the sideloaded app keeps its data to itself.';
|
|
487
489
|
function settingsMenu(wrap) {
|
|
488
490
|
wrap.appendChild(U.el('h2', null, 'Settings'));
|
|
489
|
-
wrap.appendChild(sectionRow('Content', 'Addons, API keys, IPTV playlists, streaming apps, importing a configuration file', 'content'));
|
|
491
|
+
wrap.appendChild(sectionRow('Content', 'Addons, API keys, IPTV playlists, media servers, streaming apps, importing a configuration file', 'content'));
|
|
490
492
|
wrap.appendChild(sectionRow('Playback', 'Audio and subtitles, source ranking, feed sources, formats', 'playback'));
|
|
491
493
|
wrap.appendChild(sectionRow('Appearance', 'Look, background, accent color, zoom, posters, spoilers', 'appearance'));
|
|
492
494
|
wrap.appendChild(sectionRow('Home', 'The tab it opens on, the top menu, Home feeds, Search results', 'home'));
|
|
@@ -1608,6 +1610,175 @@
|
|
|
1608
1610
|
onModalClose(cancelFlow); // canceling the overlay stops polling
|
|
1609
1611
|
}
|
|
1610
1612
|
|
|
1613
|
+
// ---- Media servers: your Jellyfin servers ----
|
|
1614
|
+
function settingsMediaServers(wrap) {
|
|
1615
|
+
wrap.appendChild(U.el('h2', null, 'Media servers'));
|
|
1616
|
+
var have = typeof Jellyfin !== 'undefined';
|
|
1617
|
+
var add = U.el('div', 'addon-item focusable cfg-row');
|
|
1618
|
+
add.appendChild(U.el('div', 'a-name', '+ Add a Jellyfin or Emby server'));
|
|
1619
|
+
add.appendChild(U.el('div', 'a-url', 'Its address on your network, then a user name and password, or Jellyfin’s Quick Connect'));
|
|
1620
|
+
add.__onselect = function () { askJellyfinAddress(''); };
|
|
1621
|
+
if (have) { wrap.appendChild(add); }
|
|
1622
|
+
var hasPlex = typeof Plex !== 'undefined';
|
|
1623
|
+
if (hasPlex) {
|
|
1624
|
+
var addPx = U.el('div', 'addon-item focusable cfg-row');
|
|
1625
|
+
addPx.appendChild(U.el('div', 'a-name', '+ Add a Plex server'));
|
|
1626
|
+
addPx.appendChild(U.el('div', 'a-url', 'A code to enter at plex.tv/link, then which of your servers'));
|
|
1627
|
+
addPx.__onselect = function () { plexLink(); };
|
|
1628
|
+
wrap.appendChild(addPx);
|
|
1629
|
+
}
|
|
1630
|
+
var focus = null;
|
|
1631
|
+
// (each server with the module it's from: Jellyfin's for Jellyfin and Emby, Plex's)
|
|
1632
|
+
var all = (have ? Jellyfin.servers().map(function (s) { return { srv: s, mod: Jellyfin, kind: Jellyfin.kindName(s) }; }) : [])
|
|
1633
|
+
.concat(hasPlex ? Plex.servers().map(function (s) { return { srv: s, mod: Plex, kind: 'Plex' }; }) : []);
|
|
1634
|
+
all.forEach(function (x) {
|
|
1635
|
+
var srv = x.srv, mod = x.mod;
|
|
1636
|
+
var r = U.el('div', 'addon-item focusable cfg-row'), libs = mod.libraries(srv);
|
|
1637
|
+
r.appendChild(U.el('div', 'a-name', srv.name + ' · ' + x.kind + ' ' + srv.version));
|
|
1638
|
+
r.appendChild(U.el('div', 'a-url', srv.url + (srv.user ? ' · signed in as ' + srv.user : '') + (libs.length ? ' · ' + libs.map(function (l) { return l.name; }).join(', ') : '')));
|
|
1639
|
+
r.__onselect = function () {
|
|
1640
|
+
pickList(srv.name, [['reload', 'Reload'], ['remove', 'Sign out and remove']], null, function (v) {
|
|
1641
|
+
if (v === 'reload') {
|
|
1642
|
+
mod.reload(srv.id);
|
|
1643
|
+
markHomeDirty();
|
|
1644
|
+
U.toast('Reading “' + srv.name + '” again…');
|
|
1645
|
+
setTimeout(function () { if (_settingsSection === 'mediaservers') { renderSettings(); } }, 1500);
|
|
1646
|
+
} else if (v === 'remove') {
|
|
1647
|
+
confirm('Sign out of “' + srv.name + '” and remove it?', 'Remove', function () { mod.remove(srv.id); markHomeDirty(); renderSettings(); });
|
|
1648
|
+
}
|
|
1649
|
+
});
|
|
1650
|
+
};
|
|
1651
|
+
if (_focusChild === 'jf:' + srv.id) { focus = r; }
|
|
1652
|
+
wrap.appendChild(r);
|
|
1653
|
+
});
|
|
1654
|
+
wrap.appendChild(U.el('div', 'hint', 'Jellyfin 10.9 or newer, Emby 4.7 or newer, Plex. Their files play as they are (nothing converted), so the TV must play their format.'));
|
|
1655
|
+
if (focus) { _focusChild = null; Focus.setScope(scr('settings'), focus); } else { focusSettings(); }
|
|
1656
|
+
}
|
|
1657
|
+
function askJellyfinAddress(value) {
|
|
1658
|
+
App.openEntry({
|
|
1659
|
+
title: 'Jellyfin or Emby server: address',
|
|
1660
|
+
hint: 'Its address on your network, like http://192.168.0.50:8096. RETURN cancels.',
|
|
1661
|
+
value: value || 'http://', placeholder: 'http://192.168.0.50:8096', phone: 'jellyfin',
|
|
1662
|
+
validate: function (v) { return Jellyfin.addressProblem(v); },
|
|
1663
|
+
onConfirm: function (v) {
|
|
1664
|
+
App.back();
|
|
1665
|
+
U.spinner(true, 'Asking the server…');
|
|
1666
|
+
Jellyfin.probe(v).then(function (info) { U.spinner(false); if (info.kind === 'emby') { jellyfinPassword(info, ''); } else { jellyfinSignIn(info); } }, function (e) {
|
|
1667
|
+
U.spinner(false);
|
|
1668
|
+
U.toast(e.message, 6000);
|
|
1669
|
+
if (_settingsSection === 'mediaservers') { renderSettings(); }
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
function jellyfinDone(srv) {
|
|
1675
|
+
markHomeDirty();
|
|
1676
|
+
_settingsSection = 'mediaservers';
|
|
1677
|
+
_focusChild = 'jf:' + srv.id;
|
|
1678
|
+
renderSettings();
|
|
1679
|
+
U.toast('✓ Signed in to “' + srv.name + '”' + (srv.user ? ' as ' + srv.user : ''));
|
|
1680
|
+
}
|
|
1681
|
+
// Plex: its code to enter at plex.tv/link (a QR of the page too), then which server.
|
|
1682
|
+
function plexLink() {
|
|
1683
|
+
var existing = document.querySelector('.modal-overlay');
|
|
1684
|
+
if (existing) { existing.parentNode.removeChild(existing); }
|
|
1685
|
+
var overlay = U.el('div', 'modal-overlay'), box = U.el('div', 'modal-box');
|
|
1686
|
+
box.appendChild(U.el('div', 'modal-msg', 'Add a Plex server'));
|
|
1687
|
+
var body = U.el('div', 'trakt-connect');
|
|
1688
|
+
body.appendChild(U.el('div', 'tc-line', 'Asking Plex for a code…'));
|
|
1689
|
+
box.appendChild(body);
|
|
1690
|
+
var row = U.el('div', 'modal-row'), cancel = U.el('div', 'pill focusable modal-btn', 'Cancel');
|
|
1691
|
+
cancel.__onselect = function () { closeModal(); };
|
|
1692
|
+
row.appendChild(cancel);
|
|
1693
|
+
box.appendChild(row);
|
|
1694
|
+
overlay.appendChild(box);
|
|
1695
|
+
document.body.appendChild(overlay);
|
|
1696
|
+
showModal(overlay, cancel);
|
|
1697
|
+
function addIt(res) {
|
|
1698
|
+
U.spinner(true, 'Finding “' + res.name + '”…');
|
|
1699
|
+
Plex.add(res).then(function (srv) { U.spinner(false); jellyfinDone(srv); }, function (e) { U.spinner(false); U.toast(e.message, 8000); });
|
|
1700
|
+
}
|
|
1701
|
+
var stop = Plex.link({
|
|
1702
|
+
onCode: function (code, url) {
|
|
1703
|
+
U.clear(body);
|
|
1704
|
+
var qrSpot = U.el('div', 'tc-qr-spot');
|
|
1705
|
+
body.appendChild(qrSpot);
|
|
1706
|
+
var goTo = body.appendChild(U.el('div', 'tc-line', 'On your phone or computer, go to:'));
|
|
1707
|
+
(typeof qrcode !== 'undefined' ? Promise.resolve() : U.loadScript('js/qrcode.js')).then(function () {
|
|
1708
|
+
var qr = U.qrCanvas(url, 8);
|
|
1709
|
+
if (!qr || !qrSpot.parentNode) { return; }
|
|
1710
|
+
qr.className = 'tc-qr';
|
|
1711
|
+
qrSpot.appendChild(U.el('div', 'tc-line', 'Scan with your phone:'));
|
|
1712
|
+
qrSpot.appendChild(qr);
|
|
1713
|
+
goTo.textContent = 'or go to';
|
|
1714
|
+
}, function () {});
|
|
1715
|
+
body.appendChild(U.el('div', 'tc-url', url.replace(/^https:\/\//, '')));
|
|
1716
|
+
body.appendChild(U.el('div', 'tc-line', 'sign in, and enter this code:'));
|
|
1717
|
+
body.appendChild(U.el('div', 'tc-code', code));
|
|
1718
|
+
body.appendChild(U.el('div', 'tc-line small', 'Waiting for you to enter it…'));
|
|
1719
|
+
},
|
|
1720
|
+
onServers: function (list) {
|
|
1721
|
+
if (isModalOpen()) { onModalClose(null); closeModal(); }
|
|
1722
|
+
if (list.length === 1) { addIt(list[0]); return; }
|
|
1723
|
+
pickList('Which Plex server?', list.map(function (x, i) { return ['' + i, x.name + (x.owned ? '' : ' (shared with you)')]; }), null, function (v) { addIt(list[+v]); });
|
|
1724
|
+
},
|
|
1725
|
+
onError: function (msg) { U.clear(body); body.appendChild(U.el('div', 'tc-line', msg)); }
|
|
1726
|
+
});
|
|
1727
|
+
onModalClose(stop);
|
|
1728
|
+
}
|
|
1729
|
+
// Signing in: Quick Connect's code, or a user name and password instead.
|
|
1730
|
+
function jellyfinSignIn(info) {
|
|
1731
|
+
var existing = document.querySelector('.modal-overlay');
|
|
1732
|
+
if (existing) { existing.parentNode.removeChild(existing); }
|
|
1733
|
+
var overlay = U.el('div', 'modal-overlay'), box = U.el('div', 'modal-box');
|
|
1734
|
+
box.appendChild(U.el('div', 'modal-msg', 'Sign in to “' + info.name + '”'));
|
|
1735
|
+
var body = U.el('div', 'trakt-connect');
|
|
1736
|
+
body.appendChild(U.el('div', 'tc-line', 'Starting Quick Connect…'));
|
|
1737
|
+
box.appendChild(body);
|
|
1738
|
+
var row = U.el('div', 'modal-row');
|
|
1739
|
+
var pw = U.el('div', 'pill focusable modal-btn', 'User name and password');
|
|
1740
|
+
var cancel = U.el('div', 'pill focusable modal-btn', 'Cancel');
|
|
1741
|
+
row.appendChild(pw); row.appendChild(cancel);
|
|
1742
|
+
box.appendChild(row);
|
|
1743
|
+
overlay.appendChild(box);
|
|
1744
|
+
document.body.appendChild(overlay);
|
|
1745
|
+
showModal(overlay, cancel);
|
|
1746
|
+
var stop = Jellyfin.quickConnect(info, {
|
|
1747
|
+
onCode: function (code) {
|
|
1748
|
+
U.clear(body);
|
|
1749
|
+
body.appendChild(U.el('div', 'tc-line', 'In Jellyfin on your phone or computer, open your profile › Quick Connect, and enter:'));
|
|
1750
|
+
body.appendChild(U.el('div', 'tc-code', code));
|
|
1751
|
+
body.appendChild(U.el('div', 'tc-line small', 'Waiting for you to enter it…'));
|
|
1752
|
+
},
|
|
1753
|
+
onSuccess: function (srv) { if (isModalOpen()) { onModalClose(null); closeModal(); } jellyfinDone(srv); },
|
|
1754
|
+
onError: function (msg) { U.clear(body); body.appendChild(U.el('div', 'tc-line', msg)); }
|
|
1755
|
+
});
|
|
1756
|
+
onModalClose(stop); // (closed: no more asking)
|
|
1757
|
+
pw.__onselect = function () { onModalClose(null); stop(); closeModal(); jellyfinPassword(info, ''); };
|
|
1758
|
+
cancel.__onselect = function () { closeModal(); };
|
|
1759
|
+
}
|
|
1760
|
+
function jellyfinPassword(info, user) {
|
|
1761
|
+
App.openEntry({
|
|
1762
|
+
title: Jellyfin.kindName(info) + ' “' + info.name + '”: user name', hint: 'Your ' + Jellyfin.kindName(info) + ' user name. RETURN cancels.', value: user || '', placeholder: 'user name',
|
|
1763
|
+
validate: function (v) { return ('' + v).trim() ? null : 'Your user name'; },
|
|
1764
|
+
onConfirm: function (u) {
|
|
1765
|
+
App.back();
|
|
1766
|
+
App.openEntry({
|
|
1767
|
+
title: Jellyfin.kindName(info) + ' “' + info.name + '”: password', hint: 'Its password (not kept: only the sign-in the server gives back). RETURN cancels.', value: '', placeholder: 'password', secret: true,
|
|
1768
|
+
validate: function () { return null; },
|
|
1769
|
+
onConfirm: function (p) {
|
|
1770
|
+
App.back();
|
|
1771
|
+
U.spinner(true, 'Signing in…');
|
|
1772
|
+
Jellyfin.signIn(info, ('' + u).trim(), p).then(function (srv) { U.spinner(false); jellyfinDone(srv); }, function (e) {
|
|
1773
|
+
U.spinner(false);
|
|
1774
|
+
U.toast(e.message, 6000);
|
|
1775
|
+
});
|
|
1776
|
+
}
|
|
1777
|
+
});
|
|
1778
|
+
}
|
|
1779
|
+
});
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1611
1782
|
function settingsSubtitles(wrap) {
|
|
1612
1783
|
wrap.appendChild(U.el('h2', null, 'Subtitles'));
|
|
1613
1784
|
wrap.appendChild(subPickRow('Default language', SUB_LANGS, 'lang'));
|