mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-05 16:22:32 -08:00
Use randomized Android GUI port
This commit is contained in:
2 files changed
+4
-2
No files matched your search
@@ -40,7 +40,7 @@ val vrServerInitialized: Boolean
|
||||
|
||||
fun startWebServer() {
|
||||
// Host the web GUI server
|
||||
webServer = embeddedServer(Netty, port = 34536) {
|
||||
webServer = embeddedServer(Netty, port = 0) {
|
||||
routing {
|
||||
install(CachingHeaders) {
|
||||
options { _, _ ->
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.webkit.WebSettings
|
||||
import android.webkit.WebView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import io.eiren.util.logging.LogManager
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import java.util.concurrent.locks.ReentrantLock
|
||||
import kotlin.concurrent.withLock
|
||||
|
||||
@@ -71,7 +72,8 @@ class MainActivity : AppCompatActivity() {
|
||||
guiWebView.clearCache(true)
|
||||
|
||||
// Load GUI page
|
||||
guiWebView.loadUrl("http://127.0.0.1:34536/")
|
||||
val port = runBlocking { webServer.engine.resolvedConnectors().first().port }
|
||||
guiWebView.loadUrl("http://127.0.0.1:$port/")
|
||||
LogManager.info("[MainActivity] GUI WebView has been initialized and loaded.")
|
||||
|
||||
// Start a foreground service to notify the user the SlimeVR Server is running
|
||||
|
||||
Reference in new issue
Block a user