Draft
Don't append redundant palette_colors param to URLs#41
Conversation
Co-authored-by: balloob <1444314+balloob@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix URL generation by excluding color palette when equal to colors
Don't append palette_colors param when it equals colors
Nov 21, 2025
balloob
reviewed
Nov 21, 2025
|
|
||
| if (palette_colors && palette_colors !== (currentDeviceConfig.palette_colors || "")) { | ||
| // Only add palette_colors if it's different from colors (backend defaults palette_colors to colors when empty) | ||
| if (palette_colors && palette_colors !== (currentDeviceConfig.palette_colors || "") && palette_colors !== colors) { |
Owner
There was a problem hiding this comment.
@copilot we should also not add palette_colors if it's the same as currentDeviceConfig.colors and there is no colors.
Contributor
Author
There was a problem hiding this comment.
Done in a408c86. Added check (colors || palette_colors !== (currentDeviceConfig.colors || "")) to skip palette_colors when it equals device's colors and colors param is not being added.
…m is not added Co-authored-by: balloob <1444314+balloob@users.noreply.github.com>
Co-authored-by: balloob <1444314+balloob@users.noreply.github.com>
Copilot
AI
changed the title
Don't append palette_colors param when it equals colors
Don't append redundant palette_colors param to URLs
Nov 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The frontend appends
palette_colorsto screenshot URLs even when it's redundant, creating unnecessarily long URLs since the backend defaultspalette_colorstocolorswhen empty (http.js:165-168).Changes
Modified
buildUrl()inpuppet/ha-puppet/html/index.htmlto skippalette_colorsparameter in multiple redundant scenarios:Device mode:
Non-device mode:
Result
The
palette_colorsparameter is now omitted when:colorsparameterpalette_colorsconfigcolorsANDcolorsparam is not being addedExamples:
Before:
?colors=000000,FFFFFF&palette_colors=000000,FFFFFFAfter:
?colors=000000,FFFFFFBefore (device mode, both match device):
?viewport=800x600&palette_colors=FF0000,00FF00After (device mode, both match device):
?viewport=800x600URLs are shorter and backend behavior is unchanged.
Testing
All test cases passed including edge cases for device mode configurations.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.