mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Fix Kotlin coding style
This commit is contained in:
@@ -37,7 +37,7 @@ constructor(
|
||||
?: throw UsageError("Could not get password. Is STDIN connected?")
|
||||
try {
|
||||
accountManager.signIn(password)
|
||||
} catch (e : DecryptionException) {
|
||||
} catch (e: DecryptionException) {
|
||||
echo("Error: Password invalid")
|
||||
exitProcess(1)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,11 @@ package org.briarproject.briar.headless
|
||||
import com.fasterxml.jackson.core.JsonParseException
|
||||
import com.fasterxml.jackson.databind.ObjectMapper
|
||||
import io.javalin.Javalin
|
||||
import io.javalin.apibuilder.ApiBuilder.*
|
||||
import io.javalin.apibuilder.ApiBuilder.delete
|
||||
import io.javalin.apibuilder.ApiBuilder.get
|
||||
import io.javalin.apibuilder.ApiBuilder.path
|
||||
import io.javalin.apibuilder.ApiBuilder.post
|
||||
import io.javalin.apibuilder.ApiBuilder.put
|
||||
import io.javalin.core.security.AccessManager
|
||||
import io.javalin.core.util.Header.AUTHORIZATION
|
||||
import io.javalin.http.BadRequestResponse
|
||||
|
||||
@@ -6,16 +6,16 @@ import org.briarproject.briar.api.blog.MessageType
|
||||
import org.briarproject.briar.headless.json.JsonDict
|
||||
|
||||
internal fun BlogPostHeader.output(text: String) = JsonDict(
|
||||
"text" to text,
|
||||
"author" to author.output(),
|
||||
"authorStatus" to authorInfo.status.output(),
|
||||
"type" to type.output(),
|
||||
"id" to id.bytes,
|
||||
"parentId" to parentId?.bytes,
|
||||
"read" to isRead,
|
||||
"rssFeed" to isRssFeed,
|
||||
"timestamp" to timestamp,
|
||||
"timestampReceived" to timeReceived
|
||||
)
|
||||
"text" to text,
|
||||
"author" to author.output(),
|
||||
"authorStatus" to authorInfo.status.output(),
|
||||
"type" to type.output(),
|
||||
"id" to id.bytes,
|
||||
"parentId" to parentId?.bytes,
|
||||
"read" to isRead,
|
||||
"rssFeed" to isRssFeed,
|
||||
"timestamp" to timestamp,
|
||||
"timestampReceived" to timeReceived
|
||||
)
|
||||
|
||||
internal fun MessageType.output() = name.toLowerCase()
|
||||
|
||||
@@ -2,7 +2,11 @@ package org.briarproject.briar.headless.contact
|
||||
|
||||
import org.briarproject.bramble.api.contact.PendingContact
|
||||
import org.briarproject.bramble.api.contact.PendingContactState
|
||||
import org.briarproject.bramble.api.contact.PendingContactState.*
|
||||
import org.briarproject.bramble.api.contact.PendingContactState.ADDING_CONTACT
|
||||
import org.briarproject.bramble.api.contact.PendingContactState.CONNECTING
|
||||
import org.briarproject.bramble.api.contact.PendingContactState.FAILED
|
||||
import org.briarproject.bramble.api.contact.PendingContactState.OFFLINE
|
||||
import org.briarproject.bramble.api.contact.PendingContactState.WAITING_FOR_CONNECTION
|
||||
import org.briarproject.bramble.api.contact.event.PendingContactAddedEvent
|
||||
import org.briarproject.bramble.api.contact.event.PendingContactRemovedEvent
|
||||
import org.briarproject.bramble.api.contact.event.PendingContactStateChangedEvent
|
||||
@@ -14,7 +18,7 @@ internal fun PendingContact.output() = JsonDict(
|
||||
"timestamp" to timestamp
|
||||
)
|
||||
|
||||
internal fun PendingContactState.output() = when(this) {
|
||||
internal fun PendingContactState.output() = when (this) {
|
||||
WAITING_FOR_CONNECTION -> "waiting_for_connection"
|
||||
OFFLINE -> "offline"
|
||||
CONNECTING -> "connecting"
|
||||
|
||||
Reference in New Issue
Block a user