Compare commits

..

No commits in common. "master" and "v2.4-rc07" have entirely different histories.

5 changed files with 14 additions and 44 deletions

View File

@ -1,9 +1,3 @@
# Obsolete
This is the repository of the old HFS.
I'm working on HFS 3 on another repository. Check it out!
https://github.com/rejetto/hfs
## Introduction
You can use HFS (HTTP File Server) to send and receive files.
It's different from classic file sharing because it uses web technology.
@ -17,8 +11,6 @@ Icons are generated at http://fontello.com/ . Use fontello.json for further modi
For the default template we are targeting compatibility with Chrome 49 as it's the latest version running on Windows XP.
Warning: Delphi Community Edition 10.4 removed support for command-line compilation, and is thus unable to compile JEDI Code Library, and is thus unable to compile HFS2, ref [Community Edition no longer includes the command-line compilers](https://blogs.embarcadero.com/delphi-cbuilder-community-editions-now-available-in-version-10-4-2/#comment-1339) - meaning the last version of Community Edition cabale of compiling HFS2 is Delphi 10.3.x
## Libs used
- [ICS v8.64](http://www.overbyte.be) by François PIETTE
- [TRegExpr v0.952b](https://github.com/andgineer/TRegExpr/releases) by Andrey V. Sorokin

View File

@ -99,7 +99,6 @@ type
constructor create;
destructor Destroy; override;
function addFile(src:string; dst:string=''; data:Tobject=NIL):boolean; virtual;
function contains(src:string):boolean;
function count():integer;
procedure reset(); virtual;
property totalSize:int64 read getTotal;
@ -525,16 +524,6 @@ if cachedTotal < 0 then calculate();
result:=cachedTotal;
end; // getTotal
function TarchiveStream.contains(src:string):boolean;
var
i: integer;
begin
for i:=0 to Length(flist)-1 do
if flist[i].src = src then
exit(TRUE);
result:=FALSE;
end;
function TarchiveStream.addFile(src:string; dst:string=''; data:Tobject=NIL):boolean;
function getMtime(fh:Thandle):int64;

View File

@ -227,10 +227,6 @@ $domReady(()=>{
$on('#search-panel', { submit(ev) {
var f = $form(ev.target)
var s = f.search
if (!s) {
showError(`{.!Search field is mandatory.}`)
return false
}
var folder = ''
var ps = []
switch (f.where) {
@ -737,7 +733,7 @@ function $form(form, field) {
return form.elements.namedItem(field).value
let ret = {}
for (let e of form.elements)
if (e.name && (e.type !== 'radio' || e.checked)) {
if (e.name) {
let v = e.value
if (field === false)
v = v.trim()
@ -1085,7 +1081,7 @@ function toggleSelection() {
$toggle('selection-panel')
if (multiSelection = !multiSelection) {
let base = $create('input.selector', { a:{type:'checkbox'} })
$msel('.item-selectable .item-link a', e=> // having the checkbox inside the A element will put it on the same line of A even with long A, otherwise A will start on a new line.
$msel('.item-selectable a', e=> // having the checkbox inside the A element will put it on the same line of A even with long A, otherwise A will start on a new line.
e.append(base.cloneNode()) )
}
else
@ -1344,7 +1340,7 @@ $domReady(()=>{
$toggle('delete-selection', $sel('.can-delete'))
$click('#archive', ()=>
mustSelect() && ask("{.!Downloading many files as archive can be a lengthy operation, and the result is a TAR file. Continue?.}", ()=>
submit({ selection: getSelectedItemsName() }, "?mode=archive") ))
submit({ selection: getSelectedItemsName() }, "{.get|url|mode=archive|recursive.}") ))
$msel('#files .cannot-access .item-link img', x=>
x.insertAdjacentElement('afterend', $icon('lock', "{.!No access.}") ))

View File

@ -104,7 +104,7 @@ type
);
body: ansistring; // specifies reply body according to bodyMode
bodyFile: string;
bodyStream: Tstream; // note: the stream is automatically freed
bodyStream: Tstream; // note: the stream is automatically freed
firstByte, lastByte: int64; // body interval for partial replies (206)
realm, // this will appear in the authentication dialog
reason, // customized reason phrase
@ -423,7 +423,7 @@ begin
repeat
result:=posEx(ss, s, ofs);
if result = 0 then exit;
repeat
qpos:=posEx(quote, s, ofs);
if qpos = 0 then exit; // there's no quoting, our result will fit
@ -1599,7 +1599,7 @@ end; // initInputStream
function ThttpConn.sendNextChunk(max:integer=MAXINT):integer;
var
n, toSend: int64;
n: int64;
buf: ansistring;
begin
result:=0;
@ -1611,8 +1611,7 @@ if (n = 0) or (bytesSentLastItem = 0) then n:=max;
if n > MAXIMUM_CHUNK_SIZE then n:=MAXIMUM_CHUNK_SIZE;
if n < MINIMUM_CHUNK_SIZE then n:=MINIMUM_CHUNK_SIZE;
if n > max then n:=max;
toSend:=bytesToSend;
if n > toSend then n:=toSend;
if n > bytesToSend then n:=bytesToSend;
if n = 0 then exit;
setLength(buf, n);
n:=stream.read(buf[1], n);

View File

@ -35,8 +35,8 @@ uses
HSlib, traylib, monoLib, progFrmLib, classesLib;
const
VERSION = '2.4.0 RC8';
VERSION_BUILD = '320';
VERSION = '2.4.0 RC7';
VERSION_BUILD = '319';
VERSION_STABLE = {$IFDEF STABLE } TRUE {$ELSE} FALSE {$ENDIF};
CURRENT_VFS_FORMAT :integer = 1;
CRLF = #13#10;
@ -5024,12 +5024,6 @@ var
tar: TtarStream;
nofolders, selection, itsAsearch: boolean;
procedure addToTar(src,dst:string);
begin
if not selection or not tar.contains(src) then
tar.addFile(src, dst);
end;
procedure addFolder(f:Tfile; ignoreConnFilters:boolean=FALSE);
var
i, ofs: integer;
@ -5064,7 +5058,7 @@ var
else
s:=fi.pathTill(f.parent); // we want the path to include also f, so stop at f.parent
addToTar(fi.resource, s);
tar.addFile(fi.resource, s);
end
finally listing.free end;
end; // addFolder
@ -5099,7 +5093,7 @@ var
t:=substr(s, lastDelimiter('\/', s)+1)
else
t:=s;
addToTar(ft.resource, t);
tar.addFile(ft.resource, t);
finally freeIfTemp(ft) end;
end;
end; // addSelection
@ -8118,10 +8112,10 @@ var
if userSocketBuffer > 0 then
data.conn.sndBuf:=userSocketBuffer
else if highSpeedChk.checked then
else
begin
size:=minmax(8192, MEGA, round(data.averageSpeed));
if safeDiv(0.0+size, data.conn.sndbuf, 2) > 2 then
if highSpeedChk.checked and (safeDiv(0.0+size, data.conn.sndbuf, 2) > 2) then
data.conn.sndBuf:=size;
end;
end;
@ -12124,7 +12118,7 @@ tray:=TmyTrayicon.create(self);
DragAcceptFiles(handle, true);
caption:=format('HFS ~ HTTP File Server %s', [VERSION]);
application.Title:=format('HFS %s', [VERSION]);
setSpeedLimit(50000);
setSpeedLimit(-1);
setSpeedLimitIP(-1);
setGraphRate(10);
setMaxConnections(0);