Let the user choose the guest host name

0.2.0 hardcodes the proot utsname nodename to "DroidDeck". Steam sends
it as the machine name, so an install updated from an earlier build
(which reported Android's "localhost") shows up in Steam under a new
name, with the same machine-id and login. /etc/hostname cannot fix it
from inside: proot's -k override wins.

Add a "Host name" field (Performance > Session identity), stored in
SessionPrefs and passed to guestUtsname(). Only a valid RFC 1123 label
is saved; blank or invalid falls back to the old default, "DroidDeck",
so nothing changes for anyone who leaves it alone. The value is also
listed in device.txt.
This commit is contained in:
magartus committed 2026-09-28 22:58:54 +02:00
1 parent ae4f6727e0
commit f823209ac5
6 files changed
+84 -6

No files matched your search

@@ -0,0 +1,30 @@
package com.droiddeck.launcher.session
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test
class GuestHostnameTest {
@Test fun validLabelsAreKept() {
assertEquals("localhost", SessionPrefs.validGuestHostname("localhost"))
assertEquals("Fold8-Steam", SessionPrefs.validGuestHostname("Fold8-Steam"))
assertEquals("a", SessionPrefs.validGuestHostname("a"))
assertEquals("x".repeat(63), SessionPrefs.validGuestHostname("x".repeat(63)))
}
@Test fun surroundingSpaceIsTrimmed() {
assertEquals("localhost", SessionPrefs.validGuestHostname(" localhost \n"))
}
@Test fun anythingElseIsRejected() {
assertNull(SessionPrefs.validGuestHostname(null))
assertNull(SessionPrefs.validGuestHostname(""))
assertNull(SessionPrefs.validGuestHostname(" "))
assertNull(SessionPrefs.validGuestHostname("-leading"))
assertNull(SessionPrefs.validGuestHostname("trailing-"))
assertNull(SessionPrefs.validGuestHostname("two words"))
assertNull(SessionPrefs.validGuestHostname("dotted.name"))
assertNull(SessionPrefs.validGuestHostname("back\\slash"))
assertNull(SessionPrefs.validGuestHostname("x".repeat(64)))
}
}