diff --git a/build.gradle b/build.gradle index 14607a995dc..17b60df52f8 100644 --- a/build.gradle +++ b/build.gradle @@ -34,6 +34,7 @@ configure(subprojects) { joptVersion = '5.0.3' langVersion = '3.4' libdohjVersion = '7be803fa' + bitcoinjVersion = 'cd30ad5b' logbackVersion = '1.1.10' lombokVersion = '1.18.2' mockitoVersion = '2.21.0' @@ -133,6 +134,10 @@ configure(project(':assets')) { dependencies { compile("network.bisq.libdohj:libdohj-core:$libdohjVersion") { exclude(module: 'protobuf-java') + exclude(module: 'bitcoinj-core') + } + compile("com.github.bisq-network.bitcoinj:bitcoinj-core:$bitcoinjVersion") { + exclude(module: 'protobuf-java') } compile "commons-codec:commons-codec:$codecVersion" compile "org.apache.commons:commons-lang3:$langVersion" @@ -170,6 +175,11 @@ configure(project(':common')) { exclude(module: 'guava') } compile("network.bisq.libdohj:libdohj-core:$libdohjVersion") { + exclude(module: 'slf4j-api') + exclude(module: 'protobuf-java') + exclude(module: 'bitcoinj-core') + } + compile("com.github.bisq-network.bitcoinj:bitcoinj-core:$bitcoinjVersion") { exclude(module: 'jsr305') exclude(module: 'slf4j-api') exclude(module: 'guava') @@ -354,7 +364,6 @@ configure(project(':pricenode')) { dependencies { compile project(":core") - compile project(":assets") compile("org.knowm.xchange:xchange-bitcoinaverage:4.3.3") compile("org.knowm.xchange:xchange-coinmarketcap:4.3.3") compile("org.knowm.xchange:xchange-poloniex:4.3.3") diff --git a/core/src/main/java/bisq/core/offer/Offer.java b/core/src/main/java/bisq/core/offer/Offer.java index 92b3bf76d6d..8d4c272e5a7 100644 --- a/core/src/main/java/bisq/core/offer/Offer.java +++ b/core/src/main/java/bisq/core/offer/Offer.java @@ -70,11 +70,11 @@ @Slf4j public class Offer implements NetworkPayload, PersistablePayload { - // We allow max. 0.5 % difference between own offerPayload price calculation and takers calculation. + // We allow max. 1 % difference between own offerPayload price calculation and takers calculation. // Market price might be different at maker's and takers side so we need a bit of tolerance. // The tolerance will get smaller once we have multiple price feeds avoiding fast price fluctuations // from one provider. - final static double PRICE_TOLERANCE = 0.005; + final static double PRICE_TOLERANCE = 0.01; /////////////////////////////////////////////////////////////////////////////////////////// // Enums diff --git a/desktop/package/windows/Bisq-setup-image.bmp b/desktop/package/windows/Bisq-setup-image.bmp new file mode 100644 index 00000000000..bfa68915528 Binary files /dev/null and b/desktop/package/windows/Bisq-setup-image.bmp differ diff --git a/desktop/package/windows/Bisq.iss b/desktop/package/windows/Bisq.iss index 23264dc73c7..ad1bfe1a803 100644 --- a/desktop/package/windows/Bisq.iss +++ b/desktop/package/windows/Bisq.iss @@ -1,14 +1,17 @@ -;This file will be executed next to the application bundle image +;This file will be executed next to the application bundle image ;I.e. current directory will contain folder Bisq with application files -[Setup] +;Note: This file must use UTF-8 encoding with BOM + +#define SourceDir GetEnv('package_dir') + '\windows' +[Setup] AppId={{bisq}} AppName=Bisq AppVersion=0.9.1 AppVerName=Bisq AppPublisher=Bisq -AppComments=Bisq AppCopyright=Copyright (C) 2018 +AppComments={cm:AppComments} AppPublisherURL=https://bisq.network AppSupportURL=https://bisq.network ;AppUpdatesURL=http://java.com/ @@ -16,55 +19,55 @@ DefaultDirName={localappdata}\Bisq DisableStartupPrompt=Yes DisableDirPage=Yes DisableProgramGroupPage=Yes -DisableReadyPage=Yes -DisableFinishedPage=Yes +DisableReadyPage=No +DisableFinishedPage=No DisableWelcomePage=Yes DefaultGroupName=Bisq ;Optional License LicenseFile= -;WinXP or above -MinVersion=0,5.1 OutputBaseFilename=Bisq +;Windows 7 with Service Pack 1 or above +MinVersion=0,6.1.7601 Compression=lzma SolidCompression=yes PrivilegesRequired=lowest SetupIconFile=Bisq\Bisq.ico UninstallDisplayIcon={app}\Bisq.ico UninstallDisplayName=Bisq +WizardImageFile={#SourceDir}\Bisq-setup-image.bmp WizardImageStretch=No WizardSmallImageFile=Bisq-setup-icon.bmp ArchitecturesInstallIn64BitMode=x64 -ChangesAssociations=Yes +ShowLanguageDialog=No [Languages] -Name: "english"; MessagesFile: "compiler:Default.isl" +Name: en; MessagesFile: "compiler:Default.isl" +Name: de; MessagesFile: "compiler:Languages\German.isl" +Name: fr; MessagesFile: "compiler:Languages\French.isl" +Name: sp; MessagesFile: "compiler:Languages\Spanish.isl" + +[CustomMessages] +en.AppComments=The decentralized exchange network +en.AppIsRunning=Bisq is running, please close it and run setup again. +de.AppComments=Das dezentrale Austauschnetzwerk +de.AppIsRunning=Bisq läuft, bitte schließen Sie es und führen Sie das Setup erneut aus. +fr.AppComments=Le réseau d'échange décentralisé +fr.AppIsRunning=Bisq est en cours d'exécution, fermez-le et exécutez à nouveau le programme d'installation. +sp.AppComments=La red de intercambio descentralizado +sp.AppIsRunning=Bisq se está ejecutando, ciérrelo y vuelva a ejecutar la configuración. [Files] Source: "Bisq\Bisq.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "Bisq\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs [Icons] -Name: "{group}\Bisq"; Filename: "{app}\Bisq.exe"; IconFilename: "{app}\Bisq.ico"; Check: returnTrue() -Name: "{commondesktop}\Bisq"; Filename: "{app}\Bisq.exe"; IconFilename: "{app}\Bisq.ico"; Check: returnFalse() +Name: "{group}\Bisq"; Filename: "{app}\Bisq.exe"; IconFilename: "{app}\Bisq.ico" +Name: "{userdesktop}\Bisq"; Filename: "{app}\Bisq.exe"; IconFilename: "{app}\Bisq.ico" [Run] -Filename: "{app}\Bisq.exe"; Description: "{cm:LaunchProgram,Bisq}"; Flags: nowait postinstall skipifsilent; Check: returnTrue() -Filename: "{app}\Bisq.exe"; Parameters: "-install -svcName ""Bisq"" -svcDesc ""Bisq"" -mainExe ""Bisq.exe"" "; Check: returnFalse() - -[UninstallRun] -Filename: "{app}\Bisq.exe "; Parameters: "-uninstall -svcName Bisq -stopOnUninstall"; Check: returnFalse() +Filename: "{app}\Bisq.exe"; Description: "{cm:LaunchProgram,Bisq}"; Flags: nowait postinstall skipifsilent [Code] -function returnTrue(): Boolean; -begin - Result := True; -end; - -function returnFalse(): Boolean; -begin - Result := False; -end; - procedure DirectoryCopy(SourcePath, DestPath: string); var FindRec: TFindRec; @@ -122,7 +125,7 @@ begin entry := ExpandConstant('{localappdata}') + '\Bisq\'; if DirExists(entry) then begin DelTree(entry, true, true, true); - end + end; end; procedure DeleteTorFiles; @@ -137,15 +140,15 @@ begin hiddenServiceDir := mainnetDir + '\tor\hiddenservice'; hiddenServiceBackupDir := mainnetDir + '\hiddenservice_backup'; if DirExists(hiddenServiceDir) then begin - if DirExists(hiddenServiceBackupDir) then begin - DelTree(hiddenServiceBackupDir, true, true, true); - end - CreateDir(hiddenServiceBackupDir); - DirectoryCopy(hiddenServiceDir, hiddenServiceBackupDir); - DelTree(torDir, false, true, true); - CreateDir(hiddenServiceDir); - DirectoryCopy(hiddenServiceBackupDir, hiddenServiceDir); - end + if DirExists(hiddenServiceBackupDir) then begin + DelTree(hiddenServiceBackupDir, true, true, true); + end; + CreateDir(hiddenServiceBackupDir); + DirectoryCopy(hiddenServiceDir, hiddenServiceBackupDir); + DelTree(torDir, false, true, true); + CreateDir(hiddenServiceDir); + DirectoryCopy(hiddenServiceBackupDir, hiddenServiceDir); + end; end; function PrepareToInstall(var NeedsRestart: Boolean): String; @@ -155,11 +158,44 @@ begin Result := ''; end; +function IsAppRunning(): Boolean; +var + FSWbemLocator : Variant; + FWMIService : Variant; + FWbemObjectSet : Variant; + ExecutablePath : String; +begin + Result := False; + ExecutablePath := Format('%s\Bisq\Bisq.exe', [ExpandConstant('{localappdata}')]) + StringChangeEx(ExecutablePath, '\', '\\', True); + try + FSWbemLocator := CreateOleObject('WBEMScripting.SWBEMLocator'); + FWMIService := FSWbemLocator.ConnectServer('localhost', 'root\CIMV2', '', ''); + FWbemObjectSet := FWMIService.ExecQuery(Format('SELECT Name FROM Win32_Process Where ExecutablePath="%s"', [ExecutablePath])); + Result := (FWbemObjectSet.Count > 0); + FWbemObjectSet := Unassigned; + FWMIService := Unassigned; + FSWbemLocator := Unassigned; + except + end; +end; + function InitializeSetup(): Boolean; begin -// Possible future improvements: -// if version less or same => just launch app -// if upgrade => check if same app is running and wait for it to exit -// Add pack200/unpack200 support? Result := True; + if IsAppRunning() then + begin + MsgBox(ExpandConstant('{cm:AppIsRunning}'), mbCriticalError, MB_OK); + Result := False; + end; +end; + +function InitializeUninstall(): Boolean; +begin + Result := True; + if IsAppRunning() then + begin + MsgBox(ExpandConstant('{cm:AppIsRunning}'), mbCriticalError, MB_OK); + Result := False; + end; end; diff --git a/scripts/install_java.bat b/scripts/install_java.bat index 3a2f0ae1279..367157998b2 100644 --- a/scripts/install_java.bat +++ b/scripts/install_java.bat @@ -30,9 +30,11 @@ if exist "%PROGRAMFILES%\Java\openjdk\jdk-%jdk_version%" ( echo Downloading required files to %TEMP% powershell -Command "Invoke-WebRequest %jdk_url% -OutFile $env:temp\%jdk_filename%.tar.gz" -:: Download 7zip (command line version) in order to extract the tar.gz file since there is no native support in Windows -powershell -Command "Invoke-WebRequest https://www.7-zip.org/a/7za920.zip -OutFile $env:temp\7za920.zip" -powershell -Command "Expand-Archive $env:temp\7za920.zip -DestinationPath $env:temp\7za920 -Force" +if not exist "%TEMP%\7za920\7za.exe" ( + :: Download 7zip ^(command line version^) in order to extract the tar.gz file since there is no native support in Windows + powershell -Command "Invoke-WebRequest https://www.7-zip.org/a/7za920.zip -OutFile $env:temp\7za920.zip" + powershell -Command "Expand-Archive $env:temp\7za920.zip -DestinationPath $env:temp\7za920 -Force" +) echo Extracting and installing JDK to %PROGRAMFILES%\Java\openjdk\jdk-%jdk_version% "%TEMP%\7za920\7za.exe" x "%TEMP%\%jdk_filename%.tar.gz" -o"%TEMP%" -r -y @@ -41,8 +43,9 @@ md "%PROGRAMFILES%\Java\openjdk" move "%TEMP%\openjdk-%jdk_version%\jdk-%jdk_version%" "%PROGRAMFILES%\Java\openjdk" echo Removing downloaded files -rmdir /S /Q %TEMP%\7za920 -del /Q %TEMP%\7za920.zip +if exist "%TEMP%\7za920.zip" ( + del /Q %TEMP%\7za920.zip +) rmdir /S /Q %TEMP%\openjdk-%jdk_version% del /Q %TEMP%\%jdk_filename%.tar del /Q %TEMP%\%jdk_filename%.tar.gz