prettify
This commit is contained in:
parent
4fa908779d
commit
f0e5732cc7
|
|
@ -92,15 +92,15 @@ fun main() {
|
|||
</head>
|
||||
<body>
|
||||
<h1>Welcome to HeatControl</h1>
|
||||
<p>Please log in to view the current temperature</p>
|
||||
<p>Please log in to view the current temperature.</p>
|
||||
<br />
|
||||
<p>
|
||||
Login Form
|
||||
<br />
|
||||
<form action="/login/in" method="post">
|
||||
<label for="uname">user name:</label><br />
|
||||
<label for="uname">Username:</label><br />
|
||||
<input type="text" id="uname" name="uname"><br />
|
||||
<label for="pwd">password:</label><br />
|
||||
<label for="pwd">Password:</label><br />
|
||||
<input type="password" id="pwd" name="pwd"><br />
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
|
|
@ -224,7 +224,7 @@ fun main() {
|
|||
}
|
||||
|
||||
val forecastQuery = Thread {
|
||||
while (!Thread.interrupted()) {
|
||||
whileNotInterrupted {
|
||||
var success = false
|
||||
val request = HttpRequest.newBuilder(URI.create(GlobalDataStore.API)).GET().build()
|
||||
HttpClient.newHttpClient()
|
||||
|
|
@ -320,7 +320,7 @@ fun main() {
|
|||
val pidController = PidController(c1, c2, c3)
|
||||
|
||||
var cycles = -1
|
||||
while (!Thread.interrupted()) {
|
||||
whileNotInterrupted {
|
||||
if (cycles < 0) {
|
||||
c1.runCalibrationSequence()
|
||||
c2.runCalibrationSequence()
|
||||
|
|
@ -372,8 +372,17 @@ private fun getAuthToken(exchange: HttpExchange) =
|
|||
exchange.requestHeaders["Cookie"]
|
||||
?.let { if (it.size > 0) it[0] else null }
|
||||
?.let { it.split("; ") }
|
||||
?.filter { it.startsWith("auth=") }
|
||||
?.firstOrNull()
|
||||
?.firstOrNull { it.startsWith("auth=") }
|
||||
?.let { it.split("=").let { if (it.size == 2) it[1] else "" } }
|
||||
?: ""
|
||||
|
||||
fun whileNotInterrupted(body: () -> Unit) {
|
||||
try {
|
||||
while (!Thread.interrupted()) {
|
||||
body()
|
||||
}
|
||||
Thread.currentThread().interrupt()
|
||||
} catch (e: InterruptedException) {
|
||||
Thread.currentThread().interrupt()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user