8000 Trim spaces from SSID by w3irdrobot · Pull Request #728 · bitaxeorg/ESP-Miner · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Trim spaces from SSID #728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 26, 2025
Merged

Trim spaces from SSID #728

merged 1 commit into from
Feb 26, 2025

Conversation

w3irdrobot
Copy link
Contributor

I noticed a while ago that the string inputs are not trimmed of spaces. This can cause, in my use-case, issues with the SSID not matching when typing the SSID in manually from a phone when the word Bitcoin is auto-completed. This PR simply trims the SSID input on the API and client side. I only did this for the SSID for now to simplify the initial PR, since this concept could, and perhaps should, be expanded to the other string inputs. This expansion would probably also help with #565.

@skot skot self-assigned this Feb 21, 2025
@skot
Copy link
Collaborator
skot commented Feb 21, 2025

Thanks for looking into this -- I have been wanting this one for a while!

Curious, is it necessary to trim strings in C, or would just on the frontend be enough?

@WantClue WantClue added the enhancement New feature or request label Feb 21, 2025
@WantClue
Copy link
Collaborator

LGTM
A good start and should be expanded

@w3irdrobot
Copy link
Contributor Author

@skot my usual motto/advice/ethos/whatever is that validation and sanitation have to happen on the backend API level. it's optional but suggested to also at least validate, if not also sanitize, values on the frontend as well.

the frontend can be bypassed by just using the API without the frontend. that's why it's most important there. having it also occur in the browser is just good UX so things that happen on the backend are consistent with what the user sees when they submit the form.

@WantClue I'll open a new PR to expand this sanitation to the the other form fields once this is merged in. unless you'd prefer it just be done in this pr.

@skot
Copy link
Collaborator
skot commented Feb 21, 2025

@skot my usual motto/advice/ethos/whatever is that validation and sanitation have to happen on the backend API level. it's optional but suggested to also at least validate, if not also sanitize, values on the frontend as well.

the frontend can be bypassed by just using the API without the frontend. that's why it's most important there. having it also occur in the browser is just good UX so things that happen on the backend are consistent with what the user sees when they submit the form.

I agree that sanitizing inputs on the backend is a good idea. I think in this case though, we're just cleaning up a UI/Autocorrect quirk. If a user submits a SSID with a trailing space over the API, we should prolly assume they meant it, and allow it.

@w3irdrobot
Copy link
Contributor Author

i would usually consider this an anti-pattern. however, if we wanna support that case, that's fine. i can take that part out of the api portion and leave in the frontend trimming. that's a smaller piece of code anyways.

@WantClue
Copy link
Collaborator

Frontend trimming should be the only goal here. Still it might be confusing to the user.

@w3irdrobot
Copy link
Contributor Author

ok. i've updated the PR to only trim on the frontend.

@WantClue WantClue merged commit 56731b5 into bitaxeorg:master Feb 26, 2025
2 checks passed
WantClue added a commit that referenced this pull request Mar 30, 2025
* Is SPIRAM Available? (#626)

* Keep old pool config synchronized until reboot (#543)

* fix: add mock data and cache to theme service (#654)

* fix: add mock data and cache to theme service

* chore: cleanup

* fix: Color swarm ips by model or count (#647)

* fix: Color swarm ips by model or count

* fix: Add legend at bottom of table

* fix: Show IP of bitaxe you are restarting on swarm (#646)

* fix: Show IP of bitaxe you are restarting on swarm

* fix: show edit uri if provided on toasts

* refactor: make recovery page an embedded file (#649)

Makes the recovery page an embedded file rather
than a C header. This increases readability and
also serves as an example for Issue #308.

* Menu rework, adding menu Design (#675)

* feat: add new Design menu

* fix: remove theme from settings

* feat: add orange

* fix: remove old theme-config

* fix: add proper spacing

* fix: labeling

* Pool rework menu (#676)

* feat: pool component

* fix: style Pool Configuration

* fix: add restart logic to pool settings

* Enable Unit Test CI (#634)

* Enable Unit Test CI

* Remove non-functional entrypoint

* symlink CMakeLists.txt

* Don't allow 0.0.0.0 (#665)

* use length rather than static 4 for hex2bin func of extranonce2_generate (#660)

* Reduce invalid job found log from error to warning (#480)

* Reduce invalid job found from error to info

* Standarized on LOGW for Invalid job

* Update angular to 18 (#678)

* Update angular to 18

* Bump to Angular 18.2.13

* Fix security warnings

* Grandma knows what Wifi means! (#623)

* Grandma knows what Wifi means!

Use Wifi instead of SSID on screen, and add short `(join for setup)` message instead of `Configuration SSID`.
This should be easier to understand, but does add 2 characters, which will fill the screen completely.

* Change NVS configs to init wifi with empty strings, and check for empty string when initializing wifi

* Change `WiFi` to `Wi-Fi` in `connect.c`

* Change what information shows on screen during inital setup and on wifi error

* fix: remove camelCase

remove Bitaxe camel case

---------

Co-authored-by: Upstream Data <brett@upstreamdata.ca>
Co-authored-by: WantClue <86001033+WantClue@users.noreply.github.com>

* SSID WiFi lookup (#679)

* init

* fix: filter out poor networks

* fix: adjust wifi setup text speed (#682)

* Fix Wi-Fi spelling (#684)

* Fix Wi-Fi spelling

* Shorten label

* Wifi scan fix (#690)

* feature: wifi reconnect disable wifi connect

* fix: scanning flag to prevent reconnect attempts

* fix: add external bool, define globally

* fix: wifi scan on missing ssid

* fix: remove unused connected flag

* Bugfix: Submit shares that are exactly equal to the target when rounded to a "diff" (#687)

* Improved pool fallback code (#693)

* Disconnect if no data received in more than 10 minutes

* Minor socket fix

* Removed unused code and minor nit fix

* Updated confusing log connect message (#697)

* More Wi-Fi spelling fixes (#685)

* GammaTurbo support and HW abstraction (#698)

* initial changes for the gammaturbo bringup
* added preliminary TPS546 changes
* added preliminary EMC2103 support
* ASIC temp seems to be maybe working.
* magically now fan seems to have the right polarity
* added in ideality and beta constants (currently unused). Fixed EMC2103_get_fan_speed()
* abstract fan and ASIC temp into thermal functions
* abstracted voltage regulator specifics out of tasks and into power.c and vcore.c functions
* add TPS546 support for multiple models
* move TPS40305/DS4432U vout setter to DS4432U.c
* move all ASIC specific functions to asic.c
* bad device_model nvs handling
* remove old code
* add workaround for TPS546 VIN_UV_WARN_LIMIT silicon bug.

* fix(ui): display placeholder for unavailable ASIC temp (#692)

* fix(ui): display placeholder for unavailable ASIC temp
* fix(screen): update placeholders to match UI

* Init AxeOS AP mode (#624)

* Init AxeOS AP mode

* Use minimal layout with logo for AP mode

* apEnabled off

* Don't show -1 temperature on screen (#703)

Follow-up of #692

* Restore Max support (#705)

* Disable softap even if we don't have a valid model (#706)

* Remove undefined method headers (#704)

* fix: Move avg hash to card & add eff avg (#643)

* fix: Move avg hash to card & add eff avg

* fix: Try different layout

* fix: Move expected to under avg

* feat: add tooltip for pwm invert and flip screen (#709)

* add Pro mode button (#712)

* feat: add tooltip for pwm invert and flip screen

* feat: add Pro Mode Button

* Revert "add Pro mode button (#712)" (#713)

This reverts commit fe78e05.

* add repobeats

* feat: unlock OC (#714)

* feat: update readme (#720)

* Remove hard code (#721)

* fix: typo in .find (#724)

* Fix stackoverflow when upgrading (#723)

* Show firmware updates on the display (#664)

* Trim spaces from front and back of SSID on client side (#728)

* add sorting switch to swarm page for hostname and ip (#733)

* Show share reject reasons (#746)

* Show share reject reasons

Fixes #264

* Fix string assignment

* fix: current not exposed to api (#749)

* Remove unit test workaround for qemu (#743)

* Refactor Stratum code for Seamless Failover (#717)

* Refactor stratum code

* No need to abandon work when switching connection

* Bump primary task priority slightly

* Reduce watchdog stack size

* Revert debug changes

* Removed unused code

* Removed unused unit test code

* Handle jobs more aggressively

* Fix merge conflict

* feat: frequency transition (#747)

* feat: frequency transition

* remove floats that are unnecessary

* fix: callback of set_freq function

* refactor asic model code to asic.c

* fix: change namining scheme

* Revert "Refactor Stratum code for Seamless Failover (#717)" (#754)

This reverts commit 1eeb303.

* Verify CHIP_ID response (#745)

* Verify CHIP_ID response

Fixes #740

* Log warning on CHIP_ID mismatch

* Fix CHIP_ID checksum calculation

* On BM1397, CORE_NUM should be 0x18

* CORE_NUM and ADDR log only and early exit when no chips are detected

* Fix compile error

* Refactored out duplicated code

Moved count_asic_chips and receive_work functions to common.c
Moved asic_response_buffer to local scope
Unified preamble and crc check on serial rx
Fixed typo in proccess_work
Moved CRC5_MASK define to proper location

* Change receive_work read timeout log to debug

* Changed wrong log to debug

* Fix merge

* Fix length check for bm1397

* add ASIC TX dubugging on BM1397 (crap, does this fix the ticket mask?!)

---------

Co-authored-by: Skot <skot@bitnet.cx>

* fix: use url params to unlock overclock (#729)

* fix: use url params to unlock overclock

* fix: better message

* chore: wording update again

* chore: shorten message more

* Overclock url params (#770)

* fix: use url params to unlock overclock

* fix: better message

* chore: wording update again

* chore: shorten message more

* feat: add nvs storage of oc mode

* fix: remove duplicate

---------

Co-authored-by: mrv777 <mrv777@users.noreply.github.com>

* fix: swap update www and esp-miner (#771)

* fix: ports over everything to bitaxeorg (#774)

* Improve null handling in API settings PATCH (#748)

* Improve null handling in API settings PATCH

* Use CJSON lib function for string detection

This reverts commit e0cbb87.

* Update readme.md with latest unlock settings

* Update unittest.yml

update permissions on workflow

* Create TPS546 VCORE alerts (#780)

* add ISR for SMB_ALRT and checking in systemtask

* change order of gpio ISR init

* switch back tp TPS546 status polling

* added some comments arbout the structure of the 3 fault responses

* feat: add TPS alerts to UI

* change Gamma VIN_OV_FAULT_LIMIT from 5.5V to 6.5V

* changed the power fault banner to use the SYSTEM_MODULE.power_fault flag. Found the right TPS546 register so that a soft reset clears a power fault.

* clean up fault alert wording

* remove the PMBUS_ALERT interrupt -- that never worked.

* cleanup https_server.c includes

* remove unused TPS546 functions

* handle setting the power_fault flag in TPS546.c. only print the error messages once.

* make TPS542 faults debug more consistent

* added more detail to TPS546_parse_status()

---------

Co-authored-by: WantClue <Lars_Naether@hotmail.de>

* Update release-beta.yml

* Update release-beta.yml

* Update release-factory-beta.yml

* V2.6.0b11 selftest fixes (#783)

* make sure to gpio_install_isr_service() in selftest

* fix the scrolling message on selftest pass/fail

* Remove bm1397 module (#778)

* global_state: Remove unused bm1397Module

The asic frequency is stored in POWER_MANAGEMENT_MODULE->frequency_value.

Signed-off-by: Robin van der Gracht <robinvandergracht@gmail.com>

* Remove unused bm1397Module

---------

Signed-off-by: Robin van der Gracht <robinvandergracht@gmail.com>
Co-authored-by: Robin van der Gracht <robinvandergracht@gmail.com>

* fix: release pipeline

* fix naming scheme of fan polarity (#786)

* ensure timeout in self test (#769)

* ensure timeout in self test

* explict type cast

* update explicit target percentages

* added test_vreg_faults() to selftest (#789)

* Add whitepaper (#735)

* Expose Wifi RSSI to API endpoint (#739)

* Max power gauges (#793)

* add max_power_settings

* feat: remove hard coded maxPower gauge

* feat: add variable voltage as well

* fix: remove hard coded marker

* fix: remove max_voltage

* add openapi spec for existing api (#736)

* Add asic failure status screen (#777)

* Add an asic-status screen and graceful continuation

Fixes #311

* Remove asic_state when model_name is unknown

* Added nodejs and npm v22 installation (#763)

* Added nodejs and npm v20 installation

This closes #762.

The required version can't be installed with `apt` since in the `espressif/idf:v5.4` image the default version is 18.

The `gzipper` package, on the other hand, requires at least version 20.

* Bumped node.js version to 22

As suggested in #763 (comment).

* changed TPS546_get_iout() to read the combined current for both phases (#796)

* fix: don't collect hashrate while in power_fault (#804)

---------

Signed-off-by: Robin van der Gracht <robinvandergracht@gmail.com>
Co-authored-by: Erik Olof Gunnar Andersson <eandersson@users.noreply.github.com>
Co-authored-by: terratec <989319+terratec@users.noreply.github.com>
Co-authored-by: mrv777 <mrv777@users.noreply.github.com>
Co-authored-by: tdb3 <106488469+tdb3@users.noreply.github.com>
Co-authored-by: adammwest <63965938+adammwest@users.noreply.github.com>
Co-authored-by: Brett Rowan <121075405+b-rowan@users.noreply.github.com>
Co-authored-by: Upstream Data <brett@upstreamdata.ca>
Co-authored-by: mutatrum <mutatrum@gmail.com>
Co-authored-by: Luke Dashjr <luke_github1@dashjr.org>
Co-authored-by: Skot <skot@bitnet.cx>
Co-authored-by: Steven Martins <139889226+steven-s-martins@users.noreply.github.com>
Co-authored-by: Dustin Butler <dustin@intrcomm.net>
Co-authored-by: w3irdrobot <3712883+w3irdrobot@users.noreply.github.com>
Co-authored-by: skot <140785+skot@users.noreply.github.com>
Co-authored-by: Robin van der Gracht <robinvandergracht@gmail.com>
Co-authored-by: Massimo Santini <massimo.santini@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0