@obitosouls/tizenbrew-netmirror 1.0.0 → 1.0.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/package.json +2 -2
- package/web/css/app.css +12 -0
- package/web/js/api.js +33 -11
- package/web/js/app.js +55 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@obitosouls/tizenbrew-netmirror",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Full-featured NetMirror TV application for Samsung Tizen TVs with background HLS streaming proxy and multi-season support",
|
|
5
5
|
"packageType": "app",
|
|
6
6
|
"appName": "NetMirror TV",
|
|
@@ -39,6 +39,6 @@
|
|
|
39
39
|
"smart-tv",
|
|
40
40
|
"netmirror"
|
|
41
41
|
],
|
|
42
|
-
"author": "obitosouls",
|
|
42
|
+
"author": "obitosouls <tamildeviltd@gmail.com>",
|
|
43
43
|
"license": "MIT"
|
|
44
44
|
}
|
package/web/css/app.css
CHANGED
|
@@ -538,3 +538,15 @@ video::cue { opacity: 0; }
|
|
|
538
538
|
}
|
|
539
539
|
.season-item.active { color: #fff; }
|
|
540
540
|
.season-item .season-check svg { width: 28px; height: 28px; fill: currentColor; }
|
|
541
|
+
|
|
542
|
+
.debug-drawer .btn.focused,
|
|
543
|
+
.debug-drawer .btn:focus {
|
|
544
|
+
background: #e50914 !important;
|
|
545
|
+
color: #fff !important;
|
|
546
|
+
box-shadow: 0 0 16px rgba(229, 9, 20, 0.9) !important;
|
|
547
|
+
outline: 3px solid #fff !important;
|
|
548
|
+
transform: scale(1.05);
|
|
549
|
+
}
|
|
550
|
+
.debug-body { scroll-behavior: smooth; }
|
|
551
|
+
.debug-body::-webkit-scrollbar { width: 8px; }
|
|
552
|
+
.debug-body::-webkit-scrollbar-thumb { background: #e50914; border-radius: 4px; }
|
package/web/js/api.js
CHANGED
|
@@ -111,19 +111,41 @@ var NM = (function () {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
function detectProxy() {
|
|
114
|
-
|
|
114
|
+
// Probe candidates: dedicated port 8787, 8788, then location.origin (excluding 8081)
|
|
115
|
+
var candidates = ['http://127.0.0.1:8787', 'http://127.0.0.1:8788'];
|
|
115
116
|
if (typeof location !== 'undefined' && location.protocol.indexOf('http') === 0 && location.port) {
|
|
116
|
-
|
|
117
|
+
var p = String(location.port);
|
|
118
|
+
if (p !== '8081' && p !== '8787' && p !== '8788') {
|
|
119
|
+
candidates.push(location.origin);
|
|
120
|
+
}
|
|
117
121
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
})
|
|
126
|
-
|
|
122
|
+
|
|
123
|
+
function tryCandidate(idx) {
|
|
124
|
+
if (idx >= candidates.length) {
|
|
125
|
+
setProxyUrl('');
|
|
126
|
+
return Promise.resolve('');
|
|
127
|
+
}
|
|
128
|
+
var c = candidates[idx];
|
|
129
|
+
return fetchWithTimeout(c + '/proxy/health', {}, 1200)
|
|
130
|
+
.then(function (r) {
|
|
131
|
+
if (!r.ok) return tryCandidate(idx + 1);
|
|
132
|
+
return r.json().then(function (data) {
|
|
133
|
+
// Strictly require data.service === 'tizenbrew-netmirror'
|
|
134
|
+
if (data && data.service === 'tizenbrew-netmirror') {
|
|
135
|
+
setProxyUrl(c);
|
|
136
|
+
return c;
|
|
137
|
+
}
|
|
138
|
+
return tryCandidate(idx + 1);
|
|
139
|
+
}).catch(function () {
|
|
140
|
+
return tryCandidate(idx + 1);
|
|
141
|
+
});
|
|
142
|
+
})
|
|
143
|
+
.catch(function () {
|
|
144
|
+
return tryCandidate(idx + 1);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return tryCandidate(0);
|
|
127
149
|
}
|
|
128
150
|
|
|
129
151
|
/* =====================================================================
|
package/web/js/app.js
CHANGED
|
@@ -2797,24 +2797,57 @@ const DebugDrawer = {
|
|
|
2797
2797
|
var btnReload = $('dbg-reload');
|
|
2798
2798
|
if (btnReload) btnReload.addEventListener('click', function () { location.reload(); });
|
|
2799
2799
|
var btnClose = $('dbg-close');
|
|
2800
|
-
if (btnClose) btnClose.addEventListener('click', function () { self.
|
|
2800
|
+
if (btnClose) btnClose.addEventListener('click', function () { self.close(); });
|
|
2801
2801
|
var hdrDebug = $('hdr-debug');
|
|
2802
2802
|
if (hdrDebug) hdrDebug.addEventListener('click', function () { self.toggle(); });
|
|
2803
2803
|
NM.onDebugUpdate = function () { if (self.visible) self.render(); };
|
|
2804
2804
|
},
|
|
2805
|
-
|
|
2806
|
-
this.visible =
|
|
2805
|
+
open() {
|
|
2806
|
+
this.visible = true;
|
|
2807
2807
|
if (this.el) {
|
|
2808
|
-
this.el.classList.
|
|
2809
|
-
|
|
2808
|
+
this.el.classList.remove('hidden');
|
|
2809
|
+
this.render();
|
|
2810
|
+
}
|
|
2811
|
+
if (!Nav.has(this)) {
|
|
2812
|
+
Nav.push(this, $('dbg-close'));
|
|
2813
|
+
} else {
|
|
2814
|
+
Nav.focus($('dbg-close'));
|
|
2810
2815
|
}
|
|
2811
2816
|
},
|
|
2817
|
+
close() {
|
|
2818
|
+
this.visible = false;
|
|
2819
|
+
if (this.el) this.el.classList.add('hidden');
|
|
2820
|
+
if (Nav.has(this)) {
|
|
2821
|
+
Nav.close(this);
|
|
2822
|
+
}
|
|
2823
|
+
},
|
|
2824
|
+
show(val) {
|
|
2825
|
+
if (val) this.open();
|
|
2826
|
+
else this.close();
|
|
2827
|
+
},
|
|
2812
2828
|
toggle() {
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2829
|
+
if (this.visible) this.close();
|
|
2830
|
+
else this.open();
|
|
2831
|
+
},
|
|
2832
|
+
onBack() {
|
|
2833
|
+
this.close();
|
|
2834
|
+
return true; // Return/Back on TV remote closes debug drawer
|
|
2835
|
+
},
|
|
2836
|
+
onKey(key) {
|
|
2837
|
+
var body = $('dbg-body');
|
|
2838
|
+
if (!body || body.classList.contains('hidden')) return false;
|
|
2839
|
+
|
|
2840
|
+
if (key === 'DOWN') {
|
|
2841
|
+
body.scrollTop += 140;
|
|
2842
|
+
return true;
|
|
2843
|
+
} else if (key === 'UP') {
|
|
2844
|
+
if (body.scrollTop > 10) {
|
|
2845
|
+
body.scrollTop = Math.max(0, body.scrollTop - 140);
|
|
2846
|
+
return true;
|
|
2847
|
+
}
|
|
2848
|
+
return false; // let UP move focus to action buttons
|
|
2817
2849
|
}
|
|
2850
|
+
return false;
|
|
2818
2851
|
},
|
|
2819
2852
|
copyDebug() {
|
|
2820
2853
|
var prx = (typeof NM !== 'undefined' && NM.getProxyUrl && NM.getProxyUrl()) || 'http://127.0.0.1:8787';
|
|
@@ -2952,6 +2985,19 @@ const App = {
|
|
|
2952
2985
|
const key = KEYMAP[code];
|
|
2953
2986
|
if (!key) return;
|
|
2954
2987
|
e.preventDefault();
|
|
2988
|
+
|
|
2989
|
+
// Toggle debug with '0', 'D', or 'Guide' key
|
|
2990
|
+
if (key === 'DEBUG') {
|
|
2991
|
+
DebugDrawer.toggle();
|
|
2992
|
+
return;
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2995
|
+
// Direct close of DebugDrawer on BACK
|
|
2996
|
+
if (DebugDrawer.visible && key === 'BACK') {
|
|
2997
|
+
DebugDrawer.close();
|
|
2998
|
+
return;
|
|
2999
|
+
}
|
|
3000
|
+
|
|
2955
3001
|
const layer = Nav.top();
|
|
2956
3002
|
if (!layer) return;
|
|
2957
3003
|
if (layer.onKey && layer.onKey(key)) return;
|