mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 04:15:14 -04:00
account: states, eros: improve accounting
This commit is contained in:
parent
d6713951e9
commit
7d00d02ab4
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -18,9 +18,9 @@ import com.fasterxml.jackson.annotation.JsonSubTypes
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo
|
||||
import de.bixilon.kutil.collections.CollectionUtil.synchronizedMapOf
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.server.entries.Server
|
||||
import de.bixilon.minosoft.data.accounts.types.MicrosoftAccount
|
||||
import de.bixilon.minosoft.data.accounts.types.MojangAccount
|
||||
import de.bixilon.minosoft.data.accounts.types.OfflineAccount
|
||||
import de.bixilon.minosoft.data.accounts.types.microsoft.MicrosoftAccount
|
||||
import de.bixilon.minosoft.data.accounts.types.mojang.MojangAccount
|
||||
import de.bixilon.minosoft.data.accounts.types.offline.OfflineAccount
|
||||
import de.bixilon.minosoft.data.player.properties.PlayerProperties
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||
@ -37,6 +37,8 @@ abstract class Account(
|
||||
abstract val id: String
|
||||
abstract val type: ResourceLocation
|
||||
abstract val properties: PlayerProperties?
|
||||
@JsonIgnore open var state: AccountStates = AccountStates.UNCHECKED
|
||||
@JsonIgnore open var error: Throwable? = null
|
||||
|
||||
@Transient
|
||||
@JsonIgnore
|
||||
@ -45,5 +47,18 @@ abstract class Account(
|
||||
abstract fun join(serverId: String)
|
||||
|
||||
abstract fun logout(clientToken: String)
|
||||
abstract fun verify(clientToken: String)
|
||||
abstract fun check(clientToken: String)
|
||||
|
||||
@Synchronized
|
||||
open fun tryCheck(clientToken: String) {
|
||||
if (state == AccountStates.CHECKING || state == AccountStates.REFRESHING) {
|
||||
// already checking
|
||||
return
|
||||
}
|
||||
if (state == AccountStates.WORKING) {
|
||||
// Nothing to do
|
||||
return
|
||||
}
|
||||
check(clientToken)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.data.accounts
|
||||
|
||||
import de.bixilon.minosoft.data.language.Translatable
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
||||
|
||||
enum class AccountStates : Translatable {
|
||||
/**
|
||||
* The account might work
|
||||
*/
|
||||
UNCHECKED,
|
||||
|
||||
/**
|
||||
* It is just being checked, it might fail
|
||||
*/
|
||||
CHECKING,
|
||||
|
||||
/**
|
||||
* The session key is not working anymore, but it can be refreshed
|
||||
*/
|
||||
REFRESHING,
|
||||
|
||||
/**
|
||||
* The session key is working
|
||||
*/
|
||||
WORKING,
|
||||
|
||||
/**
|
||||
* The account is expired and credentials needs to be provided again
|
||||
*/
|
||||
EXPIRED,
|
||||
|
||||
/**
|
||||
* The account is invalid because of some other reason
|
||||
*/
|
||||
ERRORED,
|
||||
;
|
||||
|
||||
override val translationKey: ResourceLocation = "minosoft:main.account.state.${name.lowercase()}".toResourceLocation()
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -11,11 +11,12 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.data.accounts.types
|
||||
package de.bixilon.minosoft.data.accounts.types.microsoft
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import de.bixilon.minosoft.data.accounts.Account
|
||||
import de.bixilon.minosoft.data.accounts.AccountStates
|
||||
import de.bixilon.minosoft.data.player.properties.PlayerProperties
|
||||
import de.bixilon.minosoft.data.registries.CompanionResourceLocation
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
@ -35,20 +36,30 @@ class MicrosoftAccount(
|
||||
override val id: String = uuid.toString()
|
||||
override val type: ResourceLocation = RESOURCE_LOCATION
|
||||
|
||||
@Synchronized
|
||||
override fun join(serverId: String) {
|
||||
AccountUtil.joinMojangServer(username, accessToken!!, uuid, serverId)
|
||||
}
|
||||
|
||||
override fun logout(clientToken: String) = Unit
|
||||
|
||||
override fun verify(@Nullable clientToken: String) {
|
||||
@Synchronized
|
||||
override fun check(@Nullable clientToken: String) {
|
||||
if (accessToken != null) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
state = AccountStates.REFRESHING
|
||||
val (xboxLiveToken, userHash) = MicrosoftOAuthUtils.getXboxLiveToken(authorizationToken)
|
||||
val xstsToken = MicrosoftOAuthUtils.getXSTSToken(xboxLiveToken)
|
||||
|
||||
accessToken = MicrosoftOAuthUtils.getMinecraftBearerAccessToken(userHash, xstsToken)
|
||||
state = AccountStates.WORKING
|
||||
} catch (exception: Throwable) {
|
||||
this.error = exception
|
||||
this.state = AccountStates.ERRORED
|
||||
throw exception
|
||||
}
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -11,7 +11,7 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.data.accounts.types
|
||||
package de.bixilon.minosoft.data.accounts.types.mojang
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import de.bixilon.kutil.cast.CastUtil.nullCast
|
||||
@ -19,6 +19,7 @@ import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.json.JsonUtil.asJsonObject
|
||||
import de.bixilon.kutil.uuid.UUIDUtil.toUUID
|
||||
import de.bixilon.minosoft.data.accounts.Account
|
||||
import de.bixilon.minosoft.data.accounts.AccountStates
|
||||
import de.bixilon.minosoft.data.player.properties.PlayerProperties
|
||||
import de.bixilon.minosoft.data.registries.CompanionResourceLocation
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
@ -58,18 +59,26 @@ class MojangAccount(
|
||||
if (response.statusCode != 200) {
|
||||
throw AuthenticationException(response.statusCode)
|
||||
}
|
||||
|
||||
state = AccountStates.EXPIRED
|
||||
Log.log(LogMessageType.AUTHENTICATION, LogLevels.VERBOSE) { "Mojang account login successful (username=$username)" }
|
||||
}
|
||||
|
||||
override fun verify(clientToken: String) {
|
||||
override fun check(clientToken: String) {
|
||||
if (refreshed) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
refresh(clientToken)
|
||||
} catch (exception: Throwable) {
|
||||
this.error = exception
|
||||
state = AccountStates.ERRORED
|
||||
throw exception
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun refresh(clientToken: String) {
|
||||
state = AccountStates.REFRESHING
|
||||
val response = mutableMapOf(
|
||||
"accessToken" to accessToken,
|
||||
"clientToken" to clientToken,
|
||||
@ -84,6 +93,7 @@ class MojangAccount(
|
||||
this.accessToken = response.body["accessToken"].unsafeCast()
|
||||
|
||||
refreshed = true
|
||||
state = AccountStates.WORKING
|
||||
Log.log(LogMessageType.AUTHENTICATION, LogLevels.VERBOSE) { "Mojang account refresh successful (username=$username)" }
|
||||
}
|
||||
|
||||
@ -118,7 +128,7 @@ class MojangAccount(
|
||||
Log.log(LogMessageType.AUTHENTICATION, LogLevels.VERBOSE) { "Mojang login successful (email=$email)" }
|
||||
|
||||
val uuid = response.body["selectedProfile"].asJsonObject()["id"].toString().toUUID()
|
||||
return MojangAccount(
|
||||
val account = MojangAccount(
|
||||
id = response.body["user"].asJsonObject()["id"].unsafeCast(),
|
||||
username = response.body["selectedProfile"].asJsonObject()["name"].unsafeCast(),
|
||||
uuid = uuid,
|
||||
@ -126,6 +136,8 @@ class MojangAccount(
|
||||
accessToken = response.body["accessToken"].unsafeCast(),
|
||||
properties = PlayerProperties.fetch(uuid),
|
||||
)
|
||||
account.state = AccountStates.WORKING
|
||||
return account
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -11,10 +11,11 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.data.accounts.types
|
||||
package de.bixilon.minosoft.data.accounts.types.offline
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import de.bixilon.minosoft.data.accounts.Account
|
||||
import de.bixilon.minosoft.data.accounts.AccountStates
|
||||
import de.bixilon.minosoft.data.player.properties.PlayerProperties
|
||||
import de.bixilon.minosoft.data.registries.CompanionResourceLocation
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
@ -23,6 +24,9 @@ import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
||||
class OfflineAccount(username: String) : Account(username) {
|
||||
override val id: String = username
|
||||
override val type: ResourceLocation = RESOURCE_LOCATION
|
||||
override var state: AccountStates
|
||||
get() = AccountStates.WORKING
|
||||
set(value) {}
|
||||
|
||||
@JsonIgnore
|
||||
override val properties: PlayerProperties? = null
|
||||
@ -31,7 +35,7 @@ class OfflineAccount(username: String) : Account(username) {
|
||||
|
||||
override fun logout(clientToken: String) = Unit
|
||||
|
||||
override fun verify(clientToken: String) = Unit
|
||||
override fun check(clientToken: String) = Unit
|
||||
|
||||
override fun toString(): String {
|
||||
return "OfflineAccount{$username}"
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -18,6 +18,7 @@ import de.bixilon.minosoft.ShutdownReasons
|
||||
import de.bixilon.minosoft.config.profile.delegate.watcher.SimpleProfileDelegateWatcher.Companion.profileWatchFX
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager
|
||||
import de.bixilon.minosoft.data.accounts.Account
|
||||
import de.bixilon.minosoft.data.accounts.AccountStates
|
||||
import de.bixilon.minosoft.gui.eros.controller.EmbeddedJavaFXController
|
||||
import de.bixilon.minosoft.gui.eros.controller.JavaFXWindowController
|
||||
import de.bixilon.minosoft.gui.eros.util.JavaFXAccountUtil.avatar
|
||||
@ -133,6 +134,7 @@ class MainErosController : JavaFXWindowController() {
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun verifyAccount(account: Account? = null, onSuccess: (Account) -> Unit) {
|
||||
val profile = ErosProfileManager.selected.general.accountProfile
|
||||
val account = account ?: profile.selected
|
||||
@ -140,10 +142,17 @@ class MainErosController : JavaFXWindowController() {
|
||||
activity = ErosMainActivities.ACCOUNT
|
||||
return
|
||||
}
|
||||
if (account.state == AccountStates.WORKING) {
|
||||
DefaultThreadPool += { onSuccess(account) }
|
||||
return
|
||||
}
|
||||
if (account.state == AccountStates.CHECKING || account.state == AccountStates.REFRESHING) {
|
||||
return
|
||||
}
|
||||
|
||||
DefaultThreadPool += {
|
||||
try {
|
||||
account.verify(profile.clientToken)
|
||||
account.tryCheck(profile.clientToken)
|
||||
onSuccess(account)
|
||||
} catch (exception: Throwable) {
|
||||
exception.printStackTrace()
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -51,7 +51,7 @@ class AccountCardController : AbstractCardController<Account>() {
|
||||
|
||||
avatarFX.image = item.avatar
|
||||
accountNameFX.text = item.username
|
||||
stateFX.text = "Unchecked"
|
||||
stateFX.text = item.state
|
||||
connectionCountFX.text = TranslatableComponents.ACCOUNT_CARD_CONNECTION_COUNT(item.connections.size)
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -20,13 +20,15 @@ import de.bixilon.minosoft.Minosoft
|
||||
import de.bixilon.minosoft.config.profile.delegate.watcher.entry.MapProfileDelegateWatcher.Companion.profileWatchMapFX
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager
|
||||
import de.bixilon.minosoft.data.accounts.Account
|
||||
import de.bixilon.minosoft.data.accounts.types.MicrosoftAccount
|
||||
import de.bixilon.minosoft.data.accounts.types.MojangAccount
|
||||
import de.bixilon.minosoft.data.accounts.types.OfflineAccount
|
||||
import de.bixilon.minosoft.data.accounts.AccountStates
|
||||
import de.bixilon.minosoft.data.accounts.types.microsoft.MicrosoftAccount
|
||||
import de.bixilon.minosoft.data.accounts.types.mojang.MojangAccount
|
||||
import de.bixilon.minosoft.data.accounts.types.offline.OfflineAccount
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
import de.bixilon.minosoft.data.text.ChatComponent
|
||||
import de.bixilon.minosoft.data.text.TranslatableComponents
|
||||
import de.bixilon.minosoft.gui.eros.controller.EmbeddedJavaFXController
|
||||
import de.bixilon.minosoft.gui.eros.dialog.ErosErrorReport.Companion.report
|
||||
import de.bixilon.minosoft.gui.eros.dialog.SimpleErosConfirmationDialog
|
||||
import de.bixilon.minosoft.gui.eros.main.account.add.MicrosoftAddController
|
||||
import de.bixilon.minosoft.gui.eros.main.account.add.MojangAddController
|
||||
@ -106,6 +108,21 @@ class AccountController : EmbeddedJavaFXController<Pane>() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkAccount(account: Account, select: Boolean) {
|
||||
val profile = ErosProfileManager.selected.general.accountProfile
|
||||
DefaultThreadPool += {
|
||||
try {
|
||||
account.tryCheck(profile.clientToken) // ToDo: Show error
|
||||
if (select) {
|
||||
profile.selected = account
|
||||
}
|
||||
} catch (exception: Throwable) {
|
||||
exception.report()
|
||||
}
|
||||
JavaFXUtil.runLater { refreshList() }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun setAccountInfo(account: Account?) {
|
||||
if (account == null) {
|
||||
@ -156,25 +173,20 @@ class AccountController : EmbeddedJavaFXController<Pane>() {
|
||||
ctext = TranslatableComponents.GENERAL_DELETE
|
||||
}, 1, 0)
|
||||
|
||||
it.add(Button("Verify").apply {
|
||||
it.add(Button("Check").apply {
|
||||
setOnAction {
|
||||
isDisable = true
|
||||
DefaultThreadPool += {
|
||||
account.verify(profile.clientToken)
|
||||
JavaFXUtil.runLater { refreshList() }
|
||||
checkAccount(account, false)
|
||||
}
|
||||
ctext = CHECK
|
||||
if (account.state == AccountStates.WORKING || account.state == AccountStates.CHECKING || account.state == AccountStates.REFRESHING) {
|
||||
isDisable = true
|
||||
}
|
||||
ctext = VERIFY
|
||||
}, 3, 0)
|
||||
it.add(Button("Use").apply {
|
||||
setOnAction {
|
||||
isDisable = true
|
||||
|
||||
DefaultThreadPool += {
|
||||
account.verify(profile.clientToken) // ToDo: Show error
|
||||
profile.selected = account
|
||||
JavaFXUtil.runLater { refreshList() }
|
||||
}
|
||||
checkAccount(account, true)
|
||||
}
|
||||
isDisable = profile.selected == account
|
||||
ctext = USE
|
||||
@ -194,12 +206,13 @@ class AccountController : EmbeddedJavaFXController<Pane>() {
|
||||
companion object {
|
||||
val LAYOUT = "minosoft:eros/main/account/account.fxml".toResourceLocation()
|
||||
|
||||
private val VERIFY = "minosoft:main.account.list.info.button.verify".toResourceLocation()
|
||||
private val CHECK = "minosoft:main.account.list.info.button.check".toResourceLocation()
|
||||
private val USE = "minosoft:main.account.list.info.button.use".toResourceLocation()
|
||||
private val ADD = "minosoft:main.account.list.info.button.add".toResourceLocation()
|
||||
|
||||
private val ACCOUNT_INFO_PROPERTIES: List<Pair<ResourceLocation, (account: Account) -> Any?>> = listOf(
|
||||
"minosoft:main.account.account_info.id".toResourceLocation() to { it.id },
|
||||
"minosoft:main.account.account_info.state".toResourceLocation() to { it.state },
|
||||
)
|
||||
|
||||
val ACCOUNT_TYPES = listOf(
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -15,7 +15,7 @@ package de.bixilon.minosoft.gui.eros.main.account.add
|
||||
|
||||
import de.bixilon.kutil.concurrent.pool.DefaultThreadPool
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager
|
||||
import de.bixilon.minosoft.data.accounts.types.MojangAccount
|
||||
import de.bixilon.minosoft.data.accounts.types.mojang.MojangAccount
|
||||
import de.bixilon.minosoft.gui.eros.controller.JavaFXWindowController
|
||||
import de.bixilon.minosoft.gui.eros.main.account.AccountController
|
||||
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
package de.bixilon.minosoft.gui.eros.main.account.add
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager
|
||||
import de.bixilon.minosoft.data.accounts.types.OfflineAccount
|
||||
import de.bixilon.minosoft.data.accounts.types.offline.OfflineAccount
|
||||
import de.bixilon.minosoft.gui.eros.controller.JavaFXWindowController
|
||||
import de.bixilon.minosoft.gui.eros.main.account.AccountController
|
||||
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.eros.main.play.server
|
||||
|
||||
import de.bixilon.kutil.concurrent.pool.DefaultThreadPool
|
||||
import de.bixilon.kutil.latch.CountUpAndDownLatch
|
||||
import de.bixilon.kutil.primitive.BooleanUtil.decide
|
||||
import de.bixilon.kutil.primitive.IntUtil.thousands
|
||||
@ -126,7 +125,6 @@ class ServerListController : EmbeddedJavaFXController<Pane>(), Refreshable {
|
||||
val ping = serverCard.ping
|
||||
val pingVersion = serverCard.ping.serverVersion ?: return
|
||||
Eros.mainErosController.verifyAccount { account ->
|
||||
DefaultThreadPool += {
|
||||
val connection = PlayConnection(
|
||||
address = ping.tryAddress ?: DNSUtil.getServerAddress(server.address),
|
||||
account = account,
|
||||
@ -167,7 +165,6 @@ class ServerListController : EmbeddedJavaFXController<Pane>(), Refreshable {
|
||||
connection.connect(latch)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun postInit() {
|
||||
root.setOnKeyPressed { if (it.code == KeyCode.ESCAPE) serverListViewFX.selectionModel.select(null) } // ToDo: Not working
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020 Moritz Zwerger
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -18,7 +18,7 @@ import de.bixilon.kutil.json.JsonUtil.asJsonList
|
||||
import de.bixilon.kutil.json.JsonUtil.asJsonObject
|
||||
import de.bixilon.kutil.primitive.LongUtil.toLong
|
||||
import de.bixilon.kutil.uuid.UUIDUtil.toUUID
|
||||
import de.bixilon.minosoft.data.accounts.types.MicrosoftAccount
|
||||
import de.bixilon.minosoft.data.accounts.types.microsoft.MicrosoftAccount
|
||||
import de.bixilon.minosoft.data.player.properties.PlayerProperties
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
||||
import de.bixilon.minosoft.util.account.AccountUtil
|
||||
@ -53,7 +53,7 @@ object MicrosoftOAuthUtils {
|
||||
)
|
||||
|
||||
account.accessToken = accessToken
|
||||
account.verify("")
|
||||
account.check("") // client token does not exist for microsoft accounts
|
||||
|
||||
Log.log(LogMessageType.AUTHENTICATION, LogLevels.INFO) { "Microsoft account login successful (uuid=${account.uuid})" }
|
||||
|
||||
|
@ -84,7 +84,7 @@ minosoft:server_list.refresh.text2=information
|
||||
|
||||
|
||||
|
||||
minosoft:main.account.list.info.button.verify=Verify
|
||||
minosoft:main.account.list.info.button.check=Check
|
||||
minosoft:main.account.list.info.button.use=Use
|
||||
minosoft:main.account.list.info.button.add=Add account
|
||||
minosoft:main.account.no_account_selected=No account selected
|
||||
@ -92,6 +92,13 @@ minosoft:main.account.type.mojang=Mojang
|
||||
minosoft:main.account.type.microsoft=Microsoft
|
||||
minosoft:main.account.type.offline=Offline
|
||||
|
||||
minosoft:main.account.state.unchecked=Unchecked
|
||||
minosoft:main.account.state.checking=Checking...
|
||||
minosoft:main.account.state.refreshing=Refreshing...
|
||||
minosoft:main.account.state.working=Working
|
||||
minosoft:main.account.state.expired=Expired
|
||||
minosoft:main.account.state.errored=Errored
|
||||
|
||||
|
||||
minosoft:main.account.card.connection_count=%1$s connections
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user