nio-cat 0.3.3 → 0.3.4
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/bin/nio.js +5 -2
- package/package.json +1 -1
- package/web/app/app.js +1 -1
package/bin/nio.js
CHANGED
|
@@ -76,8 +76,10 @@ function canOpenBrowser() {
|
|
|
76
76
|
|
|
77
77
|
function openDashboard() {
|
|
78
78
|
const local = `http://127.0.0.1:${cfg.port}`;
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
// Per defecte s'obre l'app en línia (sempre al dia), ja connectada a aquest ordinador. Amb --local, la còpia que porta nio.
|
|
80
|
+
const online = !flags.local;
|
|
81
|
+
const link = pairLink(online ? flags.app || cfg.app : local, local, cfg.token);
|
|
82
|
+
if (canOpenBrowser() && openUrl(link)) console.log(` ${c.dim('Panell:')} ${online ? (flags.app || cfg.app) + '/app' : local} ${c.dim('(obert al navegador; --no-open per evitar-ho' + (online ? '; --local per fer servir la còpia d\'aquest ordinador' : '') + ')')}`);
|
|
81
83
|
else console.log(` ${c.dim('Panell:')} ${link}`);
|
|
82
84
|
}
|
|
83
85
|
|
|
@@ -288,6 +290,7 @@ async function start() {
|
|
|
288
290
|
--no-tunnel Només des d'aquest ordinador
|
|
289
291
|
--port <n> Port local (7717 si no dius res)
|
|
290
292
|
--no-open No obris el panell al navegador d'aquest ordinador
|
|
293
|
+
--local Obre la còpia del panell d'aquest ordinador (si el navegador bloqueja nio.cat, p. ex. Safari)
|
|
291
294
|
--open Obre al navegador la pàgina del codi QR
|
|
292
295
|
nio pair Mostra el codi QR una altra vegada
|
|
293
296
|
|
package/package.json
CHANGED
package/web/app/app.js
CHANGED
|
@@ -140,7 +140,7 @@ async function connect() {
|
|
|
140
140
|
} catch (e) {
|
|
141
141
|
if (ctrl.signal.aborted) return;
|
|
142
142
|
state.connected = false;
|
|
143
|
-
state.lastError = e.message === 'Failed to fetch' || e.name === 'TypeError' ? 'No arribo a l’ordinador' : e.message;
|
|
143
|
+
state.lastError = e.message === 'Failed to fetch' || e.name === 'TypeError' ? (location.protocol === 'https:' && /^http:\/\/(127\.0\.0\.1|localhost)/.test(m.url) ? 'El navegador no deixa que aquesta web parli amb aquest ordinador. Prova Chrome, o engega nio amb --local.' : 'No arribo a l’ordinador') : e.message;
|
|
144
144
|
render();
|
|
145
145
|
if (e.fatal) return;
|
|
146
146
|
setTimeout(() => machine() && !ctrl.signal.aborted && connect(), Math.min(15000, 1000 * 2 ** retry++));
|