Preview the generated kolibri.local URL when setting the device name
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
#14858 makes each Kolibri server advertise a <device-name>.kolibri.local mDNS record derived from a slugified device name, giving a memorable, bookmarkable URL. But nothing tells the user, at the moment they choose the name, what URL it will produce — so the naming and its consequence are disconnected. Add a live preview of the generated URL (with port suffix) wherever the device name is set: the setup wizard and the Device Info edit modal.
Complexity: Low Target branch: develop
Context
- The URL is built server-side in
kolibri/core/discovery/utils/network/broadcast.py(LOCAL_DOMAIN = "kolibri.local"). - The served port comes from the
HTTP_PORToption (kolibri/utils/options.py, default 8080). - #14858's slug rule: lowercase, drop characters outside
[a-z0-9-]("Tony's Laptop" →tonyslaptop). - An empty slug publishes no device-name record.
Device name is set in two places:
- Setup wizard:
DeviceNameForm.vue(KTextbox, seeded into the wizard state machine). - Device Info page:
DeviceNameModal.vue(KTextbox, PATCHeskolibri:core:devicename).
The frontend needs the slug rule and the port to render the same URL the server will own.
The Change
Below the device-name field, show a live preview of the URL the name will produce, so the user can choose a name for the address they want. Replicate #14858's slug rule in JS rather than round-tripping to the server. Preview only the <device-name>.kolibri.local URL — the one the input controls — not the bare kolibri.local. Both edit surfaces (DeviceNameForm.vue, DeviceNameModal.vue) share one implementation, factored into kolibri-common.
The concrete requirements are in Acceptance Criteria.
How to Get There
- Setup wizard: start an unprovisioned Kolibri, proceed to the "Device name" step.
- Device Info: as an admin, go to Device → Info, click the edit (pencil) button on the device-name row to open the modal.
Out of Scope
- Publishing the mDNS records themselves — that is #14858.
- Previewing the bare
kolibri.localURL. - The Device Info page's owned-URL list (also #14858); this task only touches the name-editing surfaces.
- Any server-side change — the preview is client-side only.
Acceptance Criteria
General
- [ ] Both
DeviceNameForm.vue(setup wizard) andDeviceNameModal.vue(Device Info) show a live URL preview below the device-name field. - [ ] The preview shows
http://<slug>.kolibri.local:<port>, with<slug>matching #14858's slug rule and<port>the configuredHTTP_PORT. - [ ] The preview updates on each keystroke.
- [ ] When the name slugifies to empty, no URL is shown; instead a message explains the name produces no custom address and the server stays reachable via
kolibri.localand its IP. - [ ] The slug + preview logic lives in one shared implementation in
kolibri-common, used by both surfaces.
Accessibility and i18n
- [ ] All preview text is internationalized via
createTranslator. - [ ] The preview is associated with the input for screen readers (not a bare floating string).
Testing
- [ ] Tests cover the slug function, including a name that slugifies to empty.
- [ ] Tests cover that a typed name renders the expected URL preview and that an empty-slug name renders the fallback message instead.
AI usage
Drafted with Claude Code. Claude located the two device-name editing components, the slug rule and port in #14858 and the broadcast/options code, and drafted the issue section by section from my instructions. I chose the JS-replicated slug, the shared kolibri-common code, the live-on-keystroke behaviour, and the empty-slug handling.
Blocking discrepancy with the merged #14858 — the URL format to preview has changed.
This issue specifies previewing http://<slug>.kolibri.local:<port>. #14858 (merged into develop via #14944 on 2026-07-10) does not publish a <device-name>.kolibri.local record. It publishes a single-label <slug>.local hostname:
slugify_device_name()inbroadcast.pybuilds a slug for a<device-name>.localhostname (docstring example:tonyslaptop.local).local_hostnamesreturns e.g.["kolibri.local", "tonyslaptop.local"]— the barekolibri.localplus the single-label device name, never<slug>.kolibri.local.
The multi-label <device>.kolibri.local form was dropped precisely because it's unresolvable on standard mDNS clients.
Implementing this issue as written would preview a URL (<slug>.kolibri.local) that the server does not own and that won't resolve — the opposite of the "choose a name for the address you'll get" goal.
Two things need confirming before implementing:
- Preview URL format — should the preview show
http://<slug>.local:<port>, matching what #14858 actually publishes? - Slug rule — the shipped rule is
re.sub(r"[^a-z0-9-]", "", name.lower())plus a 32-char cap (MAX_DEVICE_NAME_LABEL_LENGTH), which the issue's slug description omits. Should the JS replica mirror the cap?
Two notes, no action needed:
- The empty-slug fallback message referencing
kolibri.local+ IP is still accurate — the bare name is unchanged. - The Context section points at
LOCAL_DOMAIN = "kolibri.local"as the device-URL source. The authoritative source is nowslugify_device_nameand the<slug>.localconstruction.
Everything else in the AC looks implementable once the URL scheme is corrected.
The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.
1 Yes 2 Yes
Plan: Show a live http://<slug>.local:<port> preview below the device-name field in the setup wizard and the Device Info edit modal, so a user sees the address their chosen name produces as they type.
- [ ] Shared slug util
- [ ] Shared
DeviceUrlPreview.vuecomponent - [ ] Wire the preview into both edit surfaces
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
- Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
- Ran the project's full test suite and linter before committing
- For UI changes: captured live screenshots to verify rendering
- For backend changes: verified with example API/CLI output
The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.
The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.
The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.
Fixed in #15003