feat: support custom CTCP VERSION responses #4780
Closed
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.
Closes #1344
Adds a new config option,
versionResponse
, which is described as follows:The goals of this, in descending order of importance, are:
User-Agent
string: https://css-tricks.com/freezing-user-agent-strings/I originally wanted to just have a static
versionResponse
string, but I saw thatdefaults/config
lives outside ofserver
, so it wouldn't be right to pull inHelper.getVersion
there. Another option would be to treatversionResponse
as an "override" that's only used when defined so it doesn't need to be template-able, or to movegetVersion
toshared
.I tested this locally via
node ./dist/server/command-line/index.js start -c versionResponse=foo
and confirmed it works as expected, and also confirmed the default works as expected.No support is added in this PR for disabling VERSION responses entirely. This is because CLIENTINFO and SOURCE CTCP responses also expose that thelounge is running, so there would be little point in disabling only VERSION. A future PR could add an option to disable/obfuscate all 3. Passing
versionResponse=
will result in a blank VERSION response only.Please let me know if you have feedback on the API design here, I'm open to making changes.
Pre-merge tasks: