mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
chore: improve code
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
project.version = "0.0.3"
|
project.version = "0.0.4"
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@@ -97,8 +97,12 @@ class AccountOption : JPanel(BorderLayout()), OptionsPane.Option, Disposable {
|
|||||||
planBox.add(Box.createHorizontalStrut(16))
|
planBox.add(Box.createHorizontalStrut(16))
|
||||||
val upgrade = JXHyperlink(object : AnAction(I18n.getString("termora.settings.account.upgrade")) {
|
val upgrade = JXHyperlink(object : AnAction(I18n.getString("termora.settings.account.upgrade")) {
|
||||||
override fun actionPerformed(evt: AnActionEvent) {
|
override fun actionPerformed(evt: AnActionEvent) {
|
||||||
|
if (I18n.isChinaMainland()) {
|
||||||
|
Application.browse(URI.create("https://www.termora.cn/pricing"))
|
||||||
|
} else {
|
||||||
Application.browse(URI.create("https://www.termora.app/pricing"))
|
Application.browse(URI.create("https://www.termora.app/pricing"))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
upgrade.isFocusable = false
|
upgrade.isFocusable = false
|
||||||
planBox.add(upgrade)
|
planBox.add(upgrade)
|
||||||
|
|||||||
@@ -77,13 +77,8 @@ class LoginServerDialog(owner: Window) : DialogWrapper(owner) {
|
|||||||
var rows = 1
|
var rows = 1
|
||||||
val step = 2
|
val step = 2
|
||||||
|
|
||||||
|
|
||||||
if (Application.isUnknownVersion()) {
|
|
||||||
serverComboBox.addItem(Server("Localhost", "http://127.0.0.1:8080"))
|
|
||||||
}
|
|
||||||
|
|
||||||
// serverComboBox.addItem(singaporeServer)
|
// serverComboBox.addItem(singaporeServer)
|
||||||
// serverComboBox.addItem(chinaServer)
|
serverComboBox.addItem(chinaServer)
|
||||||
|
|
||||||
val properties = DatabaseManager.getInstance().properties
|
val properties = DatabaseManager.getInstance().properties
|
||||||
val servers = (runCatching {
|
val servers = (runCatching {
|
||||||
@@ -288,8 +283,8 @@ class LoginServerDialog(owner: Window) : DialogWrapper(owner) {
|
|||||||
.add("${I18n.getString("termora.new-host.general.name")}:").xy(1, rows)
|
.add("${I18n.getString("termora.new-host.general.name")}:").xy(1, rows)
|
||||||
.add(nameTextField).xyw(3, rows, 3).apply { rows += step }
|
.add(nameTextField).xyw(3, rows, 3).apply { rows += step }
|
||||||
.add("${I18n.getString("termora.settings.account.server")}:").xy(1, rows)
|
.add("${I18n.getString("termora.settings.account.server")}:").xy(1, rows)
|
||||||
.add(serverTextField).xy(3, rows)
|
.add(serverTextField).xyw(3, rows, 3)
|
||||||
.add(deploy).xy(5, rows).apply { rows += step }
|
// .add(deploy).xy(5, rows).apply { rows += step }
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ class ServerManager private constructor() {
|
|||||||
|
|
||||||
// 解密
|
// 解密
|
||||||
val salt = "${serverInfo.salt}:${username}".toByteArray()
|
val salt = "${serverInfo.salt}:${username}".toByteArray()
|
||||||
val privateKeySecureKey = PBKDF2.hash(salt, username.toCharArray(), 1024, 256)
|
val privateKeySecureKey = PBKDF2.hash(salt, password.toCharArray(), 1024, 256)
|
||||||
val privateKeySecureIv = PBKDF2.hash(salt, username.toCharArray(), 1024, 128)
|
val privateKeySecureIv = PBKDF2.hash(salt, password.toCharArray(), 1024, 128)
|
||||||
val privateKeyEncoded = AES.CBC.decrypt(
|
val privateKeyEncoded = AES.CBC.decrypt(
|
||||||
privateKeySecureKey, privateKeySecureIv,
|
privateKeySecureKey, privateKeySecureIv,
|
||||||
Base64.decodeBase64(meResponse.privateKey)
|
Base64.decodeBase64(meResponse.privateKey)
|
||||||
|
|||||||
Reference in New Issue
Block a user