Skip to content

Comments

Replace UrlEncode library with local implementation.#811

Merged
rbergen merged 25 commits intoPlummersSoftwareLLC:mainfrom
robertlipe:chore/remove-urlencode
Jan 25, 2026
Merged

Replace UrlEncode library with local implementation.#811
rbergen merged 25 commits intoPlummersSoftwareLLC:mainfrom
robertlipe:chore/remove-urlencode

Conversation

@robertlipe
Copy link
Collaborator

Description

Removed UrlEncode third-party dependency.

  • Add include/UrlEncode.h proto and new (better) body in src/network.cpp.
    Uses RFC 1738 style percent-encoding.
  • Guarded the urlEncode function and its usage in src/deviceconfig.cpp with #if ENABLE_WIFI. It may be possible to do better later, but we agree for now that without WIFI, there is no URL.
  • Removed unused includes of UrlEncode.h from PatternStocks.h and PatternSubscribers.h.

Contributing requirements

  • I read the contribution guidelines in CONTRIBUTING.md.
  • I understand the BlinkenPerBit metric, and maximized it in this PR.
  • I selected main as the target branch.
  • All code herein is subjected to the license terms in COPYING.txt.

robertlipe and others added 4 commits January 5, 2026 03:03
…ncode

include/effects/matrix/PatternSubscribers.h: Removed unused include of UrlEncode
platformio: Remove external dependency of UrlEncode
src/deviceconfig.cpp: If we don't have WiFi, we don't have a URL.
src/network.cpp: Add textbook implementaion of urlEncode.

effects/matrix/PatternSubscribers.h: Removed unused include of UrlEncode
Copy link
Collaborator

@rbergen rbergen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may elicit a "yeah, right" from you, but I saw this one coming when we were discussing #788. :)

I have a couple of comments. I expect their phrasing will show I feel (much) more strongly about one than the other.

@rbergen
Copy link
Collaborator

rbergen commented Jan 10, 2026

@robertlipe Just quickly checking if you're planning to get back to this?

@robertlipe
Copy link
Collaborator Author

robertlipe commented Jan 11, 2026 via email

@rbergen
Copy link
Collaborator

rbergen commented Jan 11, 2026

No problem, I was just checking in, in the context of regular PR housekeeping.

The rationale was to minimize and localize the change. That's why I
kept/made the header. We have a ton of audio/networking code that isn't
"correctly" conditionalized so I didn't go on a recursive chase for that. I
minimized the blast radius.

But I understood that's what it takes, so I'll come back to this.

Well actually, I understand the header, or a header separate from any others we have. It's networking-related code in our thinking, but pulling in network.h wherever URL encoding may be need feels like overkill. Maybe a utilities.h (with accompanying .cpp) would make more "generic" sense in our specific context, particularly considering your ideas about a possible future for other dependencies.

In any case, the other thing (the current scope of #if ENABLE_WIFI) I feel far more strongly about.

I also have a note at home that there was something else I recently
half-proposed that you'd pre-approved in principle, so it's on my near-term
list, too. Oh, and some doc.

Haha, I always love it when people make vague references to things I've pre-approved in principle. ;)

I've not forgotten about the project. Far from it.

I didn't think that for a second. My question was strictly scoped to this PR.

Copy link
Collaborator

@rbergen rbergen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor case of PR creep, which I've noted for the record. LGTM otherwise.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll pretend I didn't see this feature being snuck in with the UrlEncode refactor. ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the integration.

Moving uptime, unchanged, from a file that was networking (where it used to live because debug stuff was entangled with network stuff) to a file that is home for debugging was not a new feature and was not sneaky. It was a very deliberate change as part of making ENABLE_WIFI (which clearly otherwise applies to networking.cc) honest, as it required that method to be rehomed so it could still be available even in builds without ENABLE_WIFI, as this is useful over the console port.

I landed DoUptime back in 2023 in #402 because when running long times for leaks or stability testing, I want to see that it's been running a long time and didn't crash or reboot minutes before I walked back into the room. Even then we noted it was an awkward fit

But agreed that this PR morphed from "don't download and install a 20 line function 50 times" to make ENABLE_WIFI (and related networking #defines) actually bracket when they claim to bracket. That was me taking your request to its conclusion.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...which I appreciate. In any case, the comment was mainly about the addition of the "uptime" command to the CLI command set. To which you may say "are you serious?", to which I would reply "no, that's why I approved and merged."

I think the PR adds a number of sanity checks/extra safeguards to a complicated area of the codebase (anything networking), which is unequivocally a good thing to do. So, thank you for it!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But uptime wasn't added. It was added in 2023. It was moved from one file to another.

Are we talking past each other?

But, yeah, this definitely ballooned, but leaves it better than we found it.

@rbergen rbergen merged commit 8f460f9 into PlummersSoftwareLLC:main Jan 25, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants