mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-05-11 20:06:13 +02:00
Compare commits
13 Commits
testbranch
..
3.7.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 44f145b646 | |||
| 55e2dc478d | |||
| 0932800e1f | |||
| c333eb25e3 | |||
| 580aa1cefd | |||
| 30de09f71b | |||
| 93d31adecd | |||
| 5f969017f7 | |||
| 967dd05fad | |||
| c808f0930b | |||
| 87df4b4aa1 | |||
| 0511d6f69b | |||
| 78b5598f67 |
@@ -463,7 +463,7 @@ mc.subscribe(EventType.ACK, handler)
|
||||
|----------|---------|-------------|
|
||||
| `MESHCORE_SERIAL_PORT` | auto-detect | Serial port for radio |
|
||||
| `MESHCORE_TCP_HOST` | *(none)* | TCP host for radio (mutually exclusive with serial/BLE) |
|
||||
| `MESHCORE_TCP_PORT` | `4000` | TCP port (used with `MESHCORE_TCP_HOST`) |
|
||||
| `MESHCORE_TCP_PORT` | `5000` | TCP port (used with `MESHCORE_TCP_HOST`) |
|
||||
| `MESHCORE_BLE_ADDRESS` | *(none)* | BLE device address (mutually exclusive with serial/TCP) |
|
||||
| `MESHCORE_BLE_PIN` | *(required with BLE)* | BLE PIN code |
|
||||
| `MESHCORE_SERIAL_BAUDRATE` | `115200` | Serial baud rate |
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
## [3.7.1] - 2026-04-02
|
||||
|
||||
* Feature: Redact Apprise URLs to prevent sensitive information disclosure
|
||||
|
||||
## [3.7.0] - 2026-04-02
|
||||
|
||||
* Feature: Repeater battery tracking
|
||||
* Feature: Repeater info pane just like contacts
|
||||
* Feature: Make repeaters blockable
|
||||
* Feature: Add new-node advert blocking
|
||||
* Feature: Add bulk deletion interface
|
||||
* Feature: Bulk room add on alt+click of new channel button
|
||||
* Feature: More info in debug endpoint
|
||||
* Bugfix: Be more conservative around radio load limits and don't exceed radio-reported capacity
|
||||
* Misc: Default auto-DM decrypt to true
|
||||
* Misc: Reorganize some settings panes
|
||||
* Misc: Enable FK pragma
|
||||
* Misc: Various performance and correctness fixes
|
||||
* Misc: Correct TCP default port
|
||||
|
||||
## [3.6.7] - 2026-03-31
|
||||
|
||||
* Misc: Remove armv7 (for now)
|
||||
|
||||
@@ -177,7 +177,7 @@ Only one transport may be active at a time. If multiple are set, the server will
|
||||
| `MESHCORE_SERIAL_PORT` | (auto-detect) | Serial port path |
|
||||
| `MESHCORE_SERIAL_BAUDRATE` | 115200 | Serial baud rate |
|
||||
| `MESHCORE_TCP_HOST` | | TCP host (mutually exclusive with serial/BLE) |
|
||||
| `MESHCORE_TCP_PORT` | 4000 | TCP port |
|
||||
| `MESHCORE_TCP_PORT` | 5000 | TCP port |
|
||||
| `MESHCORE_BLE_ADDRESS` | | BLE device address (mutually exclusive with serial/TCP) |
|
||||
| `MESHCORE_BLE_PIN` | | BLE PIN (required when BLE address is set) |
|
||||
| `MESHCORE_LOG_LEVEL` | INFO | `DEBUG`, `INFO`, `WARNING`, `ERROR` |
|
||||
@@ -193,7 +193,7 @@ Common launch patterns:
|
||||
MESHCORE_SERIAL_PORT=/dev/ttyUSB0 uv run uvicorn app.main:app --host 0.0.0.0 --port 8000
|
||||
|
||||
# TCP
|
||||
MESHCORE_TCP_HOST=192.168.1.100 MESHCORE_TCP_PORT=4000 uv run uvicorn app.main:app --host 0.0.0.0 --port 8000
|
||||
MESHCORE_TCP_HOST=192.168.1.100 MESHCORE_TCP_PORT=5000 uv run uvicorn app.main:app --host 0.0.0.0 --port 8000
|
||||
|
||||
# BLE
|
||||
MESHCORE_BLE_ADDRESS=AA:BB:CC:DD:EE:FF MESHCORE_BLE_PIN=123456 uv run uvicorn app.main:app --host 0.0.0.0 --port 8000
|
||||
|
||||
+2
-1
@@ -14,7 +14,7 @@ class Settings(BaseSettings):
|
||||
serial_port: str = "" # Empty string triggers auto-detection
|
||||
serial_baudrate: int = 115200
|
||||
tcp_host: str = ""
|
||||
tcp_port: int = 4000
|
||||
tcp_port: int = 5000
|
||||
ble_address: str = ""
|
||||
ble_pin: str = ""
|
||||
log_level: Literal["DEBUG", "INFO", "WARNING", "ERROR"] = "INFO"
|
||||
@@ -26,6 +26,7 @@ class Settings(BaseSettings):
|
||||
default=False,
|
||||
validation_alias="__CLOWNTOWN_DO_CLOCK_WRAPAROUND",
|
||||
)
|
||||
skip_post_connect_sync: bool = False
|
||||
basic_auth_username: str = ""
|
||||
basic_auth_password: str = ""
|
||||
|
||||
|
||||
+7
-8
@@ -382,9 +382,9 @@ async def run_migrations(conn: aiosqlite.Connection) -> int:
|
||||
await set_version(conn, 49)
|
||||
applied += 1
|
||||
|
||||
# Migration 50: Repeater telemetry history table
|
||||
# Migration 50: Repeater telemetry history table + tracking opt-in column
|
||||
if version < 50:
|
||||
logger.info("Applying migration 50: repeater telemetry history table")
|
||||
logger.info("Applying migration 50: repeater telemetry history")
|
||||
await _migrate_050_repeater_telemetry_history(conn)
|
||||
await set_version(conn, 50)
|
||||
applied += 1
|
||||
@@ -3109,10 +3109,7 @@ async def _migrate_049_foreign_key_cascade(conn: aiosqlite.Connection) -> None:
|
||||
|
||||
|
||||
async def _migrate_050_repeater_telemetry_history(conn: aiosqlite.Connection) -> None:
|
||||
"""Create repeater_telemetry_history table for JSON-blob telemetry snapshots.
|
||||
|
||||
Uses ON DELETE CASCADE so contact deletion automatically cleans up rows.
|
||||
"""
|
||||
"""Create repeater_telemetry_history table for JSON-blob telemetry snapshots."""
|
||||
await conn.execute(
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS repeater_telemetry_history (
|
||||
@@ -3125,7 +3122,9 @@ async def _migrate_050_repeater_telemetry_history(conn: aiosqlite.Connection) ->
|
||||
"""
|
||||
)
|
||||
await conn.execute(
|
||||
"CREATE INDEX IF NOT EXISTS idx_repeater_telemetry_history_key_ts "
|
||||
"ON repeater_telemetry_history(public_key, timestamp DESC)"
|
||||
"""
|
||||
CREATE INDEX IF NOT EXISTS idx_repeater_telemetry_pk_ts
|
||||
ON repeater_telemetry_history (public_key, timestamp)
|
||||
"""
|
||||
)
|
||||
await conn.commit()
|
||||
|
||||
+5
-5
@@ -535,11 +535,6 @@ class RepeaterStatusResponse(BaseModel):
|
||||
)
|
||||
|
||||
|
||||
class TelemetryHistoryEntry(BaseModel):
|
||||
timestamp: int
|
||||
data: dict
|
||||
|
||||
|
||||
class RepeaterNodeInfoResponse(BaseModel):
|
||||
"""Identity/location info from a repeater (small CLI batch)."""
|
||||
|
||||
@@ -929,3 +924,8 @@ class StatisticsResponse(BaseModel):
|
||||
known_channels_active: ContactActivityCounts
|
||||
path_hash_width_24h: PathHashWidthStats
|
||||
noise_floor_24h: NoiseFloorHistoryStats
|
||||
|
||||
|
||||
class TelemetryHistoryEntry(BaseModel):
|
||||
timestamp: int
|
||||
data: dict
|
||||
|
||||
@@ -204,35 +204,43 @@ async def run_post_connect_setup(radio_manager) -> None:
|
||||
finally:
|
||||
reader.handle_rx = _original_handle_rx
|
||||
|
||||
# Sync contacts/channels from radio to DB and clear radio
|
||||
logger.info("Syncing and offloading radio data...")
|
||||
result = await sync_and_offload_all(mc)
|
||||
logger.info("Sync complete: %s", result)
|
||||
from app.config import settings as app_settings_config
|
||||
|
||||
# Send advertisement to announce our presence (if enabled and not throttled)
|
||||
if await send_advertisement(mc):
|
||||
logger.info("Advertisement sent")
|
||||
if app_settings_config.skip_post_connect_sync:
|
||||
logger.info(
|
||||
"Skipping sync/offload/advert/drain (MESHCORE_SKIP_POST_CONNECT_SYNC)"
|
||||
)
|
||||
else:
|
||||
logger.debug("Advertisement skipped (disabled or throttled)")
|
||||
# Sync contacts/channels from radio to DB and clear radio
|
||||
logger.info("Syncing and offloading radio data...")
|
||||
result = await sync_and_offload_all(mc)
|
||||
logger.info("Sync complete: %s", result)
|
||||
|
||||
# Drain any messages that were queued before we connected.
|
||||
# This must happen BEFORE starting auto-fetch, otherwise both
|
||||
# compete on get_msg() with interleaved radio I/O.
|
||||
drained = await drain_pending_messages(mc)
|
||||
if drained > 0:
|
||||
logger.info("Drained %d pending message(s)", drained)
|
||||
radio_manager.clear_pending_message_channel_slots()
|
||||
# Send advertisement to announce our presence (if enabled and not throttled)
|
||||
if await send_advertisement(mc):
|
||||
logger.info("Advertisement sent")
|
||||
else:
|
||||
logger.debug("Advertisement skipped (disabled or throttled)")
|
||||
|
||||
# Drain any messages that were queued before we connected.
|
||||
# This must happen BEFORE starting auto-fetch, otherwise both
|
||||
# compete on get_msg() with interleaved radio I/O.
|
||||
drained = await drain_pending_messages(mc)
|
||||
if drained > 0:
|
||||
logger.info("Drained %d pending message(s)", drained)
|
||||
radio_manager.clear_pending_message_channel_slots()
|
||||
|
||||
await mc.start_auto_message_fetching()
|
||||
logger.info("Auto message fetching started")
|
||||
finally:
|
||||
radio_manager._release_operation_lock("post_connect_setup")
|
||||
|
||||
# Start background tasks AFTER releasing the operation lock.
|
||||
# These tasks acquire their own locks when they need radio access.
|
||||
start_periodic_sync()
|
||||
start_periodic_advert()
|
||||
start_message_polling()
|
||||
if not app_settings_config.skip_post_connect_sync:
|
||||
# Start background tasks AFTER releasing the operation lock.
|
||||
# These tasks acquire their own locks when they need radio access.
|
||||
start_periodic_sync()
|
||||
start_periodic_advert()
|
||||
start_message_polling()
|
||||
|
||||
radio_manager._setup_complete = True
|
||||
finally:
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "remoteterm-meshcore-frontend",
|
||||
"version": "3.6.2",
|
||||
"version": "3.6.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "remoteterm-meshcore-frontend",
|
||||
"version": "3.6.2",
|
||||
"version": "3.6.3",
|
||||
"dependencies": {
|
||||
"@codemirror/lang-python": "^6.2.1",
|
||||
"@codemirror/theme-one-dark": "^6.1.3",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "remoteterm-meshcore-frontend",
|
||||
"private": true,
|
||||
"version": "3.6.7",
|
||||
"version": "3.7.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
|
||||
import { api } from '../api';
|
||||
import { toast } from './ui/sonner';
|
||||
@@ -100,23 +100,38 @@ export function RepeaterDashboard({
|
||||
|
||||
// Telemetry history: preload from stored data, refresh from live status
|
||||
const [telemetryHistory, setTelemetryHistory] = useState<TelemetryHistoryEntry[]>([]);
|
||||
const telemetryHistorySourceRef = useRef<'none' | 'preload' | 'live'>('none');
|
||||
const telemetryHistoryRequestRef = useRef(0);
|
||||
|
||||
useEffect(() => {
|
||||
telemetryHistoryRequestRef.current += 1;
|
||||
telemetryHistorySourceRef.current = 'none';
|
||||
setTelemetryHistory([]);
|
||||
|
||||
if (!loggedIn) return;
|
||||
|
||||
const requestId = telemetryHistoryRequestRef.current;
|
||||
api
|
||||
.repeaterTelemetryHistory(conversation.id)
|
||||
.then(setTelemetryHistory)
|
||||
.then((history) => {
|
||||
if (telemetryHistoryRequestRef.current !== requestId) return;
|
||||
if (telemetryHistorySourceRef.current === 'live') return;
|
||||
telemetryHistorySourceRef.current = 'preload';
|
||||
setTelemetryHistory(history);
|
||||
})
|
||||
.catch(() => {});
|
||||
}, [loggedIn, conversation.id]);
|
||||
|
||||
// When a live status fetch returns embedded telemetry_history, replace local state
|
||||
useEffect(() => {
|
||||
const liveHistory = paneData.status?.telemetry_history;
|
||||
if (liveHistory && liveHistory.length > 0) {
|
||||
setTelemetryHistory(liveHistory);
|
||||
}
|
||||
if (!liveHistory) return;
|
||||
telemetryHistorySourceRef.current = 'live';
|
||||
setTelemetryHistory(liveHistory);
|
||||
}, [paneData.status?.telemetry_history]);
|
||||
|
||||
const isFav = isFavorite(favorites, 'contact', conversation.id);
|
||||
|
||||
const handleRepeaterLogin = async (nextPassword: string) => {
|
||||
await login(nextPassword);
|
||||
persistAfterLogin(nextPassword);
|
||||
@@ -317,7 +332,6 @@ export function RepeaterDashboard({
|
||||
onRefresh={() => refreshPane('status')}
|
||||
disabled={anyLoading}
|
||||
/>
|
||||
<TelemetryHistoryPane entries={telemetryHistory} />
|
||||
<RadioSettingsPane
|
||||
data={paneData.radioSettings}
|
||||
state={paneStates.radioSettings}
|
||||
@@ -380,6 +394,9 @@ export function RepeaterDashboard({
|
||||
loading={consoleLoading}
|
||||
onSend={sendConsoleCommand}
|
||||
/>
|
||||
|
||||
{/* Telemetry history chart — full width, below console */}
|
||||
<TelemetryHistoryPane entries={telemetryHistory} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -643,16 +643,20 @@ function formatPrivateTopicSummary(config: Record<string, unknown>) {
|
||||
return `${prefix}/dm:<pubkey>, ${prefix}/gm:<channel>, ${prefix}/raw/...`;
|
||||
}
|
||||
|
||||
function formatAppriseTargets(urls: string | undefined, maxLength = 80) {
|
||||
function censorAppriseUrl(url: string): string {
|
||||
const protoMatch = url.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//);
|
||||
if (protoMatch) return `${protoMatch[0]}********`;
|
||||
return '********';
|
||||
}
|
||||
|
||||
function formatAppriseTargets(urls: string | undefined) {
|
||||
const targets = (urls || '')
|
||||
.split('\n')
|
||||
.map((line) => line.trim())
|
||||
.filter(Boolean);
|
||||
if (targets.length === 0) return 'No targets configured';
|
||||
|
||||
const joined = targets.join(', ');
|
||||
if (joined.length <= maxLength) return joined;
|
||||
return `${joined.slice(0, maxLength - 3)}...`;
|
||||
return targets.map(censorAppriseUrl).join(', ');
|
||||
}
|
||||
|
||||
function formatSqsQueueSummary(config: Record<string, unknown>) {
|
||||
|
||||
@@ -126,6 +126,16 @@ const defaultProps = {
|
||||
onDeleteContact: vi.fn(),
|
||||
};
|
||||
|
||||
function createDeferred<T>() {
|
||||
let resolve!: (value: T) => void;
|
||||
let reject!: (reason?: unknown) => void;
|
||||
const promise = new Promise<T>((res, rej) => {
|
||||
resolve = res;
|
||||
reject = rej;
|
||||
});
|
||||
return { promise, resolve, reject };
|
||||
}
|
||||
|
||||
describe('RepeaterDashboard', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
@@ -645,6 +655,11 @@ describe('RepeaterDashboard', () => {
|
||||
});
|
||||
|
||||
describe('telemetry history', () => {
|
||||
beforeEach(async () => {
|
||||
const { api } = await import('../api');
|
||||
vi.mocked(api.repeaterTelemetryHistory).mockResolvedValue([]);
|
||||
});
|
||||
|
||||
it('loads telemetry history on mount when logged in', async () => {
|
||||
const { api } = await import('../api');
|
||||
mockHook.loggedIn = true;
|
||||
@@ -699,5 +714,45 @@ describe('RepeaterDashboard', () => {
|
||||
expect(screen.getByText('1 samples')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
it('does not let an older preload overwrite newer live status history', async () => {
|
||||
const { api } = await import('../api');
|
||||
const historySpy = vi.mocked(api.repeaterTelemetryHistory);
|
||||
const deferred = createDeferred<{ timestamp: number; data: { battery_volts: number } }[]>();
|
||||
historySpy.mockReturnValue(deferred.promise);
|
||||
|
||||
mockHook.loggedIn = true;
|
||||
mockHook.paneData.status = {
|
||||
battery_volts: 4.2,
|
||||
tx_queue_len: 0,
|
||||
noise_floor_dbm: -120,
|
||||
last_rssi_dbm: -85,
|
||||
last_snr_db: 7.5,
|
||||
packets_received: 100,
|
||||
packets_sent: 50,
|
||||
airtime_seconds: 600,
|
||||
rx_airtime_seconds: 1200,
|
||||
uptime_seconds: 86400,
|
||||
sent_flood: 10,
|
||||
sent_direct: 40,
|
||||
recv_flood: 30,
|
||||
recv_direct: 70,
|
||||
flood_dups: 1,
|
||||
direct_dups: 0,
|
||||
full_events: 0,
|
||||
telemetry_history: [{ timestamp: 1700000000, data: { battery_volts: 4.2 } }],
|
||||
};
|
||||
|
||||
render(<RepeaterDashboard {...defaultProps} />);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('1 samples')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
deferred.resolve([{ timestamp: 1690000000, data: { battery_volts: 3.9 } }]);
|
||||
await deferred.promise;
|
||||
|
||||
expect(screen.getByText('1 samples')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,3 +7,19 @@ class ResizeObserver {
|
||||
}
|
||||
|
||||
globalThis.ResizeObserver = ResizeObserver;
|
||||
|
||||
// Several components call matchMedia at import time for responsive detection
|
||||
if (typeof globalThis.matchMedia === 'undefined') {
|
||||
Object.defineProperty(globalThis, 'matchMedia', {
|
||||
value: (query: string) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: () => {},
|
||||
removeListener: () => {},
|
||||
addEventListener: () => {},
|
||||
removeEventListener: () => {},
|
||||
dispatchEvent: () => false,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
+13
-13
@@ -235,14 +235,6 @@ export interface ChannelTopSender {
|
||||
message_count: number;
|
||||
}
|
||||
|
||||
export interface ChannelDetail {
|
||||
channel: Channel;
|
||||
message_counts: ChannelMessageCounts;
|
||||
first_message_at: number | null;
|
||||
unique_sender_count: number;
|
||||
top_senders_24h: ChannelTopSender[];
|
||||
}
|
||||
|
||||
export interface BulkCreateHashtagChannelsResult {
|
||||
created_channels: Channel[];
|
||||
existing_count: number;
|
||||
@@ -252,6 +244,14 @@ export interface BulkCreateHashtagChannelsResult {
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface ChannelDetail {
|
||||
channel: Channel;
|
||||
message_counts: ChannelMessageCounts;
|
||||
first_message_at: number | null;
|
||||
unique_sender_count: number;
|
||||
top_senders_24h: ChannelTopSender[];
|
||||
}
|
||||
|
||||
/** A single path that a message took to reach us */
|
||||
export interface MessagePath {
|
||||
/** Hex-encoded routing path */
|
||||
@@ -419,11 +419,6 @@ export interface RepeaterStatusResponse {
|
||||
telemetry_history: TelemetryHistoryEntry[];
|
||||
}
|
||||
|
||||
export interface TelemetryHistoryEntry {
|
||||
timestamp: number;
|
||||
data: Record<string, number>;
|
||||
}
|
||||
|
||||
export interface RepeaterNeighborsResponse {
|
||||
neighbors: NeighborInfo[];
|
||||
}
|
||||
@@ -485,6 +480,11 @@ export interface PaneState {
|
||||
fetched_at?: number | null;
|
||||
}
|
||||
|
||||
export interface TelemetryHistoryEntry {
|
||||
timestamp: number;
|
||||
data: Record<string, number>;
|
||||
}
|
||||
|
||||
export interface TraceResponse {
|
||||
remote_snr: number | null;
|
||||
local_snr: number | null;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "remoteterm-meshcore"
|
||||
version = "3.6.7"
|
||||
version = "3.7.1"
|
||||
description = "RemoteTerm - Web interface for MeshCore radio mesh networks"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
|
||||
@@ -63,6 +63,7 @@ export default defineConfig({
|
||||
timeout: 180_000,
|
||||
env: {
|
||||
MESHCORE_DATABASE_PATH: path.join(tmpDir, 'e2e-test.db'),
|
||||
MESHCORE_SKIP_POST_CONNECT_SYNC: 'true',
|
||||
// Pass through the serial port from the environment
|
||||
...(process.env.MESHCORE_SERIAL_PORT
|
||||
? { MESHCORE_SERIAL_PORT: process.env.MESHCORE_SERIAL_PORT }
|
||||
|
||||
@@ -33,7 +33,7 @@ class TestTransportExclusivity:
|
||||
|
||||
def test_tcp_default_port(self):
|
||||
s = Settings(tcp_host="192.168.1.1")
|
||||
assert s.tcp_port == 4000
|
||||
assert s.tcp_port == 5000
|
||||
|
||||
def test_ble_only(self):
|
||||
s = Settings(ble_address="AA:BB:CC:DD:EE:FF", ble_pin="123456")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Tests for repeater telemetry history: repository CRUD and read-only endpoint."""
|
||||
"""Tests for repeater telemetry history: repository CRUD and embedded status response."""
|
||||
|
||||
import time
|
||||
|
||||
|
||||
Reference in New Issue
Block a user