Changeset 153


Ignore:
Timestamp:
Feb 11, 2024, 3:07:19 PM (10 months ago)
Author:
chronos
Message:
  • Added: Support for private webcams.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/ZdechovNET/WebCamPage.pas

    r151 r153  
    8181      try
    8282        DbRows := TDbRows.Create;
    83         Database.Query(DbRows, 'SELECT * FROM `Webcam` WHERE `Enabled`=1');
     83        Database.Query(DbRows, 'SELECT * FROM `Webcam` WHERE `Enabled`=1 AND `Public`=1');
    8484        for I := 0 to DbRows.Count - 1 do begin
    8585          Text := Text + MakeLink(DbRows[I].Items['Name'], NavigationLink(
     
    119119  try
    120120    DbRows := TDbRows.Create;
    121     Database.Query(DbRows, 'SELECT * FROM `Webcam` WHERE `Enabled`=1');
     121    Database.Query(DbRows, 'SELECT * FROM `Webcam` WHERE `Enabled`=1 AND `Public`=1');
    122122    ImageWidthThumb := 160;
    123123    for I := 0 to DbRows.Count - 1 do begin
     
    142142  RefreshInterval: Integer;
    143143  LastFileDate: string;
     144  Token: string;
    144145begin
    145146  Result := '';
    146147  with TWebSession(HandlerData) do
    147148  try
     149    if HandlerData.Request.Query.TryGetValue('Token', Token) then
     150      else Token := '';
     151
    148152    DbRows := TDbRows.Create;
    149153    Database.Query(DbRows, 'SELECT * FROM `Webcam` WHERE (`Id`=' +
    150       IntToStr(Id) + ') AND (`Enabled`=1)');
     154      IntToStr(Id) + ') AND (`Enabled`=1) AND ' +
     155      '((`Public` = 1) OR ((`Public` = 0) AND (`Token`="' +
     156      Database.EscapeString(Token) + '")))');
    151157    if DbRows.Count > 0 then begin
    152158      WebCamImage := 'images/webcam/' + DbRows[0].Items['ImageName'];
Note: See TracChangeset for help on using the changeset viewer.