Skip to content

Commit

Permalink
Merge branch 'HealthIntersections:master' into makelinuxinstallscript
Browse files Browse the repository at this point in the history
  • Loading branch information
costateixeira committed Sep 6, 2024
2 parents 382730f + ef3c0ce commit 3f5a154
Show file tree
Hide file tree
Showing 14 changed files with 172 additions and 28 deletions.
8 changes: 4 additions & 4 deletions install/install-tk.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
; AppID can never be changed as subsequent installations require the same installation ID each time
AppID=FHIRToolkit
AppName=Health Intersections FHIR Toolkit
AppVerName=FHIRToolkit v3.4.9
AppVerName=FHIRToolkit v3.4.10

; compilation control
OutputDir=..\install\build
OutputBaseFilename=fhirtoolkit-win64-3.4.9
OutputBaseFilename=fhirtoolkit-win64-3.4.10
Compression=lzma2/ultra64

; 64 bit
Expand All @@ -32,11 +32,11 @@ UninstallFilesDir={app}\uninstall
; win2000+ add/remove programs support
AppPublisher=Health Intersections P/L
AppPublisherURL=http://www.healthintersections.com.au
AppVersion=3.4.9
AppVersion=3.4.10
AppSupportURL=https://github.com/grahamegrieve/fhirserver
AppUpdatesURL=https://github.com/grahamegrieve/fhirserver
AppCopyright=Copyright (c) Health Intersections Pty Ltd 2020+
VersionInfoVersion=3.4.9.0
VersionInfoVersion=3.4.10.0

; dialog support
LicenseFile=..\license
Expand Down
8 changes: 4 additions & 4 deletions install/install.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
; AppID can never be changed as subsequent installations require the same installation ID each time
AppID=FHIRServer
AppName=Health Intersections FHIR Server
AppVerName=FHIRServer v3.4.9
AppVerName=FHIRServer v3.4.10

; compilation control
OutputDir=..\install\build
OutputBaseFilename=fhirserver-win64-3.4.9
OutputBaseFilename=fhirserver-win64-3.4.10
Compression=lzma2/ultra64

; 64 bit
Expand All @@ -34,11 +34,11 @@ UninstallFilesDir={app}\uninstall
; win2000+ add/remove programs support
AppPublisher=Health Intersections P/L
AppPublisherURL=http://www.healthintersections.com.au
AppVersion=3.4.9
AppVersion=3.4.10
AppSupportURL=https://github.com/grahamegrieve/fhirserver
AppUpdatesURL=https://github.com/grahamegrieve/fhirserver
AppCopyright=Copyright (c) Health Intersections Pty Ltd 2011+
VersionInfoVersion=3.4.9.0
VersionInfoVersion=3.4.10.0

; dialog support
LicenseFile=..\license
Expand Down
9 changes: 6 additions & 3 deletions library/fsl/fsl_npm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ function TNpmPackage.GetDependencies: TArray<String>;
begin
sl := TStringList.Create;
try
if (info.has('dependencies')) then
if (info.has('dependencies')) and (info.obj['dependencies'] <> nil) then
begin
for n in info.obj['dependencies'].properties.keys do
sl.add(n+'#'+info.obj['dependencies'].str[n]);
Expand Down Expand Up @@ -1114,8 +1114,11 @@ procedure TNpmPackage.readStream(tgz: TStream; desc: String; progress: TWorkProg
bs.free;
end;
try
FNpm := TJsonParser.parse(folders['package'].fetchFile('package.json'));
except
if folders['package'] <> nil then
FNpm := TJsonParser.parse(folders['package'].fetchFile('package.json'))
else
raise EFslException.create('Error parsing '+desc+'#'+'package/package.json: Not found');
except
on e : Exception do
raise EFslException.create('Error parsing '+desc+'#'+'package/package.json: '+e.Message);
end;
Expand Down
12 changes: 11 additions & 1 deletion library/fsl/fsl_utilities.pas
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ function clength(b : TBytes) : cardinal; overload;
Function StringArrayExists(Const aNames : Array Of String; Const sName: String) : Boolean; Overload;
Function StringGet(Const sValue : String; iIndex : Integer) : Char; Overload;
Function StringStartsWith(Const sValue, sFind : String; sensitive : boolean = false) : Boolean; Overload;
Function StringStartsWith(Const sValue : String; aFind : Array of String; sensitive : boolean = false) : Boolean; Overload;
Function StringStartsWithSensitive(Const sValue, sFind : String) : Boolean; Overload;
Function StringStartsWithInsensitive(Const sValue, sFind : String) : Boolean; Overload;
Function StringEndsWith(Const sValue, sFind : String; sensitive : boolean = false) : Boolean; Overload;
Expand Down Expand Up @@ -5484,6 +5485,15 @@ class procedure TFileLauncher.Open(const FilePath: string);
End;


Function StringStartsWith(Const sValue : String; aFind : Array of String; sensitive : boolean = false) : Boolean;
var
s : String;
begin
result := false;
for s in aFind do
if StringStartsWith(sValue, s, sensitive) then
exit(true);
end;

Function StringEqualsSensitive(Const sA, sB : String) : Boolean;
Begin
Expand Down Expand Up @@ -8029,7 +8039,7 @@ class function TFslDateTime.fromFormat(format, date: String; AllowBlankTimes: Bo
else if (s = 'dec') or (s = 'december') then
Result.FMonth := 12
else
raise EDateFormatError.Create('The Month "' + s + '" is unknown in '+date);
raise EDateFormatError.Create('The Month "' + s + '" is unknown in '+date+' (using format '+format+', from '+inttostr(start)+' for '+inttostr(length)+' chars');
end
else if s = '' then
Result.FMonth := 1
Expand Down
6 changes: 3 additions & 3 deletions library/version.inc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FHIR_CODE_FULL_VERSION = '3.4.9';
FHIR_CODE_RELEASE_DATE = '2024-08-26';
FHIR_CODE_RELEASE_DATETIME = '20240826221403.486Z';
FHIR_CODE_FULL_VERSION = '3.4.10';
FHIR_CODE_RELEASE_DATE = '2024-09-05';
FHIR_CODE_RELEASE_DATETIME = '20240905110448.596Z';
38 changes: 37 additions & 1 deletion server/endpoint_packages.pas
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,16 @@ TPackageUpdaterThread = class(TFslThread)

TMatchTableSort = (mtsNull, mtsId, mtsVersion, mtsDate, mtsFhirVersion, mtsCanonical, mtsDownloads, mtsKind);

{ TFHIRPackageWebServer }

TFHIRPackageWebServer = class (TFhirWebServerEndpoint)
private
FDB : TFDBManager;
FLastUpdate : TDateTime;
FNextScan : TDateTIme;
FScanning: boolean;
FSystemToken : String;
FCrawlerLog : String;

procedure setDB(value : TFDBManager);
function status : String;
Expand All @@ -92,12 +95,14 @@ TFHIRPackageWebServer = class (TFhirWebServerEndpoint)
procedure serveSearch(name, canonicalPkg, canonicalUrl, FHIRVersion, dependency, sort : String; secure : boolean; request : TIdHTTPRequestInfo; response : TIdHTTPResponseInfo);
procedure serveUpdates(date : TFslDateTime; secure : boolean; response : TIdHTTPResponseInfo);
procedure serveProtectForm(request : TIdHTTPRequestInfo; response : TIdHTTPResponseInfo; id : String);
procedure serveLog(request : TIdHTTPRequestInfo; response : TIdHTTPResponseInfo; id : String);
procedure serveUpload(request : TIdHTTPRequestInfo; response : TIdHTTPResponseInfo; secure : boolean; id : String);
procedure processProtectForm(request : TIdHTTPRequestInfo; response : TIdHTTPResponseInfo; id, pword : String);
procedure SetScanning(const Value: boolean);

function doRequest(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; id: String; secure: boolean): String;
public
constructor Create(code, path : String; common : TFHIRWebServerCommon); override;
destructor Destroy; override;
function link : TFHIRPackageWebServer; overload;
function description : String; override;
Expand Down Expand Up @@ -416,6 +421,7 @@ procedure TPackageUpdaterThread.RunUpdater;
try
upd := TPackageUpdater.Create(FZulip.link);
try
upd.CrawlerLog := TFslStringBuilder.create;
upd.OnSendEmail := doSendEmail;
try
upd.update(conn);
Expand All @@ -431,6 +437,7 @@ procedure TPackageUpdaterThread.RunUpdater;
Logging.log('Exception updating packages: '+e.Message);
end;
end;
FEndPoint.FPackageServer.FCrawlerLog := upd.CrawlerLog.AsString;
finally
upd.free;
end;
Expand Down Expand Up @@ -804,6 +811,23 @@ procedure TFHIRPackageWebServer.serveProtectForm(request : TIdHTTPRequestInfo; r
end;
end;

procedure TFHIRPackageWebServer.serveLog(request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; id: String);
var
vars : TFslMap<TFHIRObject>;
begin
response.ResponseNo := 200;
response.ResponseText := 'OK';
vars := TFslMap<TFHIRObject>.Create;
try
vars.add('prefix', TFHIRObjectText.Create(AbsoluteUrl(false)));
vars.add('ver', TFHIRObjectText.Create('4.0.1'));
vars.add('log', TFHIRObjectText.Create(FCrawlerLog));
returnFile(request, response, nil, request.Document, 'packages-log.html', false, vars);
finally
vars.free;
end;
end;

function codeForKind(kind : integer): String;
begin
case TFHIRPackageKind(kind) of
Expand Down Expand Up @@ -914,7 +938,9 @@ function sel(this, that : String) : string;
result := '';
end;

procedure TFHIRPackageWebServer.serveSearch(name, canonicalPkg, canonicalURL, FHIRVersion, dependency, sort : String; secure : boolean; request : TIdHTTPRequestInfo; response : TIdHTTPResponseInfo);
procedure TFHIRPackageWebServer.serveSearch(name, canonicalPkg, canonicalUrl,
FHIRVersion, dependency, sort: String; secure: boolean;
request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo);
var
conn : TFDBConnection;
json : TJsonArray;
Expand Down Expand Up @@ -1346,6 +1372,10 @@ function TFHIRPackageWebServer.doRequest(AContext: TIdContext; request: TIdHTTPR
result := 'Packages updates since '+pm['lastUpdated'];
end;
end
else if (request.CommandType = hcGET) and (request.Document = '/packages/log') then
begin
serveLog(request, response, pm['id']);
end
else if (request.CommandType = hcGET) and (request.Document = '/packages/protect') then
begin
serveProtectForm(request, response, pm['id']);
Expand Down Expand Up @@ -1403,6 +1433,12 @@ function TFHIRPackageWebServer.doRequest(AContext: TIdContext; request: TIdHTTPR
end;
end;

constructor TFHIRPackageWebServer.Create(code, path: String; common: TFHIRWebServerCommon);
begin
inherited Create(code, path, common);
FCrawlerLog := 'The Crawler has not yet completed processing the feed';
end;

function TFHIRPackageWebServer.SecureRequest(AContext: TIdContext; ip : String; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; cert: TIdOpenSSLX509; id: String; tt : TTimeTracker): String;
begin
countRequest;
Expand Down
2 changes: 1 addition & 1 deletion server/fhirconsole.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<VersionInfo>
<MajorVersionNr Value="3"/>
<MinorVersionNr Value="4"/>
<RevisionNr Value="9"/>
<RevisionNr Value="10"/>
<Attributes pvaDebug="False"/>
</VersionInfo>
<BuildModes Count="8">
Expand Down
4 changes: 2 additions & 2 deletions server/fhirserver.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_MajorVer>3</VerInfo_MajorVer>
<VerInfo_MinorVer>4</VerInfo_MinorVer>
<VerInfo_Release>9</VerInfo_Release>
<VerInfo_Release>10</VerInfo_Release>
<VerInfo_Debug>false</VerInfo_Debug>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Base_Win32)&apos;!=&apos;&apos;">
Expand Down Expand Up @@ -167,7 +167,7 @@
<DCC_RangeChecking>true</DCC_RangeChecking>
<DCC_DebugDCUs>false</DCC_DebugDCUs>
<VerInfo_MajorVer>3</VerInfo_MajorVer>
<VerInfo_Release>9</VerInfo_Release>
<VerInfo_Release>10</VerInfo_Release>
<AppDPIAwarenessMode>none</AppDPIAwarenessMode>
<VerInfo_MinorVer>4</VerInfo_MinorVer>
<VerInfo_Debug>false</VerInfo_Debug>
Expand Down
2 changes: 1 addition & 1 deletion server/fhirserver.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<UseVersionInfo Value="True"/>
<MajorVersionNr Value="3"/>
<MinorVersionNr Value="4"/>
<RevisionNr Value="9"/>
<RevisionNr Value="10"/>
<Attributes pvaDebug="False"/>
</VersionInfo>
<BuildModes Count="8">
Expand Down
Loading

0 comments on commit 3f5a154

Please sign in to comment.