diff --git a/FullyNoded-Server.xcodeproj/project.pbxproj b/FullyNoded-Server.xcodeproj/project.pbxproj index ea02d8f5..9595eaa5 100644 --- a/FullyNoded-Server.xcodeproj/project.pbxproj +++ b/FullyNoded-Server.xcodeproj/project.pbxproj @@ -680,7 +680,7 @@ ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "FullyNoded-Server/Info.plist"; - INFOPLIST_KEY_CFBundleDisplayName = "FN Server - v0.0.1 Beta"; + INFOPLIST_KEY_CFBundleDisplayName = "FN Server - v0.0.2 Beta"; "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; @@ -695,7 +695,7 @@ LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 14.0; - MARKETING_VERSION = 0.0.1; + MARKETING_VERSION = 0.0.2; PRODUCT_BUNDLE_IDENTIFIER = "com.dentonllc.FullyNoded-Server"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; @@ -723,7 +723,7 @@ ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "FullyNoded-Server/Info.plist"; - INFOPLIST_KEY_CFBundleDisplayName = "FN Server - v0.0.1 Beta"; + INFOPLIST_KEY_CFBundleDisplayName = "FN Server - v0.0.2 Beta"; "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; @@ -738,7 +738,7 @@ LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 14.0; - MARKETING_VERSION = 0.0.1; + MARKETING_VERSION = 0.0.2; PRODUCT_BUNDLE_IDENTIFIER = "com.dentonllc.FullyNoded-Server"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; diff --git a/FullyNoded-Server/Scripts/CheckForLightning.command b/FullyNoded-Server/Scripts/CheckForLightning.command index d371c779..d9a0b130 100755 --- a/FullyNoded-Server/Scripts/CheckForLightning.command +++ b/FullyNoded-Server/Scripts/CheckForLightning.command @@ -6,7 +6,7 @@ # Created by Peter Denton on 9/5/24. # -if command -v /opt/homebrew/Cellar/core-lightning/24.08.1/bin/lightningd &> /dev/null; then +if command -v /opt/homebrew/Cellar/core-lightning/24.11/bin/lightningd &> /dev/null; then echo "Installed" exit 1 else diff --git a/FullyNoded-Server/Scripts/GetRune.command b/FullyNoded-Server/Scripts/GetRune.command index 3de7aafa..0699f9bf 100755 --- a/FullyNoded-Server/Scripts/GetRune.command +++ b/FullyNoded-Server/Scripts/GetRune.command @@ -6,5 +6,5 @@ # Created by Peter Denton on 10/8/24. # -sudo -u $(whoami) /opt/homebrew/Cellar/core-lightning/24.08.1/bin/lightning-cli commando-rune +sudo -u $(whoami) /opt/homebrew/Cellar/core-lightning/24.11/bin/lightning-cli commando-rune exit 1 diff --git a/FullyNoded-Server/Scripts/InstallLightning.command b/FullyNoded-Server/Scripts/InstallLightning.command index 9a683dbf..4f84de62 100755 --- a/FullyNoded-Server/Scripts/InstallLightning.command +++ b/FullyNoded-Server/Scripts/InstallLightning.command @@ -19,14 +19,14 @@ export CELLAR_PATH=/opt/homebrew/Cellar function configureLightning () { CONFIG="alias=FullyNoded-Server\n\ -plugin-dir=/opt/homebrew/Cellar/core-lightning/24.08.1/libexec/c-lightning/plugins\n\ -subdaemon=channeld:/opt/homebrew/Cellar/core-lightning/24.08.1/libexec/c-lightning/lightning_channeld\n\ -subdaemon=closingd:/opt/homebrew/Cellar/core-lightning/24.08.1/libexec/c-lightning/lightning_closingd\n\ -subdaemon=connectd:/opt/homebrew/Cellar/core-lightning/24.08.1/libexec/c-lightning/lightning_connectd\n\ -subdaemon=gossipd:/opt/homebrew/Cellar/core-lightning/24.08.1/libexec/c-lightning/lightning_gossipd\n\ -subdaemon=hsmd:/opt/homebrew/Cellar/core-lightning/24.08.1/libexec/c-lightning/lightning_hsmd\n\ -subdaemon=onchaind:/opt/homebrew/Cellar/core-lightning/24.08.1/libexec/c-lightning/lightning_onchaind\n\ -subdaemon=openingd:/opt/homebrew/Cellar/core-lightning/24.08.1/libexec/c-lightning/lightning_openingd\n\ +plugin-dir=/opt/homebrew/Cellar/core-lightning/24.11/libexec/c-lightning/plugins\n\ +subdaemon=channeld:/opt/homebrew/Cellar/core-lightning/24.11/libexec/c-lightning/lightning_channeld\n\ +subdaemon=closingd:/opt/homebrew/Cellar/core-lightning/24.11/libexec/c-lightning/lightning_closingd\n\ +subdaemon=connectd:/opt/homebrew/Cellar/core-lightning/24.11/libexec/c-lightning/lightning_connectd\n\ +subdaemon=gossipd:/opt/homebrew/Cellar/core-lightning/24.11/libexec/c-lightning/lightning_gossipd\n\ +subdaemon=hsmd:/opt/homebrew/Cellar/core-lightning/24.11/libexec/c-lightning/lightning_hsmd\n\ +subdaemon=onchaind:/opt/homebrew/Cellar/core-lightning/24.11/libexec/c-lightning/lightning_onchaind\n\ +subdaemon=openingd:/opt/homebrew/Cellar/core-lightning/24.11/libexec/c-lightning/lightning_openingd\n\ bitcoin-rpcpassword="$RPC_PASSWORD"\n\ bitcoin-rpcuser="$RPC_USER"\n\ bitcoin-cli=/Users/$(whoami)/.fullynoded/BitcoinCore/"$PREFIX"/bin/bitcoin-cli\n\ @@ -37,7 +37,7 @@ log-level=debug:plugin\n\ experimental-offers\n\ fetchinvoice-noconnect\n\ disable-plugin=clnrest\n\ -plugin=/opt/homebrew/Cellar/core-lightning/24.08.1/libexec/c-lightning/plugins/clnrest-rs/clnrest-rs\n\ +plugin=/opt/homebrew/Cellar/core-lightning/24.11/libexec/c-lightning/plugins/clnrest-rs/clnrest-rs\n\ clnrest-port=18765\n\ clnrest-protocol=HTTP\n\ daemon" @@ -70,14 +70,15 @@ daemon" } function installLightning () { - sudo -u $(whoami) $BREW_PATH install core-lightning - cd /opt/homebrew/Cellar/core-lightning/24.08.1/libexec/c-lightning/plugins + sudo -u $(whoami) $BREW_PATH reinstall core-lightning + chmod -R +x /opt/homebrew/Cellar/core-lightning/24.11/libexec/c-lightning/plugins + cd /opt/homebrew/Cellar/core-lightning/24.11/libexec/c-lightning/plugins git clone https://github.com/daywalker90/clnrest-rs.git cd clnrest-rs $BREW_PATH install rust cargo build --release - mv target/release/clnrest-rs /opt/homebrew/Cellar/core-lightning/24.08.1/libexec/c-lightning/plugins/clnrest-rs - chmod +x /opt/homebrew/Cellar/core-lightning/24.08.1/libexec/c-lightning/plugins/clnrest-rs/clnrest-rs + mv target/release/clnrest-rs /opt/homebrew/Cellar/core-lightning/24.11/libexec/c-lightning/plugins/clnrest-rs + chmod +x /opt/homebrew/Cellar/core-lightning/24.11/libexec/c-lightning/plugins/clnrest-rs/clnrest-rs echo "Core Lightning installation complete, you can close this terminal window." exit 1 } diff --git a/FullyNoded-Server/Scripts/LightningNodeId.command b/FullyNoded-Server/Scripts/LightningNodeId.command index 174b889a..b47a4240 100755 --- a/FullyNoded-Server/Scripts/LightningNodeId.command +++ b/FullyNoded-Server/Scripts/LightningNodeId.command @@ -6,5 +6,5 @@ # Created by Peter Denton on 10/7/24. # -sudo -u $(whoami) /opt/homebrew/Cellar/core-lightning/24.08.1/bin/lightning-cli getinfo +sudo -u $(whoami) /opt/homebrew/Cellar/core-lightning/24.11/bin/lightning-cli getinfo exit 1 diff --git a/FullyNoded-Server/Scripts/StartLightning.command b/FullyNoded-Server/Scripts/StartLightning.command index c02720f7..7bb1e720 100755 --- a/FullyNoded-Server/Scripts/StartLightning.command +++ b/FullyNoded-Server/Scripts/StartLightning.command @@ -6,6 +6,6 @@ # Created by Peter Denton on 9/11/24. # -sudo -u $(whoami) /opt/homebrew/Cellar/core-lightning/24.08.1/bin/lightningd +sudo -u $(whoami) /opt/homebrew/Cellar/core-lightning/24.11/bin/lightningd exit 1 diff --git a/FullyNoded-Server/Scripts/StopLightning.command b/FullyNoded-Server/Scripts/StopLightning.command index 5ea05773..9547ec34 100755 --- a/FullyNoded-Server/Scripts/StopLightning.command +++ b/FullyNoded-Server/Scripts/StopLightning.command @@ -5,5 +5,5 @@ # # Created by Peter Denton on 9/11/24. # -sudo -u $(whoami) /opt/homebrew/Cellar/core-lightning/24.08.1/bin/lightning-cli stop +sudo -u $(whoami) /opt/homebrew/Cellar/core-lightning/24.11/bin/lightning-cli stop exit 1 diff --git a/FullyNoded-Server/Views/BitcoinCore.swift b/FullyNoded-Server/Views/BitcoinCore.swift index 0403f48e..c2c8da1b 100644 --- a/FullyNoded-Server/Views/BitcoinCore.swift +++ b/FullyNoded-Server/Views/BitcoinCore.swift @@ -10,6 +10,7 @@ import SwiftUI struct BitcoinCore: View { + @State private var statusText = "" @State private var promptToRefreshRpcAuth = false @State private var rpcAuth = "" @State private var qrImage: NSImage? = nil @@ -72,7 +73,7 @@ struct BitcoinCore: View { Image(systemName: "circle.fill") .foregroundStyle(.orange) .padding([.leading]) - Text("Stopping...") + Text(statusText) } else { Image(systemName: "circle.fill") .foregroundStyle(.green) @@ -85,7 +86,7 @@ struct BitcoinCore: View { Image(systemName: "circle.fill") .foregroundStyle(.orange) .padding([.leading]) - Text("Starting...") + Text(statusText) } else { Image(systemName: "circle.fill") .foregroundStyle(.red) @@ -339,7 +340,9 @@ struct BitcoinCore: View { private func reindex() { if !isRunning { isAnimating = true + statusText = "Reindexing..." ScriptUtil.runScript(script: .reindex, env: env, args: nil) { (_, _, errorMessage) in + statusText = "" guard errorMessage == nil else { if errorMessage != "" { showMessage(message: errorMessage!) @@ -669,6 +672,7 @@ struct BitcoinCore: View { private func startBitcoinCore() { isAnimating = true + statusText = "Starting.." ScriptUtil.runScript(script: .startBitcoin, env: env, args: nil) { (output, rawData, errorMessage) in guard errorMessage == nil else { if errorMessage != "" { @@ -709,6 +713,7 @@ struct BitcoinCore: View { private func stopBitcoinCore() { isAnimating = true + statusText = "Stopping..." BitcoinRPC.shared.command(method: "stop", params: [:]) { (result, error) in guard let result = result as? String else { isAnimating = false @@ -775,6 +780,7 @@ struct BitcoinCore: View { private func isBitcoinCoreRunning() { isAnimating = true + statusText = "Refreshing..." BitcoinRPC.shared.command(method: "getblockchaininfo", params: [:]) { (result, error) in isAnimating = false guard error == nil, let result = result as? [String: Any] else { diff --git a/FullyNoded-Server/Views/ContentView.swift b/FullyNoded-Server/Views/ContentView.swift index f1ca705b..bf980662 100644 --- a/FullyNoded-Server/Views/ContentView.swift +++ b/FullyNoded-Server/Views/ContentView.swift @@ -20,6 +20,7 @@ public struct Service: Identifiable { struct ContentView: View { + @State private var isInitialLoad = true @State private var isInstallingLightning = false @State private var torProgress = 0.0 @State private var showError = false @@ -54,7 +55,7 @@ struct ContentView: View { private let timerForJMInstall = Timer.publish(every: 3, on: .main, in: .common).autoconnect() private let timerForTor = Timer.publish(every: 3, on: .main, in: .common).autoconnect() private let bitcoinCore = Service(name: "Bitcoin Core", id: UUID()) - private let coreLightning = Service(name: "Core Lightning", id: UUID()) + //private let coreLightning = Service(name: "Core Lightning", id: UUID()) private let joinMarket = Service(name: "Join Market", id: UUID()) private let tor = Service(name: "Tor", id: UUID()) private let help = Service(name: "Help", id: UUID()) @@ -140,6 +141,8 @@ struct ContentView: View { .onChange(of: torRunning) { if !torRunning { TorClient.sharedInstance.resign() + } else if !isInitialLoad && TorClient.sharedInstance.state != .connected { + TorClient.sharedInstance.start(delegate: nil) } } } @@ -183,7 +186,7 @@ struct ContentView: View { .foregroundStyle(.gray) EmptyView() .onReceive(timerForLightningInstall) { _ in - if FileManager.default.fileExists(atPath: "/opt/homebrew/Cellar/core-lightning/24.08.1/bin/lightningd") { + if FileManager.default.fileExists(atPath: "/opt/homebrew/Cellar/core-lightning/24.11/bin/lightningd") { lightningInstalled = true isInstallingLightning = false self.timerForLightningInstall.upstream.connect().cancel() @@ -253,16 +256,11 @@ struct ContentView: View { Text("Select a service.") .foregroundStyle(.secondary) } - //.padding(.all) .onAppear(perform: { - /// For testing fresh install. -// DataManager.deleteAllData(entityName: "BitcoinRPCCreds") { deleted in -// print("deleted: \(deleted)") -// let domain = Bundle.main.bundleIdentifier! -// UserDefaults.standard.removePersistentDomain(forName: domain) -// UserDefaults.standard.synchronize() -// } + if isInitialLoad { + bootTor() + } checkForXcode() }) .alert("Install Core Lightning?", isPresented: $promptToInstallLightning) { @@ -309,21 +307,24 @@ struct ContentView: View { } } + private func bootTor() { + if TorClient.sharedInstance.state == .connected { + torProgress = 100.0 + } else { + TorClient.sharedInstance.start(delegate: nil) + } + TorClient.sharedInstance.showProgress = { progress in + torProgress = Double(progress) + } + isInitialLoad = false + } + private func checkForBrew() { ScriptUtil.runScript(script: .checkForBrew, env: nil, args: nil) { (output, data, errorMess) in guard let output = output, output != "" else { promptToInstallBrew = true return } - - if TorClient.sharedInstance.state == .connected { - torProgress = 100.0 - } else { - TorClient.sharedInstance.start(delegate: nil) - } - TorClient.sharedInstance.showProgress = { progress in - torProgress = Double(progress) - } getSavedValues() } } @@ -403,7 +404,8 @@ struct ContentView: View { "CHAIN": self.bitcoinEnvValues.chain ] - services = [bitcoinCore, coreLightning, joinMarket, tor, help] + //services = [bitcoinCore, coreLightning, joinMarket, tor, help] + services = [bitcoinCore, joinMarket, tor, help] checkForBitcoin() } @@ -421,7 +423,8 @@ struct ContentView: View { "CHAIN": self.bitcoinEnvValues.chain ] - services = [bitcoinCore, coreLightning, joinMarket, tor, help] + //services = [bitcoinCore, coreLightning, joinMarket, tor, help] + services = [bitcoinCore, joinMarket, tor, help] checkForBitcoin() } } diff --git a/FullyNoded-Server/Views/CoreLightning.swift b/FullyNoded-Server/Views/CoreLightning.swift index ab13eb94..5411bb37 100644 --- a/FullyNoded-Server/Views/CoreLightning.swift +++ b/FullyNoded-Server/Views/CoreLightning.swift @@ -31,7 +31,7 @@ struct CoreLightning: View { Image(systemName: "server.rack") .padding(.leading) - Text("Core Lightning Server v24.08.1") + Text("Core Lightning Server v24.11") Spacer() Button { isLightningOn() diff --git a/FullyNoded-Server/Views/JoinMarket.swift b/FullyNoded-Server/Views/JoinMarket.swift index 69fe9f7f..7fdc0fd2 100644 --- a/FullyNoded-Server/Views/JoinMarket.swift +++ b/FullyNoded-Server/Views/JoinMarket.swift @@ -9,6 +9,7 @@ import SwiftUI struct JoinMarket: View { @Environment(\.openURL) var openURL + @State private var statusText = "Refreshing..." @State private var walletName = "" @State private var gapLimit = "" @State private var promptToIncreaseGapLimit = false @@ -61,7 +62,7 @@ struct JoinMarket: View { .foregroundStyle(.orange) .padding([.leading]) - Text("Starting...") + Text(statusText) .onAppear { isAutoRefreshing = true } @@ -83,7 +84,7 @@ struct JoinMarket: View { .foregroundStyle(.orange) .padding([.leading]) - Text("Starting...") + Text(statusText) } else { Image(systemName: "circle.fill") @@ -164,7 +165,7 @@ struct JoinMarket: View { Text("Data Dir") } Button { - increaseGapLimit() + promptToIncreaseGapLimit = true } label: { Text("Increase gap limit") } @@ -427,9 +428,10 @@ struct JoinMarket: View { private func startJoinMarket() { isAnimating = true + statusText = "Starting..." // Ensure Bitcoin Core is running before starting JM. BitcoinRPC.shared.command(method: "getblockchaininfo", params: [:]) { (result, error) in - guard error == nil, let result = result as? [String: Any] else { + guard error == nil, let _ = result as? [String: Any] else { if let error = error { if error.contains("Could not connect to the server") { isAnimating = false @@ -497,6 +499,7 @@ struct JoinMarket: View { if !isAutoRefreshing { isAnimating = true isAutoRefreshing = true + statusText = "Refreshing..." } JMRPC.sharedInstance.command(method: .session, param: nil) { (response, errorDesc) in isAnimating = false