Jeremy Gallant
9 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with
27 additions and
32 deletions
-
biome.json
-
packages/core/src/utils/transform/fromDevice.ts
-
packages/transport-web-bluetooth/src/transport.test.ts
-
packages/web/src/components/Dialog/ImportDialog.tsx
-
packages/web/src/components/Dialog/ManagedModeDialog.tsx
-
packages/web/src/components/Dialog/ShutdownDialog.tsx
-
packages/web/src/components/Dialog/UnsafeRolesDialog/UnsafeRolesDialog.tsx
-
packages/web/src/components/Form/FormSelect.tsx
-
packages/web/src/components/PageComponents/ChannelConfig/Channel.tsx
-
packages/web/src/components/ThemeSwitcher.tsx
-
packages/web/src/components/UI/Checkbox/Checkbox.test.tsx
-
packages/web/src/components/UI/ErrorPage.tsx
-
packages/web/src/components/generic/Filter/FilterControl.tsx
-
packages/web/src/core/utils/ip.ts
-
packages/web/src/pages/Config/index.tsx
-
packages/web/src/pages/Dashboard/index.tsx
|
|
|
@ -3,9 +3,9 @@ |
|
|
|
"includes": [ |
|
|
|
"**/*.ts", |
|
|
|
"**/*.tsx", |
|
|
|
"!npm_modules/**", |
|
|
|
"!dist/**", |
|
|
|
"!npm/**", |
|
|
|
"!npm_modules", |
|
|
|
"!dist", |
|
|
|
"!npm", |
|
|
|
"**/*.json", |
|
|
|
"!**/locales/*-*/*.json" |
|
|
|
], |
|
|
|
|
|
|
|
@ -14,7 +14,7 @@ export const fromDeviceStream: () => TransformStream<Uint8Array, DeviceOutput> = |
|
|
|
byteBuffer = new Uint8Array([...byteBuffer, ...chunk]); |
|
|
|
let processingExhausted = false; |
|
|
|
while (byteBuffer.length !== 0 && !processingExhausted) { |
|
|
|
const framingIndex = byteBuffer.findIndex((byte) => byte === 0x94); |
|
|
|
const framingIndex = byteBuffer.indexOf(0x94); |
|
|
|
const framingByte2 = byteBuffer[framingIndex + 1]; |
|
|
|
if (framingByte2 === 0xc3) { |
|
|
|
if (byteBuffer.subarray(0, framingIndex).length) { |
|
|
|
@ -35,9 +35,7 @@ export const fromDeviceStream: () => TransformStream<Uint8Array, DeviceOutput> = |
|
|
|
) { |
|
|
|
const packet = byteBuffer.subarray(4, 4 + (msb << 8) + lsb); |
|
|
|
|
|
|
|
const malformedDetectorIndex = packet.findIndex( |
|
|
|
(byte) => byte === 0x94, |
|
|
|
); |
|
|
|
const malformedDetectorIndex = packet.indexOf(0x94); |
|
|
|
if ( |
|
|
|
malformedDetectorIndex !== -1 && |
|
|
|
packet[malformedDetectorIndex + 1] === 0xc3 |
|
|
|
|
|
|
|
@ -14,7 +14,9 @@ class MiniEmitter { |
|
|
|
this.listeners.get(type)?.delete(listener); |
|
|
|
} |
|
|
|
dispatchEvent(event: Event) { |
|
|
|
this.listeners.get(event.type)?.forEach((l) => l(event)); |
|
|
|
this.listeners.get(event.type)?.forEach((l) => { |
|
|
|
l(event); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -84,7 +84,7 @@ export const ImportDialog = ({ open, onOpenChange }: ImportDialogProps) => { |
|
|
|
}, [importDialogInput, t]); |
|
|
|
|
|
|
|
const apply = () => { |
|
|
|
channelSet?.settings.map( |
|
|
|
channelSet?.settings.forEach( |
|
|
|
(ch: Protobuf.Channel.ChannelSettings, index: number) => { |
|
|
|
if (importIndex[index] === -1) { |
|
|
|
return; |
|
|
|
@ -140,7 +140,7 @@ export const ImportDialog = ({ open, onOpenChange }: ImportDialogProps) => { |
|
|
|
|
|
|
|
const onSelectChange = (value: string, index: number) => { |
|
|
|
const newImportIndex = [...importIndex]; |
|
|
|
newImportIndex[index] = Number.parseInt(value); |
|
|
|
newImportIndex[index] = Number.parseInt(value, 10); |
|
|
|
setImportIndex(newImportIndex); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
@ -43,7 +43,6 @@ export const ManagedModeDialog = ({ |
|
|
|
</DialogHeader> |
|
|
|
<div className="flex items-center gap-2"> |
|
|
|
<Checkbox |
|
|
|
id="managedMode" |
|
|
|
checked={confirmState} |
|
|
|
onChange={() => setConfirmState(!confirmState)} |
|
|
|
name="confirmUnderstanding" |
|
|
|
|
|
|
|
@ -37,7 +37,7 @@ export const ShutdownDialog = ({ open, onOpenChange }: ShutdownDialogProps) => { |
|
|
|
<Input |
|
|
|
type="number" |
|
|
|
value={time} |
|
|
|
onChange={(e) => setTime(Number.parseInt(e.target.value))} |
|
|
|
onChange={(e) => setTime(Number.parseInt(e.target.value, 10))} |
|
|
|
suffix={t("unit.minute.plural")} |
|
|
|
/> |
|
|
|
<Button className="w-24" onClick={handleScheduledShutdown}> |
|
|
|
|
|
|
|
@ -59,7 +59,6 @@ export const UnsafeRolesDialog = ({ |
|
|
|
</DialogDescription> |
|
|
|
<div className="flex items-center gap-2"> |
|
|
|
<Checkbox |
|
|
|
id="routerRole" |
|
|
|
checked={confirmState} |
|
|
|
onChange={() => setConfirmState(!confirmState)} |
|
|
|
name="confirmUnderstanding" |
|
|
|
|
|
|
|
@ -84,7 +84,7 @@ export function SelectInput<T extends FieldValues>({ |
|
|
|
if (field.selectChange) { |
|
|
|
field.selectChange(newValue, selectedKey); |
|
|
|
} |
|
|
|
onChange(Number.parseInt(newValue)); |
|
|
|
onChange(Number.parseInt(newValue, 10)); |
|
|
|
}; |
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
|
|
@ -148,7 +148,7 @@ export const Channel = ({ onFormInit, channel }: SettingsPanelProps) => { |
|
|
|
}; |
|
|
|
|
|
|
|
const selectChangeEvent = (e: string) => { |
|
|
|
const count = Number.parseInt(e); |
|
|
|
const count = Number.parseInt(e, 10); |
|
|
|
if (!Number.isNaN(count)) { |
|
|
|
setBytes(count); |
|
|
|
trigger("settings.psk"); |
|
|
|
|
|
|
|
@ -60,7 +60,6 @@ export default function ThemeSwitcher({ |
|
|
|
<Button |
|
|
|
variant="ghost" |
|
|
|
onClick={toggleTheme} |
|
|
|
id="theme-switcher" |
|
|
|
aria-label={t("theme.changeTheme")} |
|
|
|
className={cn( |
|
|
|
"group relative flex justify-start", |
|
|
|
|
|
|
|
@ -75,6 +75,7 @@ describe("Checkbox", () => { |
|
|
|
}); |
|
|
|
|
|
|
|
it("uses provided id", () => { |
|
|
|
// biome-ignore lint/correctness/useUniqueElementIds: <test>
|
|
|
|
render(<Checkbox id="custom-id" />); |
|
|
|
expect(screen.getByRole("checkbox").id).toBe("custom-id"); |
|
|
|
}); |
|
|
|
|
|
|
|
@ -72,10 +72,7 @@ export function ErrorPage({ error }: { error: Error }) { |
|
|
|
<label htmlFor="message"> |
|
|
|
{t("errorPage.errorMessageLabel")} |
|
|
|
</label> |
|
|
|
<p |
|
|
|
id="message" |
|
|
|
className="text-slate-400 break-words overflow-wrap" |
|
|
|
> |
|
|
|
<p className="text-slate-400 break-words overflow-wrap"> |
|
|
|
{error.message} |
|
|
|
</p> |
|
|
|
</> // TODO: Use Trans for the label and message together?
|
|
|
|
@ -83,10 +80,7 @@ export function ErrorPage({ error }: { error: Error }) { |
|
|
|
{error?.stack && ( |
|
|
|
<> |
|
|
|
<label htmlFor="stack">{t("errorPage.stackTraceLabel")}</label> |
|
|
|
<p |
|
|
|
id="stack" |
|
|
|
className="text-slate-400 break-words overflow-wrap" |
|
|
|
> |
|
|
|
<p className="text-slate-400 break-words overflow-wrap"> |
|
|
|
{error.stack} |
|
|
|
</p> |
|
|
|
</> |
|
|
|
|
|
|
|
@ -244,7 +244,6 @@ export function FilterControl({ |
|
|
|
</label> |
|
|
|
<Input |
|
|
|
type="text" |
|
|
|
id="nodeName" |
|
|
|
value={filterState.nodeName} |
|
|
|
onChange={handleTextChange("nodeName")} |
|
|
|
showClearButton |
|
|
|
|
|
|
|
@ -13,7 +13,7 @@ export function convertIpAddressToInt(ip: string): number | undefined { |
|
|
|
.split(".") |
|
|
|
.reverse() |
|
|
|
.reduce((ipnum, octet) => { |
|
|
|
return (ipnum << 8) + Number.parseInt(octet); |
|
|
|
return (ipnum << 8) + Number.parseInt(octet, 10); |
|
|
|
}, 0) >>> 0 |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
@ -122,11 +122,15 @@ const ConfigPage = () => { |
|
|
|
await connection?.commitEditSettings(); |
|
|
|
} |
|
|
|
|
|
|
|
workingChannelConfig.forEach((newChannel) => addChannel(newChannel)); |
|
|
|
workingConfig.forEach((newConfig) => setConfig(newConfig)); |
|
|
|
workingModuleConfig.forEach((newModuleConfig) => |
|
|
|
setModuleConfig(newModuleConfig), |
|
|
|
); |
|
|
|
workingChannelConfig.forEach((newChannel) => { |
|
|
|
addChannel(newChannel); |
|
|
|
}); |
|
|
|
workingConfig.forEach((newConfig) => { |
|
|
|
setConfig(newConfig); |
|
|
|
}); |
|
|
|
workingModuleConfig.forEach((newModuleConfig) => { |
|
|
|
setModuleConfig(newModuleConfig); |
|
|
|
}); |
|
|
|
|
|
|
|
removeWorkingChannelConfig(); |
|
|
|
removeWorkingConfig(); |
|
|
|
|
|
|
|
@ -34,7 +34,7 @@ export const Dashboard = () => { |
|
|
|
{devices.map((device) => { |
|
|
|
const nodeDB = getNodeDB(device.id); |
|
|
|
if (!nodeDB) { |
|
|
|
return; |
|
|
|
return undefined; |
|
|
|
} |
|
|
|
|
|
|
|
return ( |
|
|
|
|