Author Topic: The really fast Throwback (retro) template. Large folders and phones? No problem  (Read 24983 times)

0 Members and 2 Guests are viewing this topic.

Offline danny

  • Tireless poster
  • ****
  • Posts: 192
    • View Profile
    • Startfetch
...is there a way to delete the auto-refresh on main page? I didnt' find the code about this thing.. I wanna maintain for upload, deny, unauthorized ecc.. but not from main page, how can i do? (i will post my little fork if someone could need :) )

Hideroot:
You could make a folder, such as C:\web, and another folder C:\web\files.  Set C:\web as root.  Then you'd put the login landing spot to /files.  Now, at /files, set browsing to on, and at /, set browsing to off.  Nobody finds /files unless they log in.  To finish up, put index.html (handmade "cover page") in C:\web.  Relevant settings are in the virtual file system, except login redirect is in users menu area.  Bonus:  non browsable  /  defeats bots, because they can't see your subdirectory /files.   

-And/Or-

Caching:
In hfs, press alt+f6 (or you can make  events.hfs  in the same folder as  hfs.exe  ).  And, paste this:
Code: [Select]
[+request]
{.if|{.match|*.jpg;*.jpeg;*.gif;*.png;*.ico;*.mp3;/*img*|%url%.}|{:{.add header|Cache-Control: public, max-age=4000000.}{.add header|Vary: Accept-Encoding.}:}.}
You can adjust the filemasks to set what the clients will cache.  And, for how long, the time is in seconds.  To cache the root for a long time, replace filemask  img  with  .   in the code above.
Bigger version:
Code: [Select]
[+request]
{.if|{.!match|*.jpg;*.jpeg;*.gif;*.png;*.ico;*.mp3;*.mp4;*.js;*.mkv;/*img*|%url%.}|{:{.add header|Cache-Control: public, max-age=200.}:}|{:{.remove header|Set-Cookie.}{.add header|Cache-Control: public, max-age=4000000.}{.add header|Vary: Accept-Encoding.}{.add header|Expires: Mon, 03 Jan 2028 1:00:00 GMT.}:}.}
Filemask items cached for a long time, but everything else cached for 200 seconds. 
« Last Edit: October 31, 2019, 10:21:10 PM by danny »

Offline stibuz95

  • Occasional poster
  • *
  • Posts: 4
    • View Profile
Ok, i think i'm really near to my objective :D
I found the line that causes page-refresh, now i wanna that this line (better to say script) is executed only if i'm not in a Specific Page. This is the code i have, i didnt understand really good if statements in this tpl language, what i can modify? (Really thanks in every case!!)
Code: [Select]
[nofiles]
{.if|{.%connections% < 50.}|{:<table class="lil" width="100%" bgcolor="#CCCCCC"><tr style="font-size:7pt">
<td align="left"><form class=hide name=searchForm method=GET action="javascript:searchQuery()"><input style="padding:0;border:1;height:18px;background-color:#F5FDF6" placeholder="Search files" type=input name=query size=23 maxlength=32><input style="padding:0,1,0,1;border:0;height:21px;vertical-align:-0.8px;" type=submit name=searchBtn value="&#128269;"><input type=hidden name=choice value="file"><input type=hidden name=choice value="folder"><input type=hidden name=choice value="both" checked=1><input type=hidden name=recursive checked=1><input type=hidden name=root value="root"><input type=hidden name=root value="current" checked=1></form></td>
<td align="right"><div style="padding:0px;float:right;height:14pt"><nobr><a href="%encoded-folder%~upload" class=inbtn><b><font color="green">&#8679;&nbsp;Upload Files</font></b></a></nobr></div></td></tr></table>{.if|{.get|can upload.}|{:<marquee scrolldelay="100"><a id="mar" href="https://mysite.net:8920" target="_blank">StepFlix Server</a></marquee>:}.}:}.}
if(window.location.href != "https://mysite.net") {<script>setTimeout(function () {window.location.href= '../'; }, 2000);</script>}

Edit:
Ok i did the trick but i dont' know it is the better way. I've added this line into the [nofiles] section, that the page has to refresh on the latest good dirrectory.
Code: [Select]
{.if|{.match|*recursive*|%url%.}|<script>setTimeout(function () {window.location.href= '../'; }, 2000);</script>.}
« Last Edit: October 31, 2019, 10:29:49 AM by stibuz95 »

Offline stibuz95

  • Occasional poster
  • *
  • Posts: 4
    • View Profile
If someone need the fantastic Throwback template with these little changes:
a) put some headers to try to obfuscate the site from google's bot and similar
b) Put the Login-Text near the "sign-in"-button (i think its more readable)
c) Modified the HTTP FS <marquee> with my own useful site (i use Emby as media server, so i put the link to it)
c bis) search "yoursite" to modify
d) Added a line in [no files] section (that is active when there are no accessible file in directory, in my case when nobody is logged too) that do the refresh on page only if in the url name there is "recursive" word that it's in the address every time u do a search. The nice thing is that if your search is TRUE, u automatically will be out [no files] section, so the refresh script will not start :D

I hope could be useful for someone :)

Offline danny

  • Tireless poster
  • ****
  • Posts: 192
    • View Profile
    • Startfetch
Thank you very much!!!
I have re-uploaded Throwback 12 files, with a replacement [nofiles] section: 
Code: [Select]
[nofiles]
{.if|{.%connections% < 50.}|{:{.if|{.get|can upload.}|{:<table class="lil" width="100%" bgcolor="#CCCCCC"><tr><td align="center"><a href="%encoded-folder%~upload" class=inbtn><b><font color="green">&#8679;&nbsp;Upload Files</font></b></a></td></tr></table>:}.}:}.}
{.if|{.match|*recursive*|%url%.}|{:<a href="%encoded-folder%" style="text-decoration:none;color:yellow"><br>&#8678; Back</a>:}|{:<a href="../" style="text-decoration:none;color:yellow"><br>&#8678; Back</a>{.if not|%user%|{:<a href="%encoded-folder%~login" style="color:lightgray;float:right">Log in &#8680;</a>:}.}:}.}
This new replacement section gets the right target with dynamic links (no refresh).  Thanks for the ideas!!

P.S.  If you populate the virtual file system, VFS, with files folders, etc. . . then you won't see the nofiles page, except for empty-folder or search-not-found.  Perhaps add a link (in the VFS) to where your files are located; and, if that is a password protected area, then login prompt is automatic.
« Last Edit: November 10, 2019, 11:46:13 AM by danny »