From 664fd1c2d0a0d17c0e337be285542833d67ec27e Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Wed, 19 Feb 2025 10:11:42 -0500 Subject: [PATCH 1/7] chore: format file --- src/components/PageComponents/Connect/HTTP.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/components/PageComponents/Connect/HTTP.tsx b/src/components/PageComponents/Connect/HTTP.tsx index 0e1e6603..7eb39e95 100644 --- a/src/components/PageComponents/Connect/HTTP.tsx +++ b/src/components/PageComponents/Connect/HTTP.tsx @@ -28,13 +28,8 @@ export const HTTP = ({ closeDialog }: TabElementProps): JSX.Element => { }, }); - const tlsEnabled = useWatch({ - control, - name: "tls", - defaultValue: location.protocol === "https:", - }); - const [connectionInProgress, setConnectionInProgress] = useState(false); + const [https, setHTTPS] = useState(false); const onSubmit = handleSubmit(async (data) => { setConnectionInProgress(true); @@ -46,7 +41,7 @@ export const HTTP = ({ closeDialog }: TabElementProps): JSX.Element => { await connection.connect({ address: data.ip, fetchInterval: 2000, - tls: data.tls, + tls: https, }); setSelectedDevice(id); @@ -60,8 +55,7 @@ export const HTTP = ({ closeDialog }: TabElementProps): JSX.Element => {
{ control={control} render={({ field: { value, ...rest } }) => ( <> - + { + checked ? setHTTPS(true) : setHTTPS(false); + }} // label="Use TLS" // description="Description" disabled={ From 033409351eaddc9b2f1edbe9142650872b3a2ee7 Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Wed, 19 Feb 2025 10:22:21 -0500 Subject: [PATCH 2/7] fix: allow app to build without require formatting --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a1441b0d..93129898 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "description": "Meshtastic web client", "license": "GPL-3.0-only", "scripts": { - "build": "pnpm check && rsbuild build", + "build": "rsbuild build", "build:analyze": "BUNDLE_ANALYZE=true rsbuild build", "check": "biome check src/", "check:fix": "pnpm check --write src/", From e9b6c2495c7cd48de025089d1e4c8dac64f383f9 Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Wed, 19 Feb 2025 11:28:23 -0500 Subject: [PATCH 3/7] feat: apply biome formatting as github action --- .github/workflows/format.yml | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 00000000..f9201192 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,46 @@ +name: Biome Format + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + workflow_dispatch: + +jobs: + format: + runs-on: ubuntu-latest + + permissions: + # We need to give the default GITHUB_TOKEN write permission to commit and push + contents: write + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Biome + run: npm install --global @biomejs/biome + + - name: Format with Biome + run: biome format --write . + + - name: Check for changes + id: git-check + run: | + git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT + + - name: Commit changes + if: steps.git-check.outputs.changes == 'true' + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add -A + git commit -m "chore: format code" + git push \ No newline at end of file From 764328593d7d94d1101b742f08449344b001ca79 Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Wed, 19 Feb 2025 11:33:20 -0500 Subject: [PATCH 4/7] changed name of github action --- .github/workflows/format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index f9201192..0e706efe 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -1,4 +1,4 @@ -name: Biome Format +name: Code Formatting on: push: From 8c693f195683e95a18cb0a2c9366e02d30472545 Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Wed, 19 Feb 2025 11:44:36 -0500 Subject: [PATCH 5/7] fix: improve action to fix checkout issue --- .github/workflows/format.yml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 0e706efe..fcff678e 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -5,6 +5,7 @@ on: branches: [ main, master ] pull_request: branches: [ main, master ] + # Allow manual triggering workflow_dispatch: jobs: @@ -12,13 +13,15 @@ jobs: runs-on: ubuntu-latest permissions: - # We need to give the default GITHUB_TOKEN write permission to commit and push + # Give the default GITHUB_TOKEN write permission to commit and push contents: write steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 with: - ref: ${{ github.head_ref }} + fetch-depth: 0 + token: ${{ github.token }} - name: Setup Node.js uses: actions/setup-node@v4 @@ -34,13 +37,20 @@ jobs: - name: Check for changes id: git-check run: | - git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT + git diff --quiet || echo "changes=true" >> $GITHUB_OUTPUT - - name: Commit changes + - name: Configure Git if: steps.git-check.outputs.changes == 'true' run: | - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + + - name: Commit and push changes + if: steps.git-check.outputs.changes == 'true' + run: | + branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} + echo "Current branch: $branch_name" git add -A + git status git commit -m "chore: format code" - git push \ No newline at end of file + git push origin HEAD:$branch_name \ No newline at end of file From 84ca90ae9756c056d581bc9de67d192ac05a1a28 Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Wed, 19 Feb 2025 11:47:07 -0500 Subject: [PATCH 6/7] fix: further action changes. --- .github/workflows/format.yml | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index fcff678e..ec8efd55 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -1,11 +1,8 @@ name: Code Formatting on: - push: - branches: [ main, master ] pull_request: branches: [ main, master ] - # Allow manual triggering workflow_dispatch: jobs: @@ -13,15 +10,16 @@ jobs: runs-on: ubuntu-latest permissions: - # Give the default GITHUB_TOKEN write permission to commit and push contents: write + pull-requests: write steps: - name: Checkout repository uses: actions/checkout@v4 with: - fetch-depth: 0 - token: ${{ github.token }} + ref: ${{ github.head_ref }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} - name: Setup Node.js uses: actions/setup-node@v4 @@ -39,18 +37,12 @@ jobs: run: | git diff --quiet || echo "changes=true" >> $GITHUB_OUTPUT - - name: Configure Git - if: steps.git-check.outputs.changes == 'true' - run: | - git config --global user.email "github-actions[bot]@users.noreply.github.com" - git config --global user.name "github-actions[bot]" - - name: Commit and push changes if: steps.git-check.outputs.changes == 'true' run: | - branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} - echo "Current branch: $branch_name" - git add -A - git status - git commit -m "chore: format code" - git push origin HEAD:$branch_name \ No newline at end of file + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + + git add -A + git commit -m "chore: format code" + git push \ No newline at end of file From a7a9ba04638b74b30c4bbe9c134cfb607e487036 Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Wed, 19 Feb 2025 22:29:42 -0500 Subject: [PATCH 7/7] fix: validate bluetooth pin is 6 characters. --- src/components/Form/FormSelect.tsx | 6 +- .../PageComponents/Config/Bluetooth.tsx | 64 +++++++++-- .../PageComponents/Connect/HTTP.tsx | 1 - src/components/PageLayout.tsx | 17 ++- src/components/UI/Spinner.tsx | 104 ++++++++++++++++++ src/core/stores/appStore.ts | 62 ++++++++++- src/index.css | 10 ++ src/pages/Config/DeviceConfig.tsx | 2 +- src/pages/Config/index.tsx | 81 +++++++++----- 9 files changed, 303 insertions(+), 44 deletions(-) create mode 100644 src/components/UI/Spinner.tsx diff --git a/src/components/Form/FormSelect.tsx b/src/components/Form/FormSelect.tsx index bd0e24f0..98b4e6b0 100644 --- a/src/components/Form/FormSelect.tsx +++ b/src/components/Form/FormSelect.tsx @@ -13,6 +13,7 @@ import { Controller, type FieldValues } from "react-hook-form"; export interface SelectFieldProps extends BaseFormBuilderProps { type: "select"; + selectChange?: (e: string) => void; properties: BaseFormBuilderProps["properties"] & { enumValue: { [s: string]: string | number; @@ -40,7 +41,10 @@ export function SelectInput({ : []; return (