Skip to content

Get and set pretty hostname to use as system name in Web UI#997

Merged
rdmark merged 21 commits intodevelopfrom
rdmark-pretty-hostname
Nov 20, 2022
Merged

Get and set pretty hostname to use as system name in Web UI#997
rdmark merged 21 commits intodevelopfrom
rdmark-pretty-hostname

Conversation

@rdmark
Copy link
Copy Markdown
Member

@rdmark rdmark commented Nov 18, 2022

  • Display the pretty hostname as system name in header
  • Move IP and hostname down to the footer
  • New endpoint for setting the pretty hostname, plus form field in the Web UI
  • (unrelated) Use platform.uname() instead of shell uname
  • (unrelated) Better logic for fetching the Mac HD Drivers zip file in easyinstall.sh

@rdmark rdmark changed the title Rdmark pretty hostname Get and set pretty hostname and use as device name in Web UI Nov 18, 2022
@rdmark rdmark changed the title Get and set pretty hostname and use as device name in Web UI Get and set pretty hostname to use as device name in Web UI Nov 18, 2022
@rdmark rdmark requested a review from nucleogenic November 18, 2022 21:50
@rdmark rdmark changed the title Get and set pretty hostname to use as device name in Web UI Get and set pretty hostname to use as system name in Web UI Nov 19, 2022
"""
Changes the hostname of the system
"""
name = request.form.get("system_name")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this need any validation, e.g. is the downstream command that receives this value OK with untrusted input?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good question... hostnamectl seems to be quite forgiving with what can be set as a pretty hostname. Maybe we can set an arbitrary max limit on the str length for starters: something like 120 chars seems to be what would reasonably fit in the UI. An empty string is technically a valid input, since that's how you remove the pretty hostname.

I assume posted form data are always strings, but adding a cast to str could be a minor safeguard just in case.

Any obvious safeguards that I'm missing?

@rdmark rdmark requested a review from nucleogenic November 20, 2022 02:48
@rdmark rdmark merged commit 0d95890 into develop Nov 20, 2022
@rdmark rdmark deleted the rdmark-pretty-hostname branch November 20, 2022 18:20
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