Recent Posts

Pages: 1 [2] 3 4 ... 10
11
ok, mars' fix is correct. Thanks mars!
i included it for the next build, but if you don't want to wait, you can download this preview
https://drive.google.com/open?id=12GRINYSKe8H-VZtpsbvJkabvdTrB48F3
12
HTML & templates / Re: [Question] How to download and save an external file (Macro)
« Last post by Mars on May 22, 2018, 08:02:05 AM »
@Rejetto

I ask myself an essential question: 'httpGet' is of type string and 'reply' of type Tstringstream, I imagine that the macro 'load' is originally planned to treat only text files, that does not mean it does not pose a problem whereas with binary files it would be more appropriate to use 'httpGetFile' with 'reply' as Tfilestream

I am also studying the implementation for the macro 'load' of urls based on TFtpClient


13
Добрый день. Возникла необходимость добавления в данный шаблон функции создания папок пользователями. Прошу помочь с кодом. Куда и что писать? Уж очень нужно. Заранее благодарен!
14
HFS ~ HTTP File Server / Re: visibility based on user permissions
« Last post by raytracer on May 21, 2018, 06:56:34 PM »
Thanks, guys.

Mars' method accomplished exactly what I was after.
15
@Rejetto: Mars's bugfix is a nice opportunity to officially release (along with the source code) the long-awaited 'stable' release v2.3l Build #300, which will also be the first stable release featuring the multi-language support (that you have published as beta test build, five months ago here, along with another bugfixes here).

(there is no hurry, it's only a suggestion.. ;) )
16
HFS ~ HTTP File Server / Re: visibility based on user permissions
« Last post by LeoNeeson on May 21, 2018, 06:06:22 PM »
» You can do it this way:



- Right click on the home / icon > Properties...
- Then click on 'Manage accounts', make some users/pass and click OK.
- Then back on the 'Properties' window, and check on the users you made.
- Click OK to apply the changes, and it's done.

Now every time someone visits your site, it will ask an user and password (if some visitor doesn't have it, it will show an 'Unauthorized' message).

Your question is somewhat related to this question. Currently, there is no 'classic' login form, like most websites have (HFS has only implemented a basic auth pop-up).

» EDIT: I was writing my answer while Mars was answering you (his answer is the most appropriate and easy way to do it :) )
17
HFS ~ HTTP File Server / Re: visibility based on user permissions
« Last post by Mars on May 21, 2018, 05:53:48 PM »
it's already implemented in hfs

switch to expert mode

open 'menu' > 'virtual file system'

and check 'List protected items only for users'

by using this option, only items that do not contain a lock will be visible to the user,
 for a connected user, those that are not authorized are masked
18
HFS ~ HTTP File Server / visibility based on user permissions
« Last post by raytracer on May 21, 2018, 04:18:14 PM »
Just starting with HFS, is there anyway to - instead of showing all shared files/folders on the home screen -require user login and then display only those files/folders that user has permissions for?

Thanks,
Joe
19
hi guys, i started reading this thread but only half of it as it is a bit long. I'll try to finish tomorrow as i have to go to bed.
20
HTML & templates / Re: [Question] How to download and save an external file (Macro)
« Last post by Mars on May 20, 2018, 03:21:47 PM »
there is actually a malfunction at the level of hfs, but I can not do anything without the help of rejetto

here is what it is necessary to use in the file utilLib.pas

Quote
function loadFile(fn:string; from:int64=0; size:int64=-1):ansistring;
var
  f:file;
  bak: byte;
begin
result:='';
IOresult;
if not validFilepath(fn) then exit;
if not isAbsolutePath(fn) then chDir(exePath);
assignFile(f, fn);
bak:=fileMode;
fileMode:=0;
try
  reset(f,1);
  if IOresult <> 0 then exit;
  if (size < 0) or (size > filesize(f)-from) then
    size:=filesize(f)-from;
  setLength(result, size);
  seek(f, from);
  blockRead(f, result[1], size);
  finally
  closeFile(f);
  filemode:=bak;
  end;
end; // loadFile


I took the opportunity to improve the security of the script, which is in green can be deleted later

Quote

<form method='post'>
URL: <input name='url' value="folder%100MB.zip">
<br>Filename: <input name='dest' value="%folder%CopyOf100MB-BAD.zip">
<br><input type='submit'>
</form>
{.set|url|{.postvar|url.}.}

{.set|url|/100MB.zip.}

{.break|if={.not|{.^url.}.}.}
{.set|dest|/download/{.or|{.filename|{.postvar|dest.}.}|{.filename|{.^url.}.}|downloaded.}.}
{.delete|{.^dest.}.}
{.add to log| loading from '{.^url.}' {.filesize|{.^url.}.} bytes .}
{.break|if={.not|{.filesize|{.^url.}.}.}|result=Source file can't be downloaded: server return nul size.}
{.set|from|0.}
{.save|{.^dest.}|.}
{.comment| define CHUNK with the min size, if nul then WHILE is never executed.}
{.set|chunk|{.min|{.filesize|{.^url.}.}|10000000.}.}
{.while|chunk|{:
   {.load|{.^url.}|from={.^from.}|var=data|size={.^chunk.}.}
   {.add to log| chunk={.^chunk.} from={.^from.} size={.length|var=data.}.}
   {.if|{.length|var=data.}
      |   {:
         {.append|{.^dest.}|var=data.}{.inc|from|{.length|var=data.}.}
         {.comment| redefine CHUNK with the min size, if nul then WHILE is stoped.}
         {.set|chunk|{.min|{.^chunk.}|{.sub|{.filesize|{.^url.}.}|{.^from.}/sub.}.}.}
         :}
      | {:{.set|chunk|0.}:}
   /if.}:}
   |timeout=0
   |else={:{.add to log|Error during WHILE.}
   :}/while.}
{.add to log| saved file contain {.^from.} bytes.}

for ease of testing, I created a real folder named 'download' and added the file '100MB.zip', both in the root of the VFS, So with the script the zip is copied in pieces in 'download'

{.set|url|/100MB.zip.}
{.set|dest|/download/{.or|{.filename|{.postvar|dest.}.}|{.filename|{.^url.}.}|downloaded.}.}
Pages: 1 [2] 3 4 ... 10