mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-07-05 01:11:32 +02:00
Add outgoing message region tagging. Closes #35.
This commit is contained in:
@@ -40,6 +40,7 @@ export function SettingsIdentitySection({
|
||||
const [name, setName] = useState('');
|
||||
const [privateKey, setPrivateKey] = useState('');
|
||||
const [advertIntervalHours, setAdvertIntervalHours] = useState('0');
|
||||
const [floodScope, setFloodScope] = useState('');
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [rebooting, setRebooting] = useState(false);
|
||||
const [advertising, setAdvertising] = useState(false);
|
||||
@@ -51,6 +52,7 @@ export function SettingsIdentitySection({
|
||||
|
||||
useEffect(() => {
|
||||
setAdvertIntervalHours(String(Math.round(appSettings.advert_interval / 3600)));
|
||||
setFloodScope(appSettings.flood_scope);
|
||||
}, [appSettings]);
|
||||
|
||||
const handleSaveIdentity = async () => {
|
||||
@@ -61,10 +63,17 @@ export function SettingsIdentitySection({
|
||||
const update: RadioConfigUpdate = { name };
|
||||
await onSave(update);
|
||||
|
||||
const appUpdate: AppSettingsUpdate = {};
|
||||
const hours = parseInt(advertIntervalHours, 10);
|
||||
const newAdvertInterval = isNaN(hours) ? 0 : hours * 3600;
|
||||
if (newAdvertInterval !== appSettings.advert_interval) {
|
||||
await onSaveAppSettings({ advert_interval: newAdvertInterval });
|
||||
appUpdate.advert_interval = newAdvertInterval;
|
||||
}
|
||||
if (floodScope !== appSettings.flood_scope) {
|
||||
appUpdate.flood_scope = floodScope;
|
||||
}
|
||||
if (Object.keys(appUpdate).length > 0) {
|
||||
await onSaveAppSettings(appUpdate);
|
||||
}
|
||||
|
||||
toast.success('Identity settings saved');
|
||||
@@ -140,6 +149,20 @@ export function SettingsIdentitySection({
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="flood-scope">Flood Scope / Region</Label>
|
||||
<Input
|
||||
id="flood-scope"
|
||||
value={floodScope}
|
||||
onChange={(e) => setFloodScope(e.target.value)}
|
||||
placeholder="#MyRegion"
|
||||
/>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Tag outgoing flood messages with a region name (e.g. #MyRegion). Repeaters with this
|
||||
region configured will prioritize your traffic. Leave empty to disable.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Button onClick={handleSaveIdentity} disabled={busy} className="w-full">
|
||||
{busy ? 'Saving...' : 'Save Identity Settings'}
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user