mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-22 14:33:06 +01:00
Implement rpc password in GUI (#3986)
This commit is contained in:
parent
e520b492bb
commit
2aa6f168eb
2 changed files with 24 additions and 3 deletions
|
@ -105,6 +105,10 @@ object BundleGUI extends WalletGUI with BitcoinSAppJFX3 {
|
|||
datadirParser.datadir,
|
||||
serverArgParser)(system)
|
||||
|
||||
if (appConfig.rpcPassword.nonEmpty) {
|
||||
GlobalData.setPassword(appConfig.rpcPassword)
|
||||
}
|
||||
|
||||
validatePreferenceValues()
|
||||
|
||||
val landingPane = new LandingPane(glassPane, serverArgParser)
|
||||
|
|
|
@ -51,25 +51,42 @@ object GlobalData {
|
|||
|
||||
var darkThemeEnabled: Boolean = true
|
||||
|
||||
def currentStyleSheets: Seq[String] =
|
||||
def currentStyleSheets: Seq[String] = {
|
||||
if (GlobalData.darkThemeEnabled) {
|
||||
Seq(Themes.DarkTheme.fileLocation)
|
||||
} else {
|
||||
Seq.empty
|
||||
}
|
||||
}
|
||||
|
||||
var rpcPortOpt: Option[Int] = None
|
||||
|
||||
var debug = false
|
||||
|
||||
def consoleCliConfig: Config =
|
||||
rpcPortOpt match {
|
||||
private var passwordOpt: Option[String] = None
|
||||
|
||||
/** Sets the rpc password for the GUI */
|
||||
def setPassword(password: String): Unit = {
|
||||
passwordOpt = Some(password)
|
||||
}
|
||||
|
||||
def consoleCliConfig: Config = {
|
||||
val rpcConfigAndDebug = rpcPortOpt match {
|
||||
case None =>
|
||||
Config(debug = debug)
|
||||
case Some(rpcPort) =>
|
||||
Config(debug = debug, rpcPortOpt = Some(rpcPort))
|
||||
}
|
||||
|
||||
val passwordConfig = passwordOpt match {
|
||||
case Some(password) =>
|
||||
rpcConfigAndDebug.copy(rpcPassword = password)
|
||||
case None =>
|
||||
rpcConfigAndDebug
|
||||
}
|
||||
passwordConfig
|
||||
}
|
||||
|
||||
lazy val broadcastUrl: String = GlobalData.network match {
|
||||
case MainNet =>
|
||||
"https://blockstream.info/api/tx"
|
||||
|
|
Loading…
Add table
Reference in a new issue