mirror of
https://github.com/efiten/coredrive-rx.git
synced 2026-11-23 21:07:59 +00:00
Home becomes a pure monitor and a new Settings tab holds config/diagnostics. - Discover now runs automatically while connected with a 15 s traffic backoff (an overheard 2-byte forwarder/advert means a busy channel — don't poll on top of it); standstill still suspends it. The Flood probe is removed entirely. - New Settings tab: CoreScope broker status + "Push pending now", companion info, diagnostics (verbose, debug log, share/mail the log via Web Share API). - Home enriched: nodes/hex/rx counters, status strip (GPS accuracy, pending, upload health + last-upload age, capture rate), last-reception SNR peak-hold meter, discover status line. - Fix the +60-pending-on-WiFi bug: publish() now times out instead of hanging on a dead socket, drainLoop re-arms in finally so it can never die, MQTT keepalive lowered, and a drain is kicked on broker reconnect / window online. Pure logic in src/monitor.js + src/sharelog.js with tests. SW cache v7→v8. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
26 lines
1.1 KiB
JavaScript
26 lines
1.1 KiB
JavaScript
// Debug-log export: capability-based method selection + the mailto fallback.
|
|
// Run: node --test
|
|
import { test } from 'node:test';
|
|
import assert from 'node:assert';
|
|
import { pickShareMethod, buildMailto } from '../src/sharelog.js';
|
|
|
|
test('prefers the Web Share API when files can be shared', () => {
|
|
assert.strictEqual(pickShareMethod({ canShareFiles: true, canDownload: true }), 'share');
|
|
});
|
|
|
|
test('falls back to download when share is unavailable', () => {
|
|
assert.strictEqual(pickShareMethod({ canShareFiles: false, canDownload: true }), 'download');
|
|
});
|
|
|
|
test('last resort is mailto when neither share nor download is possible', () => {
|
|
assert.strictEqual(pickShareMethod({ canShareFiles: false, canDownload: false }), 'mailto');
|
|
});
|
|
|
|
test('mailto encodes subject + body and truncates a long log', () => {
|
|
const url = buildMailto('hello world', 'subj');
|
|
assert.match(url, /^mailto:\?subject=subj&body=hello%20world$/);
|
|
const long = 'x'.repeat(5000);
|
|
assert.ok(buildMailto(long).includes('truncated'));
|
|
assert.ok(decodeURIComponent(buildMailto(long).split('&body=')[1]).length < long.length);
|
|
});
|