Recent Posts

Pages: 1 ... 8 9 [10]
What browser are you using?  Phone, Tablet, PC, Mac?  Which specific template file are you using?   
Try adding a{color:#8D8} to the bottom of the [style] section in the template.
Try version 4 or 6 of this template, to see if there's a difference.
HTML & templates / Re: [Question] How to download and save an external file (Macro)
« Last post by Mars on May 27, 2018, 08:10:04 AM »
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 \

<form method='post'>
URL: <input name='url' value="">
<br>Filename: <input name='dest' value="%folder%Core-9.0.iso">
<br><input type='submit'>



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



{.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.}

{.comment| define CHUNK with the min size, if nul then WHILE is never executed.}
 {.add to log|loading {.^chunk.} bytes.}
   {.add to log|Download: from={.^from.} request={.^chunk.}  loaded= {.length|var=data.}.}
      |   {:
         {.add to log|TPL sauvegarde en cours.}
         {.comment| redefine CHUNK with the min size, if nul then WHILE is stoped.}
      |   {:
         {.if|{.and| {.not|{.match|^ftp?://|{.^url.}.}/not.} | {.not|{.^filesize.} = {.filesize|{.^dest.}.}/not.}   /and.}
         {.add to log|End of download.}
   |else={:{.add to log|Error during 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
I just installed this template. It works except for one folder whose name is "1" all the sub folders the folder names and the file names (except one) are NOT shown. The folders and files are there with an icon. If I hover the cursor over the icon, the correct folder/file name is shown and and clicking the icon gives the correct response.

In the lower folders most of the folder/file names are also NOT shown.

What have I done wrong?

HTML & templates / [Testing] Remote upload (Macro)
« Last post by LeoNeeson on May 26, 2018, 10:06:25 PM »
@Mars: After doing several tests, everything seems to be working OK, but somehow, I've found a small rare bug/issue: if connection gets closed (or dropped) by the remote server (or by bad connection quality) while downloading a chunk, then the result was getting a corrupted file (I've ended up with a corrupted 15,7MB file, instead of being 12,6MB). It only happened once, and then I couldn't recreate the error. I don't know if we can get a workaround or modify the code to avoid bugs like this happen again, but I will leave you the logs of my tests:

GOOD download (normal log):
10:25:05 Requested GET /
10:25:13 loading from '' 13256704 bytes
10:25:34 chunk=10000000 from=0 size=10000000
10:26:08 chunk=3256704 from=10000000 size=3256704
10:26:09 saved file contain 13256704 bytes
10:26:09 Requested POST /

BAD download (issue log):
(Marked in bold = are the abnormal execution of code)
(Marked in red = comments added by me to describe the situation)
10:36:05 Requested GET /
10:36:17 loading from '' 13256704 bytes
10:36:53 chunk=10000000 from=0 size=10000000 > Connection dropped!
10:37:16 loading from '' 13256704 bytes
10:37:38 chunk=10000000 from=0 size=10000000
10:37:47 chunk=3256704 from=10000000 size=3256704
10:37:48 saved file contain 13256704 bytes
10:37:48 Requested POST /
10:37:48 chunk=3256704 from=10000000 size=3256704 > WTF!?
10:37:49 saved file contain 13256704 bytes > Not true, file was bigger, (exactly 16513408 bytes)!
10:37:49 Requested POST /

Code used (RemoteUpload3.tpl):
<form method='post'>
URL: <input name='url' value="">
<br>Filename: <input name='dest' value="%folder%Core-9.0.iso">
<br><input type='submit'>
{.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.}
{.comment| define CHUNK with the min size, if nul then WHILE is never executed.}
   {.add to log| chunk={.^chunk.} from={.^from.} size={.length|var=data.}.}
      |   {:
         {.comment| redefine CHUNK with the min size, if nul then WHILE is stoped.}
      | {:{.set|chunk|0.}:}
   |else={:{.add to log|Error during WHILE.}
{.add to log| saved file contain {.^from.} bytes.}

ยป Ideas for solutions/enhancements: I don't know if there is a way to 'detect' if a connection was closed (or dropped) while downloading a chunk, but I think a simple verification of file size after finish the download, could be of help. Also, perhaps a 'progress' bar could be of help, meanwhile the file is downloading (if the download on the server takes too long).

I was trying to add a 'progress' bar, like HFS has by default for uploads (useful if the download on the server takes too long), but using %progress-files%, %total% and %speed-kb% doesn't seem to have effect.
HTML & templates / Re: Update. Phone friendly.
« Last post by LeoNeeson on May 26, 2018, 09:15:35 PM »
@Mars: thanks for the explanation! (I've found very interesting how '[+special:alias]' work, especially on how we can combine macro code with an alias (an alias that works almost the same as a 'variable'). It surely gives endless possibilities and makes the code more easy to handle.

@Danny: I've tested the new Throwback7.tpl and this is getting better and better (that gradient background looks great). By the way, I don't see any more enhancements available without slowing down the server, so, it's done for me, at least for now.

HTML & templates / Update. Phone friendly.
« Last post by danny on May 26, 2018, 12:19:15 AM »
Updates are usually located at the first post in this thread.

Throwback7.tpl has single-line listings and will move extra columns out of the way, as needed.     

Kudos and thanks to LeoNeeson for samples and ideas. 

Edit: Saved here for reference
Hey Danny,

thought it was worth a mention
* Required downloading a php exe and set cgi /cli path

Although, php is somewhat aviable, but not officially supported, but is capable:;u=9522;area=showposts;sa=topics;start=30

thx raybob
HTML & templates / Re: Throwback (retro) template (experimental revision)
« Last post by danny on May 25, 2018, 02:32:39 AM »
I still have to see how to hide columns on small screen sizes (too much work for today, perhaps I'll do it on the next few days).  (I've uploaded a new revision, here. Report any bugs, if you find them)
I have rewritten it to do what you described, not by slower macros, but by speeding it up with some old school HTML4T, utilizing the table logic anchored diagonally.  The stopwatch likes this solution. 
Extra columns get out of the way, and filenames display on one line. 
I also took the liberty of changing the color theme to match Royale Noir. 

This was incorporated into release 7 after revising the delete and upload functions. 

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%

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


Code: [Select]

<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]

<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


Code: [Select]

<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


there are multiple possibilities  ;)
HTML & templates / Re: Throwback (retro) template (experimental revision)
« Last post by danny on May 24, 2018, 09:55:38 PM »
To show %item-modified% as MM/DD/YYYY, change this:
%item-modified% this:
Sorry, but I've got some bad news.  That task repeats per each file.
Unfortunately, that macro, runs on the server's cpu, for reduced multi-user capacity and slower file listings. 
Instead, we need to use the client's cpu for that, with javascript. 
Pages: 1 ... 8 9 [10]