mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-04 18:00:24 +02:00
Opkman: Ask to download openssl, if it is missing (Win), issue #35545
git-svn-id: trunk@61186 -
This commit is contained in:
parent
123a22f231
commit
b8b713f458
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -4030,6 +4030,8 @@ components/onlinepackagemanager/opkman_maindm.lfm svneol=native#text/pascal
|
||||
components/onlinepackagemanager/opkman_maindm.pas svneol=native#text/plain
|
||||
components/onlinepackagemanager/opkman_mainfrm.lfm svneol=native#text/plain
|
||||
components/onlinepackagemanager/opkman_mainfrm.pas svneol=native#text/pascal
|
||||
components/onlinepackagemanager/opkman_opensslfrm.lfm svneol=native#text/plain
|
||||
components/onlinepackagemanager/opkman_opensslfrm.pas svneol=native#text/pascal
|
||||
components/onlinepackagemanager/opkman_options.pas svneol=native#text/pascal
|
||||
components/onlinepackagemanager/opkman_optionsfrm.lfm svneol=native#text/plain
|
||||
components/onlinepackagemanager/opkman_optionsfrm.pas svneol=native#text/pascal
|
||||
|
@ -20,12 +20,12 @@
|
||||
<CustomOptions Value="$(IDEBuildOptions)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Description Value="Online Package Manager is a tool that automates the process of installing, upgrading, configuring Lazarus packages. The packages are stored in the main repository(see repository column) as zip files, along with a JSON file. The JSON contains all necessary information about the packages. On request the packages are downloaded/extracted/compiled/installed into the IDE. If available, it's also possible to update a previously installed package from the maintainer webpage.
|
||||
<Description Value="Online Package Manager is a tool that automates the process of installing, upgrading, configuring Lazarus packages. The packages are stored in the main repository(see repository column) as zip files, along with a JSON file. The JSON contains all necessary information about the packages. On request the packages are downloaded/extracted/compiled/installed into the IDE. If available, it's also possible to update a previously installed package from the maintainer webpage.
|
||||
|
||||
For more info please visit: http://wiki.freepascal.org/Online_Package_Manager"/>
|
||||
<License Value="GPL"/>
|
||||
<Version Major="1" Release="1" Build="2"/>
|
||||
<Files Count="29">
|
||||
<Files Count="30">
|
||||
<Item1>
|
||||
<Filename Value="onlinepackagemanagerintf.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
@ -148,6 +148,10 @@ For more info please visit: http://wiki.freepascal.org/Online_Package_Manager"/>
|
||||
<Filename Value="opkman_maindm.pas"/>
|
||||
<UnitName Value="opkman_maindm"/>
|
||||
</Item29>
|
||||
<Item30>
|
||||
<Filename Value="opkman_opensslfrm.pas"/>
|
||||
<UnitName Value="opkman_opensslfrm"/>
|
||||
</Item30>
|
||||
</Files>
|
||||
<i18n>
|
||||
<EnableI18N Value="True"/>
|
||||
|
@ -17,7 +17,7 @@ uses
|
||||
opkman_createrepositoryfrm, opkman_repositorydetailsfrm,
|
||||
opkman_addrepositorypackagefrm, opkman_intf, opkman_intf_packagelistfrm,
|
||||
opkman_showhint, opkman_showhintbase, opkman_colorsfrm, opkman_maindm,
|
||||
LazarusPackageIntf;
|
||||
opkman_OpenSSLfrm, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -321,7 +321,9 @@ resourcestring
|
||||
rsOptions_InputBox_Info1 = 'Please select a folder!';
|
||||
rsOptions_InputBox_Conf0 = 'Delete selected extension ("%s")?';
|
||||
rsOptions_InputBox_Conf1 = 'Delete selected folder ("%s")?';
|
||||
|
||||
rsOptions_rbOpenSSL_Item0 = 'Automatically download files';
|
||||
rsOptions_rbOpenSSL_Item1 = 'Show confirmation dialog before download';
|
||||
rsOptions_rbOpenSSL_Item2 = 'Never download files';
|
||||
|
||||
//packagelist form
|
||||
rsPackageListFrm_Caption0 = 'Installed package list';
|
||||
@ -500,6 +502,15 @@ resourcestring
|
||||
rsColors_Caption = 'Colors';
|
||||
rsColors_CD_Title = 'Select color';
|
||||
|
||||
//OpenSSL form
|
||||
rsOpenSSLFrm_Caption = 'Download OpenSSL libraries';
|
||||
rsOpenSSLFrm_Bp_OKButton_Caption = 'Yes';
|
||||
rsOpenSSLFrm_Bp_CancelButton_Caption = 'No';
|
||||
rsOpenSSLFrm_chPermanent_Caption = 'Do not ask this question again';
|
||||
rsOpenSSLFrm_lbMessage1_Caption = 'In order to work properly, OPM needs the OpenSSL libraries: "libeay32.dll" and "ssleay32.dll"';
|
||||
rsOpenSSLFrm_lbMessage2_Caption = 'It''s OK to download the files from "https://packages.lazarus-ide.org/" ?';
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
@ -29,7 +29,7 @@ unit opkman_intf;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Dialogs, Controls, contnrs, fpjson, ExtCtrls, md5,
|
||||
Classes, SysUtils, Forms, Dialogs, Controls, contnrs, fpjson, ExtCtrls,
|
||||
dateutils,
|
||||
// IdeIntf
|
||||
LazIDEIntf, PackageIntf, PackageLinkIntf, PackageDependencyIntf, IDECommands,
|
||||
|
@ -5515,4 +5515,11 @@ object MainFrm: TMainFrm
|
||||
31BD197F77577C0DD7F6E7DE2A83B82AAD2CFF0FEDE4991B
|
||||
}
|
||||
end
|
||||
object tmWait: TTimer
|
||||
Enabled = False
|
||||
Interval = 300
|
||||
OnTimer = tmWaitTimer
|
||||
left = 312
|
||||
top = 235
|
||||
end
|
||||
end
|
||||
|
@ -113,6 +113,7 @@ type
|
||||
tbCreate: TToolButton;
|
||||
tbUpdate: TToolButton;
|
||||
tbOpenRepo: TToolButton;
|
||||
tmWait: TTimer;
|
||||
procedure bReturnClick(Sender: TObject);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
@ -155,6 +156,7 @@ type
|
||||
procedure spExpandClick(Sender: TObject);
|
||||
procedure tbUninstallClick(Sender: TObject);
|
||||
procedure tbUpdateClick(Sender: TObject);
|
||||
procedure tmWaitTimer(Sender: TObject);
|
||||
private
|
||||
FHintTimeOut: Integer;
|
||||
FFormIsHiden: Boolean;
|
||||
@ -208,6 +210,7 @@ begin
|
||||
spClear.Images := MainDM.Images;
|
||||
spClear.ImageIndex := IMG_CLEAR;
|
||||
FHintTimeOut := Application.HintHidePause;
|
||||
Updates := nil;
|
||||
Application.HintHidePause := 1000000;
|
||||
Application.AddOnDeactivateHandler(@DoDeactivate, False);
|
||||
end;
|
||||
@ -234,12 +237,22 @@ begin
|
||||
begin
|
||||
SetupControls;
|
||||
SetupColors;
|
||||
GetPackageList;
|
||||
Updates := TUpdates.Create;
|
||||
Updates.StartUpdate;
|
||||
tmWait.Enabled := True;
|
||||
end
|
||||
end;
|
||||
|
||||
procedure TMainFrm.tmWaitTimer(Sender: TObject);
|
||||
begin
|
||||
tmWait.Enabled := False;
|
||||
if (Options.CheckForUpdates <> 5) then
|
||||
begin
|
||||
Updates := TUpdates.Create;
|
||||
Updates.StartUpdate;
|
||||
end;
|
||||
GetPackageList;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainFrm.GetPackageList(const ARepositoryHasChanged: Boolean = False);
|
||||
begin
|
||||
cbFilterBy.ItemIndex := 0;
|
||||
|
92
components/onlinepackagemanager/opkman_opensslfrm.lfm
Normal file
92
components/onlinepackagemanager/opkman_opensslfrm.lfm
Normal file
@ -0,0 +1,92 @@
|
||||
object OpenSSLFrm: TOpenSSLFrm
|
||||
Left = 559
|
||||
Height = 146
|
||||
Top = 373
|
||||
Width = 605
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'OpenSSLFrm'
|
||||
ClientHeight = 146
|
||||
ClientWidth = 605
|
||||
OnCreate = FormCreate
|
||||
PopupMode = pmExplicit
|
||||
PopupParent = MainFrm.Owner
|
||||
Position = poOwnerFormCenter
|
||||
LCLVersion = '2.1.0.0'
|
||||
object Bp: TButtonPanel
|
||||
Left = 6
|
||||
Height = 34
|
||||
Top = 106
|
||||
Width = 593
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
HelpButton.Name = 'HelpButton'
|
||||
HelpButton.DefaultCaption = True
|
||||
CloseButton.Name = 'CloseButton'
|
||||
CloseButton.DefaultCaption = True
|
||||
CancelButton.Name = 'CancelButton'
|
||||
CancelButton.DefaultCaption = True
|
||||
TabOrder = 0
|
||||
ShowButtons = [pbOK, pbCancel]
|
||||
object cbPermanent: TCheckBox
|
||||
Left = 0
|
||||
Height = 32
|
||||
Top = 2
|
||||
Width = 179
|
||||
Align = alLeft
|
||||
Caption = 'Do not ask this question again'
|
||||
TabOrder = 4
|
||||
end
|
||||
end
|
||||
object lbMessage1: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 17
|
||||
Top = 19
|
||||
Width = 605
|
||||
Alignment = taCenter
|
||||
Anchors = [akLeft, akRight]
|
||||
AutoSize = False
|
||||
Font.CharSet = ANSI_CHARSET
|
||||
Font.Color = clBlack
|
||||
Font.Height = -12
|
||||
Font.Name = 'Segoe UI'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Quality = fqDraft
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object pnBuffer: TPanel
|
||||
Left = 0
|
||||
Height = 18
|
||||
Top = 0
|
||||
Width = 605
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
TabOrder = 1
|
||||
end
|
||||
object lbMessage2: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = lbMessage1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 17
|
||||
Top = 41
|
||||
Width = 622
|
||||
Alignment = taCenter
|
||||
AutoSize = False
|
||||
BorderSpacing.Top = 5
|
||||
Font.CharSet = ANSI_CHARSET
|
||||
Font.Color = clBlack
|
||||
Font.Height = -12
|
||||
Font.Name = 'Segoe UI'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Quality = fqDraft
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
end
|
53
components/onlinepackagemanager/opkman_opensslfrm.pas
Normal file
53
components/onlinepackagemanager/opkman_opensslfrm.pas
Normal file
@ -0,0 +1,53 @@
|
||||
unit opkman_OpenSSLfrm;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ButtonPanel, StdCtrls,
|
||||
ExtCtrls,
|
||||
// OpkMan
|
||||
opkman_const;
|
||||
|
||||
type
|
||||
|
||||
{ TOpenSSLFrm }
|
||||
|
||||
TOpenSSLFrm = class(TForm)
|
||||
Bp: TButtonPanel;
|
||||
cbPermanent: TCheckBox;
|
||||
lbMessage1: TLabel;
|
||||
lbMessage2: TLabel;
|
||||
pnBuffer: TPanel;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
OpenSSLFrm: TOpenSSLFrm;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TOpenSSLFrm }
|
||||
|
||||
procedure TOpenSSLFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Caption := rsOpenSSLFrm_Caption;
|
||||
Bp.OKButton.Caption := rsOpenSSLFrm_Bp_OKButton_Caption;
|
||||
Bp.OKButton.ModalResult := mrYes;
|
||||
Bp.CancelButton.Caption := rsOpenSSLFrm_Bp_CancelButton_Caption;
|
||||
BP.CancelButton.ModalResult := mrNo;
|
||||
cbPermanent.Caption := rsOpenSSLFrm_chPermanent_Caption;
|
||||
lbMessage1.Caption := rsOpenSSLFrm_lbMessage1_Caption;
|
||||
lbMessage2.Caption := rsOpenSSLFrm_lbMessage2_Caption;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
@ -83,6 +83,7 @@ type
|
||||
FUserProfile: Integer;
|
||||
FExcludedFiles: String;
|
||||
FExcludedFolders: String;
|
||||
FOpenSSLDownloadType: Integer;
|
||||
procedure CheckColors;
|
||||
function GetLocalRepositoryArchiveExpanded:string;
|
||||
function GetLocalRepositoryPackagesExpanded:string;
|
||||
@ -122,6 +123,7 @@ type
|
||||
property ProxyPort: Word read FProxySettings.FPort write FProxySettings.FPort;
|
||||
property ProxyUser: String read FProxySettings.FUser write FProxySettings.FUser;
|
||||
property ProxyPassword: String read FProxySettings.FPassword write FProxySettings.FPassword;
|
||||
property OpenSSLDownloadType: Integer read FOpenSSLDownloadType write FOpenSSLDownloadType;
|
||||
property LocalRepositoryPackages: String read FLocalRepositoryPackages write FLocalRepositoryPackages;
|
||||
property LocalRepositoryArchive: String read FLocalRepositoryArchive write FLocalRepositoryArchive;
|
||||
property LocalRepositoryUpdate: String read FLocalRepositoryUpdate write FLocalRepositoryUpdate;
|
||||
@ -211,6 +213,8 @@ begin
|
||||
FProxySettings.FUser := FXML.GetValue('Proxy/User/Value', '');
|
||||
FProxySettings.FPassword := FXML.GetValue('Proxy/Password/Value', '');
|
||||
|
||||
FOpenSSLDownloadType := FXML.GetValue('OpenSSL/DownloadType/Value', 1);
|
||||
|
||||
FLocalRepositoryPackages := FXML.GetValue('Folders/LocalRepositoryPackages/Value', '');
|
||||
FLocalRepositoryArchive := FXML.GetValue('Folders/LocalRepositoryArchive/Value', '');
|
||||
FLocalRepositoryUpdate := FXML.GetValue('Folders/LocalRepositoryUpdate/Value', '');
|
||||
@ -235,6 +239,7 @@ begin
|
||||
FXML.SetDeleteExtendedValue('General/LastUpdate/Value', FLastUpdate, 0.0);
|
||||
FXML.SetDeleteValue('General/ConTimeOut/Value', FConTimeOut, 10);
|
||||
FXML.SetDeleteValue('General/DaysToShowNewPackages/Value', FDaysToShowNewPackages, 31);
|
||||
|
||||
FXML.SetDeleteValue('General/ShowRegularIcons/Value', FShowRegularIcons, True);
|
||||
FXML.SetDeleteValue('General/UseDefaultTheme/Value', FUseDefaultTheme, True);
|
||||
FXML.SetDeleteValue('General/HintFormOption/Value', FHintFormOption, 0);
|
||||
@ -246,6 +251,8 @@ begin
|
||||
FXML.SetDeleteValue('Proxy/User/Value', FProxySettings.FUser, '');
|
||||
FXML.SetDeleteValue('Proxy/Password/Value', FProxySettings.FPassword, '');
|
||||
|
||||
FXML.SetDeleteValue('OpenSSL/DownloadType/Value', FOpenSSLDownloadType, 1);
|
||||
|
||||
FXML.SetDeleteValue('Folders/LocalRepositoryPackages/Value', FLocalRepositoryPackages, '');
|
||||
FXML.SetDeleteValue('Folders/LocalRepositoryArchive/Value', FLocalRepositoryArchive, '');
|
||||
FXML.SetDeleteValue('Folders/LocalRepositoryUpdate/Value', FLocalRepositoryUpdate, '');
|
||||
@ -282,6 +289,8 @@ begin
|
||||
FProxySettings.FUser := '';
|
||||
FProxySettings.FPassword := '';
|
||||
|
||||
FOpenSSLDownloadType := 1;
|
||||
|
||||
FLocalRepositoryPackages := FLocalPackagesDefault;
|
||||
FLocalRepositoryArchive := FLocalArchiveDefault;
|
||||
FLocalRepositoryUpdate := FLocalUpdateDefault;
|
||||
|
@ -52,10 +52,10 @@ object OptionsFrm: TOptionsFrm
|
||||
Height = 498
|
||||
Top = 6
|
||||
Width = 623
|
||||
ActivePage = tsGeneral
|
||||
ActivePage = tsOpenSSL
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
TabIndex = 0
|
||||
TabIndex = 2
|
||||
TabOrder = 0
|
||||
object tsGeneral: TTabSheet
|
||||
Caption = 'General'
|
||||
@ -502,6 +502,42 @@ object OptionsFrm: TOptionsFrm
|
||||
end
|
||||
end
|
||||
end
|
||||
object tsOpenSSL: TTabSheet
|
||||
Caption = 'OpenSSL'
|
||||
ClientHeight = 470
|
||||
ClientWidth = 615
|
||||
object rbOpenSSL: TRadioGroup
|
||||
AnchorSideLeft.Control = tsOpenSSL
|
||||
AnchorSideTop.Control = tsOpenSSL
|
||||
AnchorSideRight.Control = tsOpenSSL
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 10
|
||||
Height = 113
|
||||
Top = 10
|
||||
Width = 595
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoFill = True
|
||||
BorderSpacing.Left = 10
|
||||
BorderSpacing.Top = 10
|
||||
BorderSpacing.Right = 10
|
||||
Caption = 'In order to work properly, OPM needs the OpenSSL libraries: "libeay32.dll" and "ssleay32.dll"'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 93
|
||||
ClientWidth = 591
|
||||
Items.Strings = (
|
||||
'Automatically download files'
|
||||
'Show confirmation dialog before download'
|
||||
'Never download files'
|
||||
)
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object tsFolders: TTabSheet
|
||||
Caption = 'Folders'
|
||||
ClientHeight = 470
|
||||
|
@ -101,11 +101,13 @@ type
|
||||
pnBottom: TPanel;
|
||||
pnProfilesMain: TPanel;
|
||||
pnProfilesLeft: TPanel;
|
||||
rbOpenSSL: TRadioGroup;
|
||||
rbHintFormOptions: TRadioGroup;
|
||||
SDD: TSelectDirectoryDialog;
|
||||
seProxyPort: TSpinEdit;
|
||||
spDaysToShowNewPackages: TSpinEdit;
|
||||
spConTimeOut: TSpinEdit;
|
||||
tsOpenSSL: TTabSheet;
|
||||
tsFolders: TTabSheet;
|
||||
tsProfiles: TTabSheet;
|
||||
tsGeneral: TTabSheet;
|
||||
@ -431,6 +433,8 @@ begin
|
||||
Options.ProxyUser := edProxyUser.Text;
|
||||
Options.ProxyPassword := edProxyPassword.Text;
|
||||
|
||||
Options.OpenSSLDownloadType:= rbOpenSSL.ItemIndex;
|
||||
|
||||
Options.LocalRepositoryPackages := edLocalRepositoryPackages.Text;
|
||||
Options.LocalRepositoryArchive := edLocalRepositoryArchive.Text;
|
||||
Options.LocalRepositoryUpdate := edLocalRepositoryUpdate.Text;
|
||||
@ -514,6 +518,7 @@ begin
|
||||
rbHintFormOptions.ItemIndex := Options.HintFormOption;
|
||||
cbUseDefaultTheme.Checked := Options.UseDefaultTheme;
|
||||
cbUseDefaultTheme.Caption := rsOptions_cbUseDefaultTheme_Caption;
|
||||
|
||||
tsProxy.Caption := rsOptions_tsProxy_Caption;
|
||||
cbProxy.Caption := rsOptions_cbProxy_Caption;
|
||||
gbProxySettings.Caption := rsOptions_gbProxySettings_Caption;
|
||||
@ -529,6 +534,13 @@ begin
|
||||
edProxyUser.Text := Options.ProxyUser;
|
||||
edProxyPassword.Text := Options.ProxyPassword;
|
||||
|
||||
rbOpenSSL.Caption := rsOpenSSLFrm_lbMessage1_Caption;
|
||||
rbOpenSSL.Items.Clear;
|
||||
rbOpenSSL.Items.Add(rsOptions_rbOpenSSL_Item0);
|
||||
rbOpenSSL.Items.Add(rsOptions_rbOpenSSL_Item1);
|
||||
rbOpenSSL.Items.Add(rsOptions_rbOpenSSL_Item2);
|
||||
rbOpenSSL.ItemIndex := Options.OpenSSLDownloadType;
|
||||
|
||||
tsFolders.Caption := rsOptions_tsFolders_Caption;
|
||||
lbLocalRepositoryPackages.Caption := rsOptions_lbLocalRepositoryPackages_Caption;
|
||||
edLocalRepositoryPackages.Hint := rsOptions_edLocalRepositoryPackages_Hint;
|
||||
|
@ -30,17 +30,15 @@ unit opkman_updates;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, fpjson, fpjsonrtti, jsonparser, dateutils,
|
||||
{$IFDEF MSWINDOWS}windows, opkman_const,{$ENDIF}
|
||||
Classes, SysUtils, Controls, fpjson, fpjsonrtti, jsonparser, dateutils,
|
||||
// LazUtils
|
||||
LazIDEIntf,
|
||||
LazIDEIntf, LazFileUtils,
|
||||
// OpkMan
|
||||
opkman_serializablepackages, opkman_options, opkman_common, opkman_visualtree,
|
||||
{$IFDEF MSWINDOWS}
|
||||
opkman_const,
|
||||
{$IFDEF FPC311}zipper,{$ELSE}opkman_zip,{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$IFDEF FPC311}fphttpclient{$ELSE}opkman_httpclient{$ENDIF}
|
||||
;
|
||||
opkman_OpenSSLfrm,
|
||||
{$IFDEF FPC311}zipper,{$ELSE}opkman_zip,{$ENDIF}
|
||||
{$IFDEF FPC311}fphttpclient{$ELSE}opkman_httpclient{$ENDIF};
|
||||
|
||||
const
|
||||
OpkVersion = 1;
|
||||
@ -131,7 +129,7 @@ var
|
||||
Updates: TUpdates = nil;
|
||||
|
||||
implementation
|
||||
|
||||
uses opkman_mainfrm;
|
||||
{ TUpdatePackage }
|
||||
|
||||
procedure TUpdatePackage.Clear;
|
||||
@ -248,6 +246,7 @@ end;
|
||||
constructor TUpdates.Create;
|
||||
begin
|
||||
inherited Create(True);
|
||||
FOpenSSLAvailable := False;
|
||||
FSP_Temp := TSerializablePackages.Create;
|
||||
FreeOnTerminate := True;
|
||||
OnTerminate := @DoTerminated;
|
||||
@ -316,38 +315,79 @@ end;
|
||||
|
||||
procedure TUpdates.CheckForOpenSSL;
|
||||
{$IFDEF MSWINDOWS}
|
||||
function SystemFolder: String;
|
||||
var
|
||||
SysPath: WideString;
|
||||
begin
|
||||
SetLength(SysPath, Windows.MAX_PATH);
|
||||
SetLength(SysPath, Windows.GetSystemDirectoryW(PWideChar(SysPath), Windows.MAX_PATH));
|
||||
Result := AppendPathDelim(String(SysPath));
|
||||
end;
|
||||
|
||||
function IsOpenSSLAvailable: Boolean;
|
||||
var
|
||||
ParamPath, SysPath: String;
|
||||
begin
|
||||
ParamPath := ExtractFilePath(ParamStr(0));
|
||||
SysPath := SystemFolder;
|
||||
Result := (FileExists(ParamPath + 'libeay32.dll') and FileExists(ParamPath + 'ssleay32.dll')) or
|
||||
(FileExists(SysPath + 'libeay32.dll') and FileExists(SysPath + 'ssleay32.dll'));
|
||||
end;
|
||||
|
||||
var
|
||||
ParamPath, libeaydll, ssleaydll, ZipFile: String;
|
||||
ZipFile: String;
|
||||
UnZipper: TUnZipper;
|
||||
CanDownload: Boolean;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
ParamPath := ExtractFilePath(ParamStr(0));
|
||||
libeaydll := ParamPath + 'libeay32.dll';
|
||||
ssleaydll := ParamPath + 'ssleay32.dll';
|
||||
FOpenSSLAvailable := FileExists(libeaydll) and FileExists(ssleaydll);
|
||||
FOpenSSLAvailable := IsOpenSSLAvailable;
|
||||
if not FOpenSSLAvailable then
|
||||
begin
|
||||
ZipFile := ParamPath + ExtractFileName(cOpenSSLURL);
|
||||
try
|
||||
FHTTPClient.Get(cOpenSSLURL, ZipFile);
|
||||
except
|
||||
case Options.OpenSSLDownloadType of
|
||||
0: CanDownload := True; //automatically download
|
||||
1: begin //ask questions
|
||||
OpenSSLFrm := TOpenSSLFrm.Create(MainFrm);
|
||||
try
|
||||
OpenSSLFrm.ShowModal;
|
||||
CanDownload := (OpenSSLFrm.ModalResult = mrYes);
|
||||
if OpenSSLFrm.cbPermanent.Checked then
|
||||
begin
|
||||
case OpenSSLFrm.ModalResult of
|
||||
mrYes: Options.OpenSSLDownloadType := 0;
|
||||
mrNo: Options.OpenSSLDownloadType := 2;
|
||||
end
|
||||
end;
|
||||
finally
|
||||
OpenSSLFrm.Free;
|
||||
end;
|
||||
end;
|
||||
2: CanDownload := False;//never download
|
||||
end;
|
||||
if FileExists(ZipFile) then
|
||||
|
||||
if CanDownload then
|
||||
begin
|
||||
UnZipper := TUnZipper.Create;
|
||||
ZipFile := ExtractFilePath(ParamStr(0)) + ExtractFileName(cOpenSSLURL);
|
||||
try
|
||||
try
|
||||
UnZipper.FileName := ZipFile;
|
||||
UnZipper.Examine;
|
||||
UnZipper.UnZipAllFiles;
|
||||
except
|
||||
end;
|
||||
finally
|
||||
UnZipper.Free;
|
||||
FHTTPClient.Get(cOpenSSLURL, ZipFile);
|
||||
except
|
||||
end;
|
||||
if FileExists(ZipFile) then
|
||||
begin
|
||||
UnZipper := TUnZipper.Create;
|
||||
try
|
||||
try
|
||||
UnZipper.FileName := ZipFile;
|
||||
UnZipper.Examine;
|
||||
UnZipper.UnZipAllFiles;
|
||||
except
|
||||
end;
|
||||
finally
|
||||
UnZipper.Free;
|
||||
end;
|
||||
DeleteFile(ZipFile);
|
||||
FOpenSSLAvailable := IsOpenSSLAvailable;
|
||||
end;
|
||||
DeleteFile(ZipFile);
|
||||
FOpenSSLAvailable := FileExists(libeaydll) and FileExists(ssleaydll);
|
||||
end;
|
||||
end;
|
||||
{$ELSE}
|
||||
@ -357,7 +397,9 @@ end;
|
||||
|
||||
function TUpdates.IsTimeToUpdate: Boolean;
|
||||
begin
|
||||
Result := (FOpenSSLAvailable) and (not FBusyUpdating) and (not FNeedToBreak);
|
||||
Result := False;
|
||||
if (not FOpenSSLAvailable) or FBusyUpdating or FNeedToBreak then
|
||||
Exit;
|
||||
case Options.CheckForUpdates of
|
||||
0: Result := MinutesBetween(Now, Options.LastUpdate) >= 5;
|
||||
1: Result := HoursBetween(Now, Options.LastUpdate) >= 1;
|
||||
|
Loading…
Reference in New Issue
Block a user