' +
+ '
![]()
' + // Начальное состояние hidden
+ '
' + // Начальное состояние hidden
+ '
' +
+ '' +
+ '';
+end;
+
+function TKandinsky_Web.GenerateJSON: string;
+var
+ JSONObject: TJSONObject;
+begin
+ JSONObject := TJSONObject.Create;
+ try
+ FCriticalSection.Enter;
+ try
+ // Изменили условие проверки времени
+ if FileExists(FCurrentImage) and (SecondsBetween(Now, FImageTime) <= 5) then
+ begin
+ JSONObject.AddPair('imageUrl', '/image?' + IntToStr(DateTimeToUnix(FImageTime))); // Используем время генерации
+ JSONObject.AddPair('text', FCurrentText)
+ end
+ else
+ begin
+ JSONObject.AddPair('imageUrl', '');
+ JSONObject.AddPair('text', '');
+ end;
+ finally
+ FCriticalSection.Leave;
+ end;
+ Result := JSONObject.ToString;
+ finally
+ JSONObject.Free;
+ end;
+end;
+
+procedure TKandinsky_Web.GenerationDone(Sender: TObject;
+ const FileName: string);
+begin
+ TThread.Queue(nil, procedure
+ begin
+ FCriticalSection.Enter;
+ try
+ CleanupOldMessages;
+ FCurrentImage := FileName;
+ FImageTime := Now;
+ //flog.toLog(0,'uWebServerKandinsky','GenerationDone','Файл картинки создан');
+ finally
+ FCriticalSection.Leave;
+ end;
+ end);
+end;
+
+procedure TKandinsky_Web.GenerationError(Sender: TObject;
+ const ErrorMessage: string);
+begin
+ //flog.toLog(2,'uWebServerKandinsky','GenerationError',ErrorMessage);
+end;
+
+procedure TKandinsky_Web.GenerationUpdate(Sender: TObject;
+ const Message: string);
+begin
+ // flog.toLog(0,'uWebServerKandinsky','GenerationUpdate',Message);
+end;
+
+procedure TKandinsky_Web.IdHTTPServer1CommandGet(AContext: TIdContext;
+ ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
+var
+ FilePath: string;
+begin
+ FCriticalSection.Enter;
+ try
+ if ARequestInfo.Document = '/' then
+ begin
+ AResponseInfo.ContentType := 'text/html';
+ AResponseInfo.ContentText := GenerateHTML;
+ end
+ else if ARequestInfo.Document = '/image' then
+ begin
+ if FileExists(FCurrentImage) and (SecondsBetween(Now, FImageTime) <= 5) then
+ begin
+ AResponseInfo.ContentType := 'image/jpeg';
+ AResponseInfo.ContentStream := TFileStream.Create(FCurrentImage, fmOpenRead);
+ end
+ else
+ AResponseInfo.ResponseNo := 404;
+ end
+ else if ARequestInfo.Document = '/image-data' then
+ begin
+ AResponseInfo.ContentType := 'application/json';
+ AResponseInfo.ContentText := GenerateJSON;
+ end
+ else
+ AResponseInfo.ResponseNo := 404;
+ finally
+ FCriticalSection.Leave;
+ end;
+end;
+
+
+end.
diff --git a/SilentPlayer.dpr b/SilentPlayer.dpr
new file mode 100644
index 0000000..1ff8de5
--- /dev/null
+++ b/SilentPlayer.dpr
@@ -0,0 +1,14 @@
+program SilentPlayer;
+
+uses
+ System.StartUpCopy,
+ FMX.Forms,
+ uSilentPlayer in 'uSilentPlayer.pas' {fPublicPlayer};
+
+{$R *.res}
+
+begin
+ Application.Initialize;
+ Application.CreateForm(TfPublicPlayer, fPublicPlayer);
+ Application.Run;
+end.
diff --git a/SilentPlayer.dproj b/SilentPlayer.dproj
new file mode 100644
index 0000000..1c15e79
--- /dev/null
+++ b/SilentPlayer.dproj
@@ -0,0 +1,1326 @@
+п»ї