From 3b5b68f198cfd0b400b87bafdb40eff72dd7bb66 Mon Sep 17 00:00:00 2001 From: Fonta1n3 Date: Wed, 23 Dec 2020 07:58:38 +0800 Subject: [PATCH] fix: fixes #76 and #77 Now we fetch the latest release of Bitcoin Core instead of the latest tag from the github api to avoid issues of missing signatures. --- XCode/GordianServer-macOS/Helpers/UrlRequest.swift | 4 ++-- XCode/GordianServer-macOS/Scripts/StandUp.command | 4 ++-- XCode/GordianServer-macOS/Scripts/UpgradeBitcoin.command | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/XCode/GordianServer-macOS/Helpers/UrlRequest.swift b/XCode/GordianServer-macOS/Helpers/UrlRequest.swift index 03d5915d..3966cd88 100644 --- a/XCode/GordianServer-macOS/Helpers/UrlRequest.swift +++ b/XCode/GordianServer-macOS/Helpers/UrlRequest.swift @@ -11,7 +11,7 @@ import Foundation class FetchLatestRelease { class func get(completion: @escaping ((dict:NSDictionary?, error:String?)) -> Void) { - let url = "https://api.github.com/repos/bitcoin/bitcoin/tags" + let url = "https://api.github.com/repos/bitcoin/bitcoin/releases" guard let destination = URL(string: url) else { return } let request = URLRequest(url: destination) let session = URLSession.shared @@ -22,7 +22,7 @@ class FetchLatestRelease { if let jsonArray = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.mutableContainers) as? NSArray { if jsonArray.count > 0 { if let latestTag = jsonArray[0] as? NSDictionary { - if let version = latestTag["name"] as? String { + if let version = latestTag["tag_name"] as? String { let processedVersion = version.replacingOccurrences(of: "v", with: "") let dict = [ "version":"\(processedVersion)", diff --git a/XCode/GordianServer-macOS/Scripts/StandUp.command b/XCode/GordianServer-macOS/Scripts/StandUp.command index 5521b3c1..e108807f 100755 --- a/XCode/GordianServer-macOS/Scripts/StandUp.command +++ b/XCode/GordianServer-macOS/Scripts/StandUp.command @@ -57,9 +57,9 @@ function installBitcoin () { echo "Signatures do not match! Terminating..." exit 1 - + fi - + } function configureBitcoin () { diff --git a/XCode/GordianServer-macOS/Scripts/UpgradeBitcoin.command b/XCode/GordianServer-macOS/Scripts/UpgradeBitcoin.command index 2964e2fa..92bb8c8a 100755 --- a/XCode/GordianServer-macOS/Scripts/UpgradeBitcoin.command +++ b/XCode/GordianServer-macOS/Scripts/UpgradeBitcoin.command @@ -12,12 +12,12 @@ mkdir ~/.standup mkdir ~/.standup/BitcoinCore echo "Downloading $SHA_URL" -curl $SHA_URL -o ~/StandUp/BitcoinCore/SHA256SUMS.asc -s -echo "Saved to ~/StandUp/BitcoinCore/SHA256SUMS.asc" +curl $SHA_URL -o ~/.standup/BitcoinCore/SHA256SUMS.asc -s +echo "Saved to ~/.standup/BitcoinCore/SHA256SUMS.asc" echo "Downloading Laanwj PGP signature from https://bitcoin.org/laanwj-releases.asc..." -curl https://bitcoin.org/laanwj-releases.asc -o ~/StandUp/BitcoinCore/laanwj-releases.asc -s -echo "Saved to ~/StandUp/BitcoinCore/laanwj-releases.asc" +curl https://bitcoin.org/laanwj-releases.asc -o ~/.standup/BitcoinCore/laanwj-releases.asc -s +echo "Saved to ~/.standup/BitcoinCore/laanwj-releases.asc" echo "Downloading Bitcoin Core $VERSION from $MACOS_URL" cd ~/.standup/BitcoinCore