-
Notifications
You must be signed in to change notification settings - Fork 315
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
Fix edge case of playerName with uppercase letters #1530
Conversation
I'm confused about how this change helps. Can you state what your problem was before and how the change fixes it? |
The However in |
That helps a lot, thank you. |
FWIW, "MacBook-Pro", or "iPhone" doesn't seem to be a issue in my network… It might be a pet peeve, but having Volumio players announce themselves with all lowercase names for Airplay and Spotify Connect irks me more than it should. So inelegant… 🙈 |
I don't know the history and but given that there is
I could not agree more - I have hard coded the device names in my Spotfy connect installation for exactly this reason! Also, according to Bonjour's specs you can have quite creative ServiceNames! |
I don't know what else See #253 |
playerName is the actual name of the Volumio player |
@volumio Since we derive the hostname anyway from the playerName, can't we allow some flexibility (utf-8 and caps) in it? |
@ashthespy yes we can, however the hostname should be all lowercase and with - instead of spaces. What's your idea? |
@volumio How about a validation check in Something along the lines of: hostenameRegex = /^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])+/g;
var validHostname = player_name.match(hostenameRegex)[0] || 'volumio';
if (validHostname === player_name) {
self.commandRouter.pushToastMessage('success', self.commandRouter.getI18nString('SYSTEM.SYSTEM_CONFIGURATION_UPDATE'), self.commandRouter.getI18nString('SYSTEM.SYSTEM_CONFIGURATION_UPDATE_SUCCESS'));
} else {
self.commandRouter.pushToastMessage('warn', self.commandRouter.getI18nString('SYSTEM.SYSTEM_CONFIGURATION_UPDATE'), 'SYSTEM.SYSTEM_CONFIGURATION_HOSTNAME_WARNING');
}
self.setHostname(validHostname); |
+1 for this. Many months ago I tried writing a function to do this and some associated tests but got bogged down with all the name conventions that are allowed. I'll see if I can dig it out and attach here. |
I just quickly looked up the underlying daemons ( @xipmix Do you mean for conventions for hostname? The regex snippet matches the RFC 1123, but only for the first part of a FQDN. |
@volumio a little OT, but is there a specific reason behind displaying device names in uppercase in volumiodiscovery? |
@ashthespy mainly for aesthetics |
A small summary of my findings so far. I found
I don't fully understand the difference b/w |
I dug out the stuff I wrote a while ago. It's incomplete and probably the wrong direction but maybe the tests I wrote could be reworked into something useful. See attached. Licence: public domain. I don't know what to advise about depending on punycode. I would suggest getting something that works with the ascii subset, with the intention of adding utf8 support in another iteration. |
Sorry, github didn't send me any emails for some reason. @xipmix That is quite extensive and complete, I was thinking of a more simple Ok/NotOk kind of test for the hostname and defaulting to I made some preliminary tests with punycode for utf-8 hostnames, and it's quite network depended I feel. My browser could find Given the broad user base of Volumio, I would again suggest we use the If everyone is along the same lines, I shall make a small POC the following days :-) |
@ashthespy Hi Ash, sorry for this super late reply... However, this is now broken, and I admit that system.name does not help much: basically this is the same as system_name but it's a shared variable used to avoid to call the system plugin to retrieve the configuration. We had lot of issues with this mdns thing, since when you start airplay, for instance, it finds a duplicate neame, or when you restart the networking stack. Probably the hostname command, (which before was not successful with names with more than a word) triggers an edge case we did not consider, probably resulting in avahi restarting too many times and making mdns go nuts... Hope this helps you understand and looking forward for your POC! |
Has this been fixed? |
@volumio This is still an open issue in 2.917. Upon reset the device name changes to dash-case. |
Fixed in Volumio 3 🥳 |
Fixes the renaming of device back to default (for the edge case that I had of a playerName in camelCase ).
It would seem that my issues were nothing related to
mdns
and node v8 ;-)