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

Pages: [1]
1
@bmartino1
That's a beautiful template! 

Here's the unicode piece:
set charset to UTF-8 and also the font declaration in the body [style]: 
Code: [Select]
font-family:"Arial Unicode MS","Lucida Sans Unicode","DejaVu Sans",sans-serif;This activates the unicode fonts for windows, mac, linux and phones too.

2
The example has a variable of a larger size than possible.

So, did you try this:  {.set|chunk|4000.}

. . . maybe not optimized, but at least it is possible to have a variable that size.

3
HTML & templates / Update. faster page loading
« on: May 15, 2018, 04:00:30 AM »
Updates are located at the first two posts. 

I completed the transition to Unicode icons so that Throwback4.tpl never uses an http request for icon display.  That provides significantly faster support for multiple users.  Brisk browsing is possible despite multiple concurrent downloads.

4
{.load|http://distro.ibiblio.org/tinycorelinux/9.x/x86/release/Core-9.0.iso|/Upload.}
That loads 5596 bytes of the iso into ram.  Needs the {.save


However, from rejetto's posts, I found an example of saving big files 
Except that the chunk size maximum is bigger than the buffer, which may fill and exit.
{.set|#url|http://distro.ibiblio.org/tinycorelinux/9.x/x86/release/Core-9.0.iso.}
{.set|#out|test.}
{.set|#from|0.}
{.set|#chunk|1000000.}
{.save|{.^#out.}|.}
{.while|chunk|{:
   {.load|{.^#url.}|var=#x|size={.^#chunk.}|from={.^#from.}.}
   {.if|{.length|var=#x.}
      | {:{.append|{.^#out.}|var=#x.}
         {.inc|#from|{.length|var=#x.}.}
        :}
      | {:{.set|#chunk|0.}:}.}
:}|timeout=0.}

I guess you could try the chunk size at 4096 if that is bytes or 32768 if bits?  Hard drives write 4k chunks.  Even 5k might work; but, larger would probably exit the script before it could append more.
Might want to replace "test" with the destination?  Folder or filename?
Seems that "Remote Upload" is in alpha status. 

P.S.
Maybe Openmediavault has Remote Upload for your Raspberry Pi? 


5
HTML & templates / Updated for even more speed.
« on: May 12, 2018, 03:35:56 AM »
Revised to double the speed.  Updates at post#1 and 2. 

Now, it goes maximum speed by default.  The pingdom test reports: Faster than 99% of websites. 

Extra features, such as that delete button, can be provided for a specific folder, without slowing your other folders.  This method is much faster than provisioning that button site-wide. 

P.S.
This got put to work on my own server. 

6
So, I wonder how to make this one work: 
Code: [Select]
$.ajax({
   'url': 'http://host.com/',
   //'otherSettings': 'othervalues',
   username: $("username").val(),
   password: $("password").val()
   },
   sucess: function(result) {
     alert('done');
   }
});
No luck yet though.  I don't have much scripting experience. 

7
HTML & templates / remote
« on: May 11, 2018, 05:06:52 AM »
Nice, an old-school template! (and it loads very fast!) :)

Thanks! 
It has been an adventure!  I had wanted to make HFS look and run like I remembered from long ago.  A friend had it on his server, and it was fast back then. 

To regain the speed, I've been using my stopwatch, and the pingdom test (which has per-element timings).  Currently, the point is twofold--reduce micro-pauses that occur per each file in a listing (so they won't add up to a large pause), and make the template as small and clean as possible.

After that, it is a good head start to add features and still run fast too.
Since you seem to know about template stuff, I have this question for you: do you know how to add a 'remote upload' box? For example, you have this URL: http://linux.com/distro.iso and want to download this ISO file directly to the server, in the current shared folder. So, you write that URL in a input box and press a 'Save' submit button, and then the HFS server starts downloading the file, and when it ends, it puts the file in the current shared folder. How handy this may come in? Imagine you are on a mobile connection and want to leave the server downloading a file, so when you come home, you have the file ready (and it's automatically shared on that folder). Is this doable?...
That's a server-side script, possibly ajax?  I don't know how to do that.  But, if I find out, first thing on the list is a real login Form, due to diminishing support of browser-provided login box for basic auth. 
Anyway, I do that remoting task myself, not with a web server, but with tightvnc (or realvnc) on the server and bvnc on the phone.  For better security, avoid commonly scanned ports (there's usually a published list), so not 5900.  Screen resolution plays an important role in bandwidth consumption and usability--at the server, 1024x600 is fastest or 1280x720 will work to vnc a server from a phone. At the phone, in bvnc, you can change the color mode to 256, so that the bandwidth consumption is minimal. 

8
To provision the delete button:  In hfs, right-click your upload folder, properties, diff template tab, and paste code below.
This is useful for your upload and users folders.
Code: [Select]
[file]
<tr>
<td class=rw>%new%<a href="%item-url%">&nbsp;<font color="white">&#9671;</font>&nbsp;%item-name%</a></td>
<td class=rw align=center>%item-size%</td>
<td class=rw align=center>%item-modified%</td>
{.if|{.get|can delete.}|<td class=rw align=center><form method='post' id='filelist'><input type='hidden' name='selection' value='%item-url%'><input type='submit' name='action' value='delete' onclick='return confirm("Delete file?")' ></form></td>.}
</tr>

[file.mp3 = file.m4a = file.wma = file.flac = file.ogg]
<tr>
<td class=rw>%new%<a href="%item-url%">&nbsp;<font color="#ADE8F9">&#9836;</font>&nbsp;%item-name%</a></td>
<td class=rw align=center>%item-size%</td>
<td class=rw align=center><a href="mms://%host%%encoded-folder%%item-url%">MediaPlayer</a></td>
{.if|{.get|can delete.}|<td class=rw align=center><form method='post' id='filelist'><input type='hidden' name='selection' value='%item-url%'><input type='submit' name='action' value='delete' onclick='return confirm("Delete file?")' ></form></td>.}
</tr>

[file.mp4 = file.m4v = file.mkv = file.flv = file.avi = file.wmv = file.webm]
<tr>
<td class=rw>%new% <a href="%item-url%">&nbsp;<font color="teal" size="3">&#127909;</font>&nbsp;%item-name%</a></td>
<td class=rw align=center>%item-size%</td>
<td class=rw align=center>%item-modified%</td>
{.if|{.get|can delete.}|<td class=rw align=center><form method='post' id='filelist'><input type='hidden' name='selection' value='%item-url%'><input type='submit' name='action' value='delete' onclick='return confirm("Delete video?")' ></form></td>.}
</tr>

[file.jpg = file.jpeg = file.png = file.gif = file.tif = file.bmp = file.webp]
<tr>
<td class=rw>%new% <a href="%item-url%">&nbsp;<font color="orange" size="3">&#128247;</font>&nbsp;%item-name%</a></td>
<td class=rw align=center>%item-size%</td>
<td class=rw align=center>%item-modified%</td>
{.if|{.get|can delete.}|<td class=rw align=center><form method='post' id='filelist'><input type='hidden' name='selection' value='%item-url%'><input type='submit' name='action' value='delete' onclick='return confirm("Delete photo?")' ></form></td>.}
</tr>

9
Classic elegance, some new features, and a lot more speed. . .
Tested with HFS 2.3k 

Features:
Phone/Tablet viewport tag included, for the phone screen.

Much faster file listings in lengthy folders because there's no slow checkboxes.  The delete function can be provisioned for a folder (see the next post), and that method runs faster than a site-wide provision.

Automated error correction for users.  When needed, it displays very polite messages briefly, and then quickly sends the user back to what they wanted to do.  It maintains the appearance of good working order.  So, you're free to use options like the "max connections" and "maximum simultaneous downloads from single address" limits to manage your bandwidth. 

Quickly disconnects hack scans; and that feature lowers the cpu load, improving speed.

Mp3 streaming for PC via mms link that actually says MediaPlayer

Easy for users, with simplified interface, column layout, black background, and readable fonts.  Classic! 

Cat-operable on a tablet, apparently.

Efficient and colorful unicode icons displays file listings twice as fast.

Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<title>HFS %folder%</title><style type="text/css">%style%</style>
<script type="text/javascript" language="javascript">function browseAbleFolderTree(folder) {var infoFolder=folder;var path=folder.split("/");var pathTree="/";var pathTreeResult="";for(pta=1;pta<path.length;pta++) {pathTree=pathTree+path[pta]+"/";pathTreeResult=pathTreeResult +'/<a href="'+pathTree+'" class=\"swapDir\">'+path[pta]+'</a>';}document.getElementById('swapDir').innerHTML = pathTreeResult;}</script>
</head><body>
<div>
%upload-link%
%login-link%%loggedin%
<div class=lil><b>Current Directory:</b></div>
<div class=big><a href="/">Home</a><span id=swapDir>%folder%</span><script type="text/javascript" language="javascript">browseAbleFolderTree("%folder%")</script></div>
<div class=body>%folder-comment%%files%</div>
</div>
</body></html>

[login-link]
<div class=btn><a href="%encoded-folder%~login" class=inbtn><font color="yellow">&#128100; CLICK HERE TO LOG IN</font></a></div>

[loggedin]
<div class=btn><span class=inbtn>&#128100; %user%</span></div>

[style]
body{padding:3px;font-weight:normal;font-family:"Arial Unicode MS","Lucida Sans Unicode","DejaVu Sans","geneva",arial,"helvetica",sans-serif;background:black;margin:3}
.rw,.body,.inpt,.flg,.cmnt,th,comment,.flg,.inbtn,.col{background:#000}
.col,body,.rw,.body,#hm{color:#AAA}
body,.big,.lil,th,comment{font-size:9pt}
.inbtn{font-size:12pt}
.inpt,.flg,.cmnt,a,body,.inbtn,th,comment,.flg,.lil{color:#8D8}
.big{font-size:14pt}
.flg,.inbtn,.col,.rw,a,.big{font-weight:normal}
a{font-size:14pt}
.flg,.lil{font-size:8pt}
.inbtn,.body{border:3px solid #222}
.btn,.body{padding:15px}
.body{padding-right:9px}
.body{margin:15px}a{text-decoration:none}
a:visited{color:#CCC}
a:hover{color:yellow}
img{border:0}
.rw{font-size:11pt;border:2px solid #222}
.cmnt{font-size:7pt;padding:3px;margin-top:2px}
.inpt,.cmnt{border:1px inset #000}
.col{font-size:13pt}
.inbtn{padding:5px}
.btn{float:right}
.flg{text-align:center;border:1px solid;}

[upload-link]
<div class=btn><a href="%encoded-folder%~upload" class=inbtn><b><font color="yellow">&#8679; &nbsp;CLICK HERE TO UPLOAD FILES</font></b></a></div>

[up]

[nofiles]

[files]
<table class=lil width=100%>
<tr>
<td><b>%number-folders% Folders, %number-files% Files - Total Size: %total-size%</td>
<td align=right><b>At %timestamp%  %speed-out%/%number-addresses-downloading%KB</b></td>
</tr>
</table>
<table width="100%">
<tr>
<th class=col><a href="%encoded-folder%?sort=n" style="color:#AAA;font-size:14px;">FileName</a></th>
<th class=col><a href="%encoded-folder%?sort=s" style="color:#AAA;font-size:14px;">Size</a></th>
<th class=col><a href="%encoded-folder%?sort=t" style="color:#AAA;font-size:14px;">Date</a></th>
<th></th>
</tr>
%list%
</table>

[file]
<tr>
<td class=rw>%new%<a href="%item-url%">&nbsp;<font color="white">&#9671;</font>&nbsp;%item-name%</a></td>
<td class=rw align=center>%item-size%</td>
<td class=rw align=center>%item-modified%</td>
</tr>

[file.mp3 = file.m4a = file.wma = file.flac = file.ogg]
<tr>
<td class=rw>%new%<a href="%item-url%">&nbsp;<font color="#ADE8F9">&#9836;</font>&nbsp;%item-name%</a></td>
<td class=rw align=center>%item-size%</td>
<td class=rw align=center><a href="mms://%host%%encoded-folder%%item-url%">MediaPlayer</a></td>
</tr>

[file.mp4 = file.m4v = file.mkv = file.flv = file.avi = file.wmv = file.webm]
<tr>
<td class=rw>%new% <a href="%item-url%">&nbsp;<font color="teal" size="3">&#127909;</font>&nbsp;%item-name%</a></td>
<td class=rw align=center>%item-size%</td>
<td class=rw align=center>%item-modified%</td>
</tr>

[file.jpg = file.jpeg = file.png = file.gif = file.tif = file.bmp = file.webp]
<tr>
<td class=rw>%new% <a href="%item-url%">&nbsp;<font color="orange" size="3">&#128247;</font>&nbsp;%item-name%</a></td>
<td class=rw align=center>%item-size%</td>
<td class=rw align=center>%item-modified%</td>
</tr>

[link]
<tr>
<td class=rw>%new%<a href="%item-url%">&nbsp;<font color="pink">&#8663;</font>&nbsp;%item-name%</a>%comment%</td>
<td class=rw><i>&nbsp;Hyperlink</i></td>
<td></td>
</tr>

[folder]
<tr>
<td class=rw>%new%<a href="%item-url%">&nbsp;<font color="#FFFDA8" size="3">&#128193;</font>&nbsp;<b>%item-name%</b></a></td>
<td class=rw align=center><i>Folder</i></td>
<td class=rw align=center>%item-modified%</td>
</tr>

[comment]
<div class=cmnt>%item-comment%</div>

[folder-comment]
<div class=cmnt>%item-comment%</div>

[error-page]
{.if|{.match|*.php*;*.js|%url%.}|{:{.disconnect.}:}.}{.add header|Cache-Control: no-cache, max-age=0.}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8">%content%</html>

[not found]
<META HTTP-EQUIV="Refresh" CONTENT="2;URL=/"><TITLE>404</TITLE><body bgcolor="black" text="white" alink="white" link="white" vlink="white">
<center><h2><br>You have found the 404 page.</h2>Redirecting.</center></body>

[overload]
<META HTTP-EQUIV="Refresh" CONTENT="3;URL=./"><TITLE>Overload</TITLE><body bgcolor="black" text="white" alink="white" link="white" vlink="white">
<center><h2><br>High traffic mode engaged.</h2>Returning to previous page after overload has cleared.</center></body>

[max contemp downloads]
<META HTTP-EQUIV="Refresh" CONTENT="2;URL=./"><TITLE>Downloads</TITLE><body bgcolor="black" text="white" alink="white" link="white" vlink="white">
<center><h2><br>There are ongoing downloads.</h2>More available <i>after</i> current downloads finish.</center></body>

[unauthorized]
<META HTTP-EQUIV="Refresh" CONTENT="3;URL=./"><TITLE>Login</TITLE><body bgcolor="black" text="white" alink="white" link="white" vlink="white">
<center><h2><br>You're not logged in.</h2>Name and password do not match.<br><br>If there's no login, try a different<br>browser for your phone.</center></body>
{.if|%user%|{:{.set|n|{.from table|#tries|%ip%.}.}{.inc|n.}{.if|{.{.^n.} > 20.}|{:{.set ini|{.no pipe|ban-list={.from table|#ini|ban-list.}%ip%#attack? {.time.}|.}.}{.set table|#tries|%ip%=0.}:}|{:{.set table|#tries|%ip%={.^n.}.}:}/if.}:}.}

[deny]
{.redirect|/.}

[ban]
{.disconnect.}

[upload]
<html><head>
<title>Upload to: %folder%</title><style type="text/css">%style%</style>
<script type="text/javascript" language="javascript">var counter = 0;function addUpload() {counter++;if (counter < 7) document.getElementById("addupload").innerHTML += "<br><input name=\"fileupload"+counter+"\" size=\"50\" type=\"file\">";if (counter == 6) {document.getElementById("addUploadLink").innerHTML = "<a style=\"cursor:text;color:yellow;\">- PLEASE PUT MULTIPLE FILES INTO A ZIP FILE -</a>";}}</script>
</head><body>
<div class=btn><span class=inbtn>&#128100; %user%</span></div>
<div class=lil><b>Upload to:</b></div>
<div class=big><a href="/" target=_parent class=swapDir>Home</a>%folder%</div>
<div class=body>
<center>
<b>Free Space Available For Upload: %diskfree%</b><br><br>
<form action="%encoded-folder%" target=_parent method=post enctype="multipart/form-data" onSubmit="frm.upbtn.disabled=true; return true;"><div id=addupload><input name="fileupload1" size=50 type=file></div><a id=addUploadLink style="cursor:pointer;" onclick="addUpload();">- Add Upload -</a><br><br><input name=upbtn type=submit value="Upload Selected File(s)"></form>
</center>
</div>
</body></html>

[upload-results]
<html><head>
<title>Upload results for: %folder%</title><style type="text/css">%style%</style>
</head><body>
%loggedin%
<div class=lil>Upload results for:</div>
<div class=lil>%folder%</div><div class=body>%uploaded-files%<br><br><a href="%encoded-folder%" target=_parent class=big><font color="yellow">&#8678; Go Back</font></a></div>
</body></html>

[upload-success]
<li><b>SUCCESS!</b> Uploaded: %item-name% --- %item-size% (Speed: %speed% KB/s)

[upload-failed]
<li><b>FAILED!</b> Error while uploading: %item-name%: --- %reason%

[newfile]
&nbsp;<span class=flg>&nbsp;NEW&nbsp;</span>

10
in hfs.events (alt+f6)

[+request]
{.if|{.match|*.gif;*.ico;/*img*|%url%.}|{:{.add header|Cache-Control: public, max-age=31536000.}{.add header|Vary: Accept-Encoding.}:}.}

This is functionally similar to Apache .htaccess
Only the file extensions specified have been cached by the browser.

Tip:
If you decide to cache a wider variety of file extensions, it may be useful to add the reversal command {.add header|Cache-Control: no-cache, max-age=0.} into the template at the [error-page] section, so as to reduce persistence of redirects.

11
HTML & templates / Re: build 299, still trying to log in, from a phone
« on: April 29, 2018, 04:06:59 PM »
Your photo shows the built-in login page of a PC's web browser.  Neither the majority of android devices nor hfs have a built-in login page.  Then login is not possible, because the default landing page is the [Unauthorized] error message. 
Actually, instead of stuck at an error message forever, the [Unauthorized] section should be a login form. 
How do we accomplish that?

12
HTML & templates / Re: build 299, still trying to log in, from a phone
« on: April 28, 2018, 06:27:36 AM »


Most phones and tablets land at the [unauthorized] page, so it would be nice to replace that with a login form. 

13
HTML & templates / build 299, still trying to log in, from a phone
« on: April 27, 2018, 03:56:23 PM »
How do I get a working login page?  (as in page)?

A large number of android devices require an HTML login page, quite like this (Except this one doesn't work):
Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title>Login</title><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"><META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE, MAX-AGE=0"><meta name=viewport content="width=auto, user-scalable"><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head><body style="overflow:hidden" bgcolor=#151B54 text="white" alink="white" link="white" vlink="white"><table border="0" align="center" cellpadding="0" cellspacing="0" height="100%"><TR><TD valign="middle" align="center" style="vertical-align:center">
<div class="login" style="vertical-align:center"><font size=6>

      <h3>Log in to HFS</h3>
      <form method="post">
      Name<br>
      <input type="text" name="user" style="font-size:22"><br><br>
      Password<br>
      <input type="text" name="password" style="font-size:22"><br><br>
      <input type="submit" value="Login" style="font-size:28"><br>
      </form>

</font><><div>&nbsp;<></TD></TR></table></body></html>
Assuming:
web root has no password, no browse
The login html file is /index.html
/Files/ is password protected

Should this standard feature be working, or is there a script alternative available to run?   Halp

Pages: [1]