mirror of
https://github.com/rejetto/hfs2.git
synced 2025-12-19 10:03:56 +01:00
added 'no log' section flag to support SAP themes like 'mobil-light'
This commit is contained in:
parent
782702c192
commit
b028c47f10
@ -139,7 +139,7 @@ type
|
||||
PtplSection = ^TtplSection;
|
||||
TtplSection = record
|
||||
name, txt: string;
|
||||
nolog, nourl, cache: boolean;
|
||||
nolog, nourl, noList, cache: boolean;
|
||||
ts: Tdatetime;
|
||||
end;
|
||||
|
||||
@ -1023,9 +1023,10 @@ var
|
||||
// there may be flags after |
|
||||
s:=cur_section;
|
||||
cur_section:=chop('|', s);
|
||||
base.nolog:=ansiPos('no log', s) > 0;
|
||||
base.nourl:=ansiPos('private', s) > 0;
|
||||
base.cache:=ansiPos('cache', s) > 0;
|
||||
base.nolog:=containsStr('no log', s);
|
||||
base.nourl:=containsStr('private', s);
|
||||
base.noList:=containsStr('no list', s);
|
||||
base.cache:=containsStr('cache', s);
|
||||
base.ts:=now();
|
||||
|
||||
s:=cur_section;
|
||||
|
||||
41
main.pas
41
main.pas
@ -1,4 +1,4 @@
|
||||
{
|
||||
{
|
||||
Copyright (C) 2002-2014 Massimo Melina (www.rejetto.com)
|
||||
|
||||
This file is part of HFS ~ HTTP File Server.
|
||||
@ -36,8 +36,8 @@ uses
|
||||
HSlib, traylib, monoLib, progFrmLib, classesLib;
|
||||
|
||||
const
|
||||
VERSION = '2.4.0 RC1';
|
||||
VERSION_BUILD = '313';
|
||||
VERSION = '2.4.0 RC2';
|
||||
VERSION_BUILD = '314';
|
||||
VERSION_STABLE = {$IFDEF STABLE } TRUE {$ELSE} FALSE {$ENDIF};
|
||||
CURRENT_VFS_FORMAT :integer = 1;
|
||||
CRLF = #13#10;
|
||||
@ -3645,16 +3645,12 @@ const MAX_CONCURRENTS = 3;
|
||||
var
|
||||
i, n: integer;
|
||||
f: Tfile;
|
||||
useList: boolean;
|
||||
mainSection: PtplSection;
|
||||
begin
|
||||
result:='';
|
||||
if (folder = NIL) or not folder.isFolder() then exit;
|
||||
|
||||
if not available() then
|
||||
begin
|
||||
cd.conn.reply.mode:=HRM_OVERLOAD;
|
||||
cd.conn.addHeader('Refresh: '+intToStr(1+random(2))); // random for less collisions
|
||||
exit('Please wait, server busy');
|
||||
end;
|
||||
if macrosLogChk.checked and not appendmacroslog1.checked then
|
||||
resetLog();
|
||||
diffTpl:=Ttpl.create();
|
||||
@ -3676,6 +3672,18 @@ try
|
||||
if otpl <> filelistTpl then
|
||||
diffTpl.fullText:=folder.getRecursiveDiffTplAsStr();
|
||||
|
||||
mainSection:=diffTpl.getSection('');
|
||||
if mainSection = NIL then
|
||||
exit;
|
||||
useList:=not mainSection.noList;
|
||||
|
||||
if useList and not available() then
|
||||
begin
|
||||
cd.conn.reply.mode:=HRM_OVERLOAD;
|
||||
cd.conn.addHeader('Refresh: '+intToStr(1+random(2))); // random for less collisions
|
||||
exit('Please wait, server busy');
|
||||
end;
|
||||
|
||||
fullEncode:=FALSE;
|
||||
ofsRelUrl:=length(folder.url(fullEncode))+1;
|
||||
ofsRelItemUrl:=length(folder.pathTill())+1;
|
||||
@ -3693,6 +3701,8 @@ try
|
||||
result:=diffTpl['special:begin'];
|
||||
tryApplyMacrosAndSymbols(result, md, FALSE);
|
||||
|
||||
if useList then
|
||||
begin
|
||||
// cache these values
|
||||
fileTpl:=xtpl(diffTpl['file'], table);
|
||||
folderTpl:=xtpl(diffTpl['folder'], table);
|
||||
@ -3726,7 +3736,7 @@ try
|
||||
else
|
||||
inc(numberFiles);
|
||||
end;
|
||||
{TODO this symbols will be available when executing macros in handleItem. Having
|
||||
{TODO these symbols will be available when executing macros in handleItem. Having
|
||||
them at this stage is useful only in case immediate calculations are required.
|
||||
This may happen seldom, but maybe some template is using it since we got this here.
|
||||
Each symbols is an extra iteration on the template piece and we may be tempted
|
||||
@ -3762,12 +3772,17 @@ try
|
||||
if cd.conn.state = HCS_DISCONNECTED then exit;
|
||||
|
||||
// build final page
|
||||
if not oneAccessible then md.archiveAvailable:=FALSE;
|
||||
if not oneAccessible then
|
||||
md.archiveAvailable:=FALSE;
|
||||
end
|
||||
else
|
||||
list:='';
|
||||
|
||||
md.table:=table;
|
||||
addArray(md.table, [
|
||||
'%list%',list
|
||||
]);
|
||||
result:=diffTpl[''];
|
||||
result:=mainSection.txt;
|
||||
md.f:=NIL;
|
||||
md.afterTheList:=TRUE;
|
||||
try tryApplyMacrosAndSymbols(result, md)
|
||||
@ -3777,6 +3792,7 @@ try
|
||||
result:=replaceText(result, '%build-time%',
|
||||
floatToStrF((now()-buildTime)*SECONDS, ffFixed, 7,3) );
|
||||
finally
|
||||
if useList then
|
||||
updateAvailability();
|
||||
folder.unlock();
|
||||
diffTpl.free;
|
||||
@ -4987,6 +5003,7 @@ var
|
||||
data.session:=sessions[sid];
|
||||
if data.session.ip <> conn.address then
|
||||
begin
|
||||
conn.delCookie(SESSION_COOKIE); // legitimate clients that changed address must clear their cookie, or they will be stuck with this invalid session
|
||||
conn.reply.mode:=HRM_DENY;
|
||||
result:=FALSE;
|
||||
exit;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user