Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

Commit 2a7ae01

Browse files
staticoclaude
andcommitted
Fix channel config navigation and show PSK as base64
- Fix selectedChannelIndex not being passed through ConfigPanel props - Show encryption key as base64 instead of "Default key" or hex - Remove redundant "PSK (base64)" row 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8f24b9a commit 2a7ae01

1 file changed

Lines changed: 5 additions & 23 deletions

File tree

src/ui/components/ConfigPanel.tsx

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ export function ConfigPanel({
161161
meshViewUrl,
162162
editingField,
163163
editValue,
164+
selectedChannelIndex,
164165
batchEditMode,
165166
batchEditCount,
166167
}: ConfigPanelProps) {
@@ -223,6 +224,7 @@ export function ConfigPanel({
223224
meshViewUrl={meshViewUrl}
224225
editingField={editingField}
225226
editValue={editValue}
227+
selectedChannelIndex={selectedChannelIndex}
226228
/>
227229
)}
228230
</Box>
@@ -762,29 +764,15 @@ function ChannelsConfigView({ channels, selectedIndex = 0, editingField, editVal
762764
const selectedChannel = validChannels[clampedIndex];
763765
const roleNames = ["DISABLED", "PRIMARY", "SECONDARY"];
764766

765-
// Format PSK for display
767+
// Format PSK as base64
766768
const formatPsk = (psk?: Uint8Array): string => {
767769
if (!psk || psk.length === 0) return "None (unencrypted)";
768-
if (psk.length === 1) {
769-
if (psk[0] === 0) return "None (unencrypted)";
770-
if (psk[0] === 1) return "Default key";
771-
if (psk[0] >= 2 && psk[0] <= 10) return `Simple key ${psk[0] - 1}`;
772-
}
773-
// Show hex for custom keys
774-
const hex = Array.from(psk).map(b => b.toString(16).padStart(2, "0")).join("");
775-
if (hex.length > 32) return hex.slice(0, 32) + "...";
776-
return hex;
777-
};
778-
779-
// Format PSK as base64 for QR codes
780-
const formatPskBase64 = (psk?: Uint8Array): string => {
781-
if (!psk || psk.length === 0) return "";
782-
// Use btoa-compatible encoding
770+
if (psk.length === 1 && psk[0] === 0) return "None (unencrypted)";
783771
const binary = String.fromCharCode(...psk);
784772
try {
785773
return btoa(binary);
786774
} catch {
787-
return "";
775+
return "Invalid key";
788776
}
789777
};
790778

@@ -832,12 +820,6 @@ function ChannelsConfigView({ channels, selectedIndex = 0, editingField, editVal
832820
<Text color={theme.fg.muted}>{"Encryption".padEnd(24)}</Text>
833821
<Text color={theme.packet.encrypted}>{formatPsk(selectedChannel.settings?.psk)}</Text>
834822
</Box>
835-
{selectedChannel.settings?.psk && selectedChannel.settings.psk.length > 1 && (
836-
<Box>
837-
<Text color={theme.fg.muted}>{"PSK (base64)".padEnd(24)}</Text>
838-
<Text color={theme.fg.secondary}>{formatPskBase64(selectedChannel.settings.psk)}</Text>
839-
</Box>
840-
)}
841823
<Box>
842824
<Text color={theme.fg.muted}>{"Uplink Enabled".padEnd(24)}</Text>
843825
<Text color={selectedChannel.settings?.uplinkEnabled ? theme.status.online : theme.fg.muted}>

0 commit comments

Comments
 (0)