Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Mars

Pages: [1] 2 3 ... 119
1
Bug reports / Re: HFS Documentation (English)
« on: July 11, 2018, 09:08:22 PM »
source saved for rejetto

Quote
http://www.rejetto.com:80/wiki/index.php?title=HFS:_Template_symbols

Editing HFS: Template symbols

== Symbols list - by section ==

=== Symbols available in all sections ===
; %style% : inserts the HTML from section [style]
; %login-link% : inserts HTML from section [login-link] if no user is logged in, void otherwise
; %loggedin% : inserts HTML from section [loggedin] if a user is logged in, void otherwise
; %user% : returns the name of the authenticated user, void if no user is logged in
; %ip%  : inserts the client IP address on the page
; %version% : returns the HFS version number
; %timestamp% : returns the value for the date and time of the server (format is defined by OS settings)
; %uptime%  : returns the value for how long HFS has been running without quitting
; %connections% : returns the value for the current number of connections to HFS
; %speed-out% : returns the value for the current outbound speed
; %speed-in% : returns the value for the current inbound speed
; %total-out% : returns the value for the total amount of bytes sent
; %total-in%   : returns the value for total amount the of bytes received
; %total-downloads%   : returns the value for the number of downloads
; %total-uploads%     : returns the value for the number of uploads
; %number-addresses%  : returns the value for the current number of connected clients (IP addresses)
; %number-addresses-downloading% : returns the  value for the current number of downloading clients (IP addresses)
; %build% : returns the HFS build number
; %sequential% : returns an increasing number. if it appears 3 times in a page, it will be 1, 2 and 3...
; %number-addresses-ever% : returns the number of unique IP addresses  ever connected.

=== Symbols available in the main section ===
; %up%  : inserts HTML from section [up] if the current folder is not the root, void otherwise
; %upload-link% : inserts HTML from section [upload-link] if upload is available in the current folder, void otherwise
; %host% : returns the Host http header field, as sent by the browser eg. Server-URL(:port) or Server-IP(:port)
; %number% : returns the value for the number of items in the current folder
; %number-folders% : returns the value for the number of folders in the current folder
; %number-files% : returns the value for the number of files in the current folder
; %total-size% : returns the smart value for the amount of space occupied by items in the current folder
; %total-kbytes% : same  as '''%total-size%''', but expressed in kilobytes
; %total-bytes%  : same as '''%total-size%''', but expressed in bytes
; %build-time% : returns the value for how long it took to generate the page
; %files%  : inserts HTML from section [files] if at least one item is present in the current folder, inserts HTML from section [nofiles] otherwise

=== Symbols available in section [files] ===
; %list% : the full list of items in the current folder, got by pasting each item after the pertinent section where [folder], [file] or [link] was inserted.
; %item-archive% : Expands to the [item-archive] section if the folder is archivable.
; %item-ext% : returns the extension of the current item.

=== Symbols available in sections [file], [folder] and [link] ===
; %item-type% : returns ''file'' if current item is a file, ''folder'' if it's a folder, ''link'' if it's a link
; %new% : inserts HTML from section [new] if the file is marked as new, void otherwise
; %comment% : inserts HTML from section [comment] if a comment is available for the item, void otherwise
; %item-url% : returns the value for the path to get the item
; %item-name% : returns the value for the label of the item
; %item-folder% : returns the path to the item, not in URL format. Most times it is the same as %folder%, but it is different for recursive listings.
; %item-added% : returns the value for date and time when the item was added to the VFS (date and time format is defined by OS settings)

=== Symbols available in sections [file] and [folder] ===
; %item-dl-count% : returns the value for the download counter (virtual folders totalize inner counters)
; %item-modified% : returns the value for the modification time as reported by file or folder (date and time format is defined by OS settings)
 

=== Symbols available in section [file] ===
; %item-size% : returns the value for the amount of space occupied by the item
; %item-size-b% : same as '''%item-size%''', but expressed in bytes
; %item-size-kb% : same as '''%item-size%''', but expressed in kilobytes

=== Symbols available in sections [upload], [upload+progress], [upload-results] and main section ===
; %diskfree% : returns the value for the total amount of available space minus the reserved space in the drive containing the current folder (makes sense only for real folders)
; %folder% : returns the value for the path to the current folder
; %encoded-folder% : returns the value for the encoded path to the current folder
; %parent-folder% : returns the value for the encoded path to the parent folder
; %folder-comment% : inserts the HTML from section [folder-comment] if a comment is available for the current folder, void otherwise

=== Symbols available in section [error-page] ===
; %content% : inserts the HTML from sections [ban], [deny], [not found], [unauthorized] or [overload], depending on the error code

=== Symbols available in section [ban] ===
; %reason% : returns value for the ban description from the hfs.ini

=== Symbols available in section [progress] ===
; %progress-files% : inserts the HTML from section [progress-nofiles] if no file is transferred with the current client, otherwise the list of transferring files got by pasting each file after the pertinent section [progress-download-file] and/or [progress-upload-file] is inserted

=== Symbols available in sections [progress-download-file] and [progress-upload-file] ===
These sections are related to file transferring.
; %perc% : returns the value for the percentage done
; %filename% : returns the value for the name of the file
; %done-bytes% : returns the value for the transferred bytes
; %done% : same  as '''%done-bytes%''', but using dynamic measure units
; %total-bytes% : returns the value for the number of bytes of the completed transfer
; %total% : same as '''%total-bytes%''', but using dynamic measure units
; %speed-kb% : returns the value for the throughput speed
; %time-left% : esteemed time of arrival

=== Symbols available in section [upload] ===
; %uploaded-files% : input boxes for files to be uploaded got by pasting [upload-file] for each file
; %host% : returns the Host http header field, as sent by the browser eg. Server-URL(:port) or Server-IP(:port) (since v2.1beta)
; %up%  : inserts HTML from section [up] if the current folder is not the root, void otherwise (since v2.1beta)

=== Symbols available in section [upload-file] ===
; %idx% : ordinal index of the input box

=== Symbols available in section [upload-results] ===
; %uploaded-files% : list of uploaded files got by pasting section[upload-success] and/or section [upload-failed] for each file
; %host% : returns the Host http header field, as sent by the browser eg. Server-URL(:port) or Server-IP(:port) (since v2.1beta)
; %up%  : inserts HTML from section [up] if the current folder is not the root, void otherwise (since v2.1beta)

=== Symbols available in sections [upload-success] and [upload-failed] ===
; %item-name% : name of the file
; %item-url% : address of the file

=== Symbols available in section [upload-success] ===
; %item-size% : returns the value for the size of the uploaded file
; %speed% : returns the value for the average upload speed

=== Symbols available in section [upload-failed] ===
; %reason% : returns the value for the error occurred while uploading

2
Programmers corner / Re: How I can force HFS to send nonexisting file
« on: June 22, 2018, 04:07:31 PM »
http://rejetto.com/forum/index.php?topic=12116.msg1062899#msg1062899

[not found]
{.add header|Location:/NotFound.txt.}

3
HFS ~ HTTP File Server / Re: moving to another pc
« on: June 19, 2018, 04:11:45 PM »
it seems that only html files are impacted

go to menu -> Virtual file system -> icons mask


what do you have as items in the list

--> screenshot   ;)


The Folder icons are OK, but the files placed in those folders must be edited

it's because you have moved the directory containing these files, all path are  brocken

I also notice that a good part of your files are protected by an identifier + password, have you used the right click and the option "set user / pass" or defined a restriction of access since the properties of each file


what you can do is to use the PURGE option of the context menu on the root of the vfs, this will remove the elements which no longer have a direct link, and then to re-import all the html files missing from and then their new location on the disk

However, you will have to redefine access permissions to these files

to add again the files would not replace the existing ones with a bad path, but it would create duplicates with the same name with a numeric value, it's neccesary to remove first bad files.

this may be more work than manually redrawing the path of each file (<50 if I judge by the size of the elevator representing your VFS

4
HFS ~ HTTP File Server / Re: moving to another pc
« on: June 19, 2018, 03:56:54 PM »
I have never been aware of a similar case, are the directory icons also affected by the problem?

is opening "Edit resource" and closing it sufficient, or is it also necessary to find the target for each item and force a link update?

I would like you to look at an item corresponding to a folder and which always has its icon in white,

 you display its properties and go to the "other" tab,
you will see a location corresponding to the icon that must be displayed:
 is it it titled "default" ?
 is it a numeric value?
 as well as the appearance of the icon?

if you can accompany your answer with a screenshot of the HFS window and specific folder's properties, it will be nice, either directly with a dedicated logisiel or even with a smartphone (but without using the flash)

5
Quote
I want HFS to send instead of this NOT EXISTING IN IT'S VFS file some another file - for example d:\HFS\NotFound.txt or even /File3.txt from it's VFS. But I want that HFS sent this file AS IF IT IS A REQUESTED file, and open the  Save as Dialog.

Any ideas?

I'm sorry for this late and fragmentary response, but I could not go further in the technique to use

first you have to use something like this in order to reload a complete web page that will contain the code needed to transfer the file

Quote
[not found]
{.add header|Location:/~Error404.}

[Error404]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript">
  .....
</script>

<body onload="downloadFile("/error_file.txt");">
mince
</body>
</html>

it is probably necessary to perform a relocation because "not found" is the part of the "error-page" section through the variable %content%

the principle is to make hfs believe that it receives a request from the user by using a set based on XMLHttpRequest

I found a lot of examples but nothing that corresponds exactly and allows local to open a window saveas

I put some links that may help to find the magic formula using XMLHttpRequest
https://developer.mozilla.org/ru/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data
https://stackoverflow.com/questions/13752984/html5-file-api-downloading-file-from-server-and-saving-it-in-sandbox
https://gist.github.com/xxd3vin/9632138c49c94b38b2c632c40990f6f8

https://stackoverflow.com/questions/13752984/html5-file-api-downloading-file-from-server-and-saving-it-in-sandbox

do not be afraid of explanations in other languages, you have to look especially at the scripts to put in the template

all this being a little too complex for me, I can not go further for the rest, sorry it will have to wait for someone more competent

6
the solution is based on this principle

Quote
[not found]
<h1>{.!Not found.}</h1>
<a href="/">{.!go to root.}</a>
{.add header|Location:/files.txt.}

if this should only be possible for certain files, it is possible to define tests

Quote
[not found]
<h1>{.!Not found.}</h1>
<a href="/">{.!go to root.}</a>
{. if|
  {.=|%url%|/private/noview.txt.}|
  {.=|%url%|/perso/hidden.dat.}|
 |{:{.add header|Location:/files.txt.}:}/if}

working only if those file don't exists on the server, otherwise it is necessary to put the corresponding file names in the filter of the directory considered

it is possible to manage each request by using the event file in the request section, but it is more difficult to manage,

we can also use a table to avoid a significant number of rows in the previous IF

I'm sorry I have no more time in front of me for now, take the time to detail the list of files you do not want to see loaded and put me in private message I will treat later when I return

7
in fact you want the answer is done by sending a file instead of sending a web page, can I know without indiscretion which file you want to send, otherwise it is also simply possible to redirect the user to Home Page

8
I translated your first message, and I put two possible answers in my previous message, but I understand the goal to reach but not the path,

Let's say that I connect to your server, what should I do for me to display a "NOT FOUND", I have to upload a certain type of file, try to download a file from the server, but supposed to be inaccessible, or when I put a url that does not match any physical file like "xxx.xxx.xxx.xxx./max.txt"

I have very little time in front of me to bring you a solution, be brief and precise

9
Have you an example about requested file, are you referring to a file sent by a user or to a file that is trying to load a user?

Есть ли у вас пример о запрошенном файле, ссылаетесь ли вы на файл, отправленный пользователем или на файл, который пытается загрузить пользователя?
 
я использую переводчик Google, если возможно, вы можете использовать непосредственно английский, у вас будут более быстрые и точные ответы, спасибо?


A bad request give always  this page
Quote
Not found

go to root
gived by the section
Quote
[not found]
<h1>{.!Not found.}</h1>
<a href="/">{.!go to root.}</a>

if you have some files to hide it is possible to add them as a file mask
VFS Root -> properties --> files Mask --> Don't consider as download (mask)
by default it'is *.htm;*.html;*.css     you can add your mask  and validate

10
HFS ~ HTTP File Server / Re: HFS Network Storage Integration
« on: May 30, 2018, 10:22:03 AM »
it's much easier,   go to "network favorites",  use "connect a network drive" ,

and assign the remote share as a local letter that is added to the VFS

11
the solution is to memorize the size of the initial file in a temporary variable, and when the complete download is complete, to check that it matches the saved file. If this is not the case, we force the physical deletion of the loaded file, except if source file is on a FTP server, in this case interrupted download can be restarted later

at the beginning of script, we test used protocol, if FTP  is used then we start download from the last know position, else destination is simply deleted

The FTP protocol is functional, but the download can only be done in full or be taken at the position of its interruption. Due to my limited knowledge about using sockets, I could not set up partial loads like with the http

* bug corrected: the file was tranferred to the Recycle Bin instead of being physically destroyed, which could have led to disk saturation

there is a serious security hole in the use of this script, this one in the state allows access to the entire hard disk hosting HFS

the macro load is intended to work with windows-type paths as c:\windows\explorer.exe

so if it is offered the opportunity to a user of your hfs to use the form, it will be able to recover any file of your hard disk by transferring it in hfs

moreover the url can be encrypted using % followed by a hex code representing a character of the ascii table as c%3A%5Fwindows%5Fexplorer.exe

it is therefore absolutely necessary to detect and prevent any continuation of the script if the url contains the \


Quote
<form method='post'>
URL: <input name='url' value="http://distro.ibiblio.org/tinycorelinux/9.x/x86/release/Core-9.0.iso">
<br>Filename: <input name='dest' value="%folder%Core-9.0.iso">
<br><input type='submit'>
</form>

{.set|url|{.postvar|url.}.}

{.break|if={.not|{.^url.}.}.}

{.break|if={.count substring|\|{.decodeuri|{.^url.}.}.}|result=Direct acces on hard disk not allowed.}

{.set|dest|{.or|{.filename|{.postvar|dest.}.}|{.filename|{.^url.}.}|downloaded.}.}

{.set|filesize|{.filesize|{.^url.}.}.}

{.add to log|Start loading from '{.^url.}' {.^filesize.} bytes.}

{.if|{.match|^ftp?://|{.^url.}.}| {:{.set|from|{.^filesize.}.}:} | {:{.delete|{.^dest.}|bin=0.}{.set|from|0.}:}.}

{.break|if={.not|{.^filesize.}.}{.=|{.^filesize.}|{.filesize|{.^dest.}.}.}|result=Source file can't be downloaded: server return nul size or destination match source size.}

{.save|{.^dest.}|.}
{.^from.}
{.comment| define CHUNK with the min size, if nul then WHILE is never executed.}
{.set|chunk|{.min|{.^filesize.}|10000000.}.}
{.^chunk.}
{.while|chunk|{:
 {.add to log|loading {.^chunk.} bytes.}
   {.load|{.^url.}|from={.^from.}|var=data|size={.^chunk.}.}
   {.length|var=data.}
   {.add to log|Download: from={.^from.} request={.^chunk.}  loaded= {.length|var=data.}.}
   {.if|{.length|var=data.}
      |   {:
         {.add to log|TPL sauvegarde en cours.}
         {.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.}|{.^from.}/sub.}.}.}
         :}
      |   {:
         {.set|chunk|0.}
         {.if|{.and| {.not|{.match|^ftp?://|{.^url.}.}/not.} | {.not|{.^filesize.} = {.filesize|{.^dest.}.}/not.}   /and.}
            |{:{.delete|{.^dest.}|bin=0.}:}.}
         {.add to log|End of download.}
         :}
   /if.}:}
   |timeout=0
   |else={:{.add to log|Error during WHILE.}:}
/while.}
{.add to log|Saved file contain {.^from.} bytes.}

I am studying the case taking into account the eventuality where the source file would be also the file of destination and would be destroyed irremediably during the transfer and its size becomes zero

12

To force a date to specific format , use  the Macro   time | new format | when=date

%item-modified% use by default  the system format, it is necessary to have universal format  by using
%item-modified-dt% or %item-added-dt%

example:
%item-modified% => 05/25/16 15:00:56
%item-modified-dt% => 42515.6256593403


{.time|mm/dd/yy|when=%item-modified-dt%.}


http://rejetto.com/wiki/index.php?title=HFS:_Time_format#Text_formatting

Code: [Select]
[+file]
<td>%item-size%B<td>{.time|mm/dd/yy|when=%item-modified-dt%.}<td>%item-dl-count%

[+folder]
<td class='nosize'>folder<td>{.time|m/d/yy|when=%item-modified-dt%.}<td>%item-dl-count%

it is possible to have the date and time on two lines using separate macros

Code: [Select]
[+file]
<td>%item-size%B<td>{.time|mm/dd/yy|when=%item-modified-dt%.}<p>{.time|hh:nn:ss|when=%item-modified-dt%.}<td>%item-dl-count%

[+folder]
<td class='nosize'>folder<td>{.time|mm/dd/yy|when=%item-modified-dt%.}<p>{.time|hh:nn:ss|when=%item-modified-dt%.}<td>%item-dl-count%

by creating a personal alias this can give more clarity to the template

[+special:alias]
mtime=time|mm/dd/yy|when=%item-modified-dt%
htime=time|hh:nn:ss|when=%item-modified-dt%

Code: [Select]
[+file]
<td>%item-size%B<td>{.mtime.}<p>{.htime.}<td>%item-dl-count%

[+folder]
<td class='nosize'>folder<td>{.mtime.}<p>{.htime.}<td>%item-dl-count%

one to preserve the standardized format using the macro cut proposed by LeoNeeson

[+special:alias]
mtime=cut||10|%item-modified%
htime=cut|12||%item-modified%

there are multiple possibilities  ;)

13
Hi I will have a little hesitation to use a string to store binary values but it is true that delphi behaves differently from C which uses a 0 end of chain, but hey as it works as it is, I do not there is not much to say


in another vein, the https hangs on the http protocol, you would have to look into the issue so that the macro 'load' is 100% functional as for a simple http link


on my side I am worried about the problem considering the links ftp because it is more within range of my competences

at this moment, we will link our results to release a new build ;)

14
Thank's Boss

it is leoneeson who needs it most for the moment, I suggest you wait before publishing a new version, this is related to my idea about download by ftp links (I'm halfway because I 'advance by student', you would have to look on your side to check that a download is feasible from an url https, I failed to validate it, despite the design of the procedure in scriptlib

if reMatch(fn, '^https?://', 'i!') > 0 then
    try result:=httpGet(fn, from, size)

15
@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



Pages: [1] 2 3 ... 119