diff --git a/components/lazautoupdate/latest_stable/lazupdate.lpk b/components/lazautoupdate/latest_stable/lazupdate.lpk index 57fcacaf4..7d2e51ba3 100644 --- a/components/lazautoupdate/latest_stable/lazupdate.lpk +++ b/components/lazautoupdate/latest_stable/lazupdate.lpk @@ -55,8 +55,8 @@ More information in the Wiki Home Page http://wiki.freepascal.org/LazAutoUpdater along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. "/> - - + + @@ -79,6 +79,10 @@ More information in the Wiki Home Page http://wiki.freepascal.org/LazAutoUpdater + + + + diff --git a/components/lazautoupdate/latest_stable/lazupdate.pas b/components/lazautoupdate/latest_stable/lazupdate.pas index 7f74b2c1a..7cb8b30a2 100644 --- a/components/lazautoupdate/latest_stable/lazupdate.pas +++ b/components/lazautoupdate/latest_stable/lazupdate.pas @@ -4,11 +4,12 @@ unit lazupdate; +{$warn 5023 off : no warning about unused units} interface uses ulazautoupdate, aboutlazautoupdateunit, VersionSupport, uappisrunning, - lazautoupdate_httpclient, LazarusPackageIntf; + lazautoupdate_httpclient, open_ssl, LazarusPackageIntf; implementation diff --git a/components/lazautoupdate/latest_stable/open_ssl.pas b/components/lazautoupdate/latest_stable/open_ssl.pas new file mode 100644 index 000000000..d6f8ddaf2 --- /dev/null +++ b/components/lazautoupdate/latest_stable/open_ssl.pas @@ -0,0 +1,82 @@ +unit open_ssl; + +{$mode objfpc}{$H+} + +interface + +uses + // Built-in: fphttpclient + Classes, SysUtils,lazautoupdate_httpclient,LazFileUtils,FileUtil,zipper; + +function CheckForOpenSSL:Boolean; +function OpenSSLInstalled:Boolean; + +implementation +const +{$ifdef win64} + cOpenSSLURL = 'http://packages.lazarus-ide.org/openssl-1.0.2j-x64_86-win64.zip'; +{$endif} +{$ifdef win32} +cOpenSSLURL = 'http://packages.lazarus-ide.org/openssl-1.0.2j-i386-win32.zip'; +{$endif} +Var FHTTPClient:TFPHttpClient; + +function OpenSSLInstalled:Boolean; +begin + {$IFDEF MSWINDOWS} + Result:= FileExistsUTF8(ExtractFilePath(ParamStr(0)) + 'libeay32.dll') and + FileExistsUTF8(ExtractFilePath(ParamStr(0)) + 'ssleay32.dll'); + // Look in Windows system dir? + {$ELSE} + Result:=True; + {$ENDIF} +end; + +Function CheckForOpenSSL:Boolean; +var + ZipFile: String; + UnZipper: TUnZipper; +begin + {$IFDEF MSWINDOWS} + Result:=FALSE; + if not OpenSSLInstalled then + begin + ZipFile := ExtractFilePath(ParamStr(0)) + ExtractFileName(cOpenSSLURL); + try + FHTTPClient.Get(cOpenSSLURL, ZipFile); + except + end; + + if FileExistsUTF8(ZipFile) then + begin + UnZipper := TUnZipper.Create; + try + try + UnZipper.FileName := ZipFile; + UnZipper.Examine; + UnZipper.UnZipAllFiles; + except + end; + finally + UnZipper.Free; + end; + DeleteFileUTF8(ZipFile); + Result:=OpenSSLInstalled; + end; + end + else + Result:=True; + {$ELSE} + Result:=True; + {$ENDIF} +end; +initialization +begin + FHTTPClient:=TFPHttpClient.Create(nil); +end; +finalization +begin + FreeAndNil(FHTTPClient); +end; +end. + diff --git a/components/lazautoupdate/latest_stable/openssl.txt b/components/lazautoupdate/latest_stable/openssl.txt new file mode 100644 index 000000000..e9938338c --- /dev/null +++ b/components/lazautoupdate/latest_stable/openssl.txt @@ -0,0 +1,2 @@ +http://indy.fulgan.com/SSL/openssl-1.0.2j-i386-win32.zip +http://indy.fulgan.com/SSL/openssl-1.0.2j-x64_86-win64.zip diff --git a/components/lazautoupdate/latest_stable/testapp/testapp.lpi b/components/lazautoupdate/latest_stable/testapp/testapp.lpi index e47fea315..580a58fe8 100644 --- a/components/lazautoupdate/latest_stable/testapp/testapp.lpi +++ b/components/lazautoupdate/latest_stable/testapp/testapp.lpi @@ -33,6 +33,7 @@ + @@ -165,7 +166,7 @@ - + @@ -177,6 +178,10 @@ + + + + diff --git a/components/lazautoupdate/latest_stable/testapp/testapp.lpr b/components/lazautoupdate/latest_stable/testapp/testapp.lpr index 0b6eced08..8553718f1 100644 --- a/components/lazautoupdate/latest_stable/testapp/testapp.lpr +++ b/components/lazautoupdate/latest_stable/testapp/testapp.lpr @@ -35,7 +35,7 @@ uses cthreads, {$ENDIF}{$ENDIF} Interfaces, // this includes the LCL widgetset - Forms, umainform + Forms, umainform, open_ssl { you can add units after this }; {$R *.res} diff --git a/components/lazautoupdate/latest_stable/testapp/testapp.lps b/components/lazautoupdate/latest_stable/testapp/testapp.lps index 14727104d..add2314f6 100644 --- a/components/lazautoupdate/latest_stable/testapp/testapp.lps +++ b/components/lazautoupdate/latest_stable/testapp/testapp.lps @@ -4,13 +4,13 @@ - + - + @@ -19,32 +19,31 @@ - - - + + + + - - - + + - - - + + + - - - - + + + @@ -52,7 +51,7 @@ - + @@ -96,7 +95,7 @@ - + @@ -111,130 +110,140 @@ - + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/components/lazautoupdate/latest_stable/testapp/umainform.lfm b/components/lazautoupdate/latest_stable/testapp/umainform.lfm index 1e9e987cf..1dadaaca2 100644 --- a/components/lazautoupdate/latest_stable/testapp/umainform.lfm +++ b/components/lazautoupdate/latest_stable/testapp/umainform.lfm @@ -1,7 +1,7 @@ object mainform: Tmainform - Left = 716 + Left = 682 Height = 209 - Top = 296 + Top = 277 Width = 335 BorderIcons = [biSystemMenu] Caption = 'mainform' @@ -112,7 +112,7 @@ object mainform: Tmainform OnDownloaded = LazAutoUpdate1Downloaded OnDebugEvent = LazAutoUpdate1DebugEvent SFProjectName = 'lazautoupdate' - auOtherSourceURL = '' + auOtherSourceURL = '/' auOtherSourceFilename = '' CopyTree = False UpdatesFolder = 'updates' diff --git a/components/lazautoupdate/latest_stable/ulazautoupdate.pas b/components/lazautoupdate/latest_stable/ulazautoupdate.pas index cf1710489..41de22aa1 100644 --- a/components/lazautoupdate/latest_stable/ulazautoupdate.pas +++ b/components/lazautoupdate/latest_stable/ulazautoupdate.pas @@ -39,7 +39,7 @@ uses LazUTF8, FileUtil, LazFileUtils, Dialogs, StdCtrls, Buttons, DateUtils, asyncprocess, zipper, LResources, VersionSupport, inifiles, aboutlazautoupdateunit, uappisrunning, LCLProc, - fileinfo, winpeimagereader {need this for reading exe info} + fileinfo,open_ssl, winpeimagereader {need this for reading exe info} , elfreader {needed for reading ELF executables} , machoreader {needed for reading MACH-O executables} {$IFDEF WINDOWS}, Windows, ShellAPI{$ENDIF}; // Thanks to Windows 10 and 704 error @@ -48,10 +48,12 @@ const C_SOURCEFORGEURL = 'https://sourceforge.net/projects/%s/files/%s/%s/download'; // [updatepath,projectname,filename] - C_GITHUBFILEURL = 'https://raw.github.com/%s/%s/master/%s/%s'; + // C_GITHUBFILE_URL = 'https://raw.github.com/%s/%s/master/%s/%s'; + C_GITHUBFILE_URL = 'https://raw.github.com/%s/%s/%s/%s/%s'; + C_GITHUBFILE_URL_UPDATES = 'https://raw.github.com/%s/%s/%s/%s/%s/%s'; // https://raw.github.com////some_directory/file // GitHubUserName,GitHubProjectName,updatepath,filename - C_TLazAutoUpdateComponentVersion = '0.2.2'; + C_TLazAutoUpdateComponentVersion = '0.2.3'; C_LAUTRayINI = 'lauimport.ini'; { @@ -116,6 +118,7 @@ const C_INISection = 'versions'; C_GUIEntry = 'GUI'; C_ModuleEntry = 'Module'; + C_MASTER = 'master'; {$IFDEF WINDOWS} {$IFDEF CPU32}C_UPDATER = 'updatehmwin32.exe'; C_LOCALUPDATER = 'lauupdatewin32.exe';{$ENDIF} @@ -177,7 +180,7 @@ type type - TProjectType = (auSourceForge,auGitHubUpdateZip, auOther); + TProjectType = (auSourceForge,auGitHubReleaseZip,auOther); // Array of these records used for multiple updates UpdateListRecord = record PrettyName: string; @@ -199,6 +202,7 @@ type fSourceForgeProjectName: string; fGitHubUsername:String; fGitHubProjectName:String; + fGitHubBranch:String; fApplicationVersionString: string; fApplicationVersionQuad: TVersionQuad; fGuiQuad: TVersionQuad; @@ -367,7 +371,7 @@ type property UpdateExeSilent:String read fUpdateSilentExe; property GitHubUsername:String read fGitHubUsername write fGitHubUsername; Property GitHubProjectName:String read fGitHubProjectName write fGitHubProjectName; - + Property GitHubBranch:String read fGitHubBranch write fGitHubBranch; end; {TThreadedDownload } @@ -882,7 +886,6 @@ var szOldCaption: string; begin Result := False; - // read the VMT once if Assigned(fOndebugEvent) then fFireDebugEvent := True; @@ -908,7 +911,7 @@ begin szURL := Format(C_SOURCEFORGEURL, [fSourceForgeProjectName, fUpdatesFolder, fVersionsININame]); end; - if fProjectType = auGitHubUpdateZip then + if fProjectType = auGitHubReleaseZip then begin if ((fGitHubUserName = '') or (fGitHubProjectName = '')) then begin @@ -918,8 +921,8 @@ begin fOndebugEvent(Self, 'NewVersionAvailable', C_PropIsEmpty); Exit; end; - szURL := Format(C_GITHUBFILEURL, - [fGitHubUserName,fGitHubProjectName,fUpdatesFolder,fVersionsININame]); + szURL := Format(C_GITHUBFILE_URL, + [fGitHubUserName,fGitHubProjectName,fGitHubBranch,fVersionsININame]); end; if fProjectType = auOther then // fauOtherSourceURL ends with '/' @@ -967,6 +970,7 @@ begin fDownloadInprogress := True; if not fSilentMode then fParentForm.Caption := C_Checking; + CheckForOpenSSL; // Start the thread ThreadDownloadHTTP; if fFireDebugEvent then @@ -1070,8 +1074,11 @@ begin if fProjectType = auSourceForge then szURL := Format(C_SOURCEFORGEURL, [fSourceForgeProjectName, fUpdatesFolder, ExtractFileName(szTargetPath)]); - if fProjectType = auGitHubUpdateZip then - szURL := Format(C_GITHUBFILEURL, [fGitHubUserName,fGitHubProjectName,fUpdatesFolder,fZipfileName]); + if fProjectType = auGitHubReleaseZip then + If ((fUpdatesFolder=C_NotApplicable) or (fUpdatesFolder='')) then + szURL := Format(C_GITHUBFILE_URL, [fGitHubUserName,fGitHubProjectName,fGitHubBranch,fZipfileName]) + else + szURL := Format(C_GITHUBFILE_URL_UPDATES, [fGitHubUserName,fGitHubProjectName,fGitHubBranch,fUpdatesFolder,fZipfileName]); if fProjectType = auOther then // fauOtherSourceURL ends with '/' begin @@ -1152,6 +1159,7 @@ begin end; fDownloadInprogress := True; + CheckForOpenSSL; // Do the download with fThreadDownload do begin @@ -1931,6 +1939,7 @@ begin fSourceForgeProjectName := C_NotApplicable; fGitHubProjectName := C_NotApplicable; fGitHubUserName := C_NotApplicable; + fGitHubBranch:=C_NotApplicable; fauOtherSourceFilename:=''; fauOtherSourceURL:=''; end; @@ -1942,16 +1951,19 @@ begin fauOtherSourceURL := C_NotApplicable; fGitHubProjectName := C_NotApplicable; fGitHubUserName := C_NotApplicable; + fGitHubBranch:=C_NotApplicable; end; - if fProjectType = auGitHubUpdateZip then + if fProjectType = auGitHubReleaseZip then begin fZipFileName:=ChangeFileExt(fVersionsININame,'.zip'); fUpdatesFolder := C_UpdatesFolder; fSourceForgeProjectName := C_NotApplicable; fauOtherSourceFilename := C_NotApplicable; fauOtherSourceURL := C_NotApplicable; + fGitHubBranch:= C_MASTER; fGitHubProjectName := ''; fGitHubUserName := ''; + fUpdatesFolder:=C_NotApplicable; end; diff --git a/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip b/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip index 1d8d9932c..93ced9964 100644 Binary files a/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip and b/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip differ diff --git a/components/lazautoupdate/latest_stable/updates/update_lazautoupdate.json b/components/lazautoupdate/latest_stable/updates/update_lazautoupdate.json index a9f3e750c..71f62dacc 100644 --- a/components/lazautoupdate/latest_stable/updates/update_lazautoupdate.json +++ b/components/lazautoupdate/latest_stable/updates/update_lazautoupdate.json @@ -9,7 +9,7 @@ "ForceNotify" : true, "InternalVersion" : 2, "Name" : "lazupdate.lpk", - "Version" : "0.2.2.0" + "Version" : "0.2.3.0" } ] }