rejetto forum

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 2 3 4 ... 15
16
If you have the movies in generally browser-compatible basic mp4, then the movie playback is made simple (with the built-in HTML5 player which is in every up-to date browser).   

The trouble is that .mkv, hevc, x265 types may need to be Transcoded to simpler .mp4 (any format that browsers can play natively); and you'd need a movie data-rate (perhaps in the range of  600 to 800 kbits) that doesn't swamp your connection.  But, after the hurdle is cleared, native playback can make the rest of the job much easier. 

The good news is that 'most' of the files are probably browser-compatible already. 

For a conservative data-rate with .mp4, you'd want to crop to 16:9 before/while transcoding so that quality of the viewable area is maximized--particularly, it is the wide-screen movies that need to be cropped to fit so they still look good after transcoding to .mp4 (of conservative size).

P.S.  When I try this with the easy-to-use Stripes template, compatible movie files open in the browser (when HFS is set to open mp4 type in browser:  menu > other > open directly in browser).   See also mime types menu. 

17
It looks like an expansion of the typical feature of web and ftp servers--the ability to set webroot to a real folder (folder is C:\web (example) but link is /).  The values are stored in web server's data file.  HFS has this, except more capacity to store more links. 

18
HFS ~ HTTP File Server / Re: problem with config ini file
« on: May 11, 2021, 01:39:18 PM »
Try this method:  http://rejetto.com/forum/index.php?topic=13448.msg1066927#msg1066927
 At HFS console, press F7, and add user accounts there first.

19
HFS ~ HTTP File Server / Re: "username not found"
« on: May 11, 2021, 04:44:12 AM »
...When I try to access a folder...
I wonder if the login script of the Stripes template would do differently?  That was recently revised to go into the folder. 

P.S.
If that doesn't do it, next step after, would be reset hfs settings (menu > save options > clear options) and then save settings to file (menu > save options > to file), and then put the usernames back in.  EDIT: At HFS console, press F7 and add user accounts there first.
If you went back-and-forth between HFS2.3 and HFS2.4, then it is possible that the VFS has a glitch (to clear it, menu > clear file system). 

P.P.S.  One place to make a real folder is a bit hidden.  That is the root of VFS (house icon)--right click and bind to real folder (usually just a new empty folder on the hard drive).  I just mentioned that because it helps the speed if all folders are real folders. 

20
HFS ~ HTTP File Server / Re: Changing HTTP response header
« on: May 09, 2021, 03:32:15 PM »
Here is the events file that I use to cause caching
At hfs console, press Alt+F6 to edit events file
Code: [Select]
[+request]
{.if|{.match|*.jpg;*.JPG;*.jpeg;*.gif;*.png;*.ico;*.mp3;*.mp4;*.mkv;/*img*;*.js|%url%.}|{:{.add header|Cache-Control: public, max-age=604800.}{.add header|Vary: Accept-Encoding.}:}.}

for no cache {.add header|Cache-Control: no-cache, max-age=0.}

21
...the file can be only accessed by a specific IP...
At HFS console, press alt+f6 to edit events file, and add this:
Code: [Select]
[download]
{.if|{.match|myparticularfile.doc|%url%.}|{:{.if|{.!=|%ip%|127.0.0.1.}|{:{.disconnect.}:}.}:}.}
replace  myparticularfile.doc  with target file name (to block for most)
replace  127.0.0.1  with target IP address (to allow for one)

P.S. Other options instead of  myparticularfile.doc may be /folder* or *.doc and you can even add to the list, such as myparticularfile.doc;myotherfile.txt;*.pdf with semicolon in-between. 

P.P.S. If this method seems clunky, then you could use the more normal and flexible users/groups/passwords, located in hfs menu > other options > user accounts.  And, then you can right-click on a particular folder/file to set it private to your users/groups. 

22
Programmers corner / Re: Template/events for QOS or traffic shaping.
« on: April 29, 2021, 03:01:40 PM »
...a variable is defined by its name which can include letters or numbers and preceded by # to become a global variable
just include %ip% in the name
{.set|#flag_%ip%| ....   .}
Thanks Mars! 

23
It works:
Code: [Select]
[+]
{.if|{.!=|%ip%|127.0.0.1.}|{:{.disconnect.}:}.}

24
Programmers corner / Re: Template/events for QOS or traffic shaping.
« on: April 28, 2021, 02:23:15 PM »
@Mars
For QOS purpose, I had few questions...

Are there some per ip-specific measurements?
How to make global variable apply to only 1 ip? 

something like these:?
connections_this_ip
active_downloads_this_ip
set or get #^flag_this_ip

Some templates have extra features (such as thumbnails) that are not good in high-load conditions.  It is good to make a bypass macro to temporarily streamline the template (without extras) to lighten the load.  If global measure is used for traffic shaping, then 1 miscreant affects everyone (this is anti-QOS); so, for QOS function, it may be better if feature-bypass macro targeted the specific overdoing IP address. 
I don't know; but, if the per-ip measures are available, then I could test it. 

25
Programmers corner / Re: Template/events for QOS or traffic shaping.
« on: April 25, 2021, 05:48:20 AM »
How do you like it?
Code: [Select]
[not found]
{.add header|Cache-Control: no-cache, max-age=0.}{.if|{.=|{.cut|-1||%url%.}|/.}
|{:{.redirect|../.}:}
|{:{.redirect|/~404?path={.encodeuri|{.filepath|%url%.}.}.}:}.}
[404|public]
<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<META HTTP-EQUIV="Refresh" CONTENT="1;URL={.decodeuri|{.urlvar|path.}.}"><TITLE>404</TITLE><link rel="icon" href="data:,">
</head><body><center><h2><br>File Not Found.</h2>Returning to previous page...</center></body></html>
For missing Folder, a valid folder is quickly found.  (the user is not lost)
For missing File, right-click+save-as does Not generate a corrupt file. (browser has 404.htm)

A complete set of quality-control error pages, can be found in the Throwback and Stripes templates. 
Thanks to Mars and Naitlee

26
HTML & templates / The Throwback template. Updated!
« on: April 23, 2021, 02:04:48 PM »
The new files are available at Post#1
(previous version was put into historic.zip)

For Throwback14v6:
+ Icon update so that the features are easier
+ New error-redirection pages for file integrity
+ HFS2.4 version login gets the right target
+ More responsive on phone/tablet screens
+ Photoviewer/slideshow has image file name
+ Musicplayer: mp3, m4a, ogg, aac, wma, flac
+ More ondemand & Less RQ load = even faster
+ Compressed javascript for some data savings
+ Navigation caching for HFS2.3 and HFS2.4 too 

Do feel free to comment...

27
... it's always much better to attach files here than hosting on external links (since an external file can expire or be removed by external factors).
So, true!  Another lost external link is bmartino1's updates to the Live theme. 

28
I've no idea why you couldn't post a link from github.  Perhaps it is a new-user hazing filter? 
Looks like the attachments worked.  Welcome to the forum!

29
Stripes 4.6
Updates include:
Automatic sizing for the phone screen
download integrity in error-mitigation
2.4 login script,  gets the clicked folder
streamlined,  for efficient data savings
written cleaner for easier customizing

30
Beta / login hits the right target
« on: April 15, 2021, 03:01:41 PM »
new login script
Code: [Select]
[login|public]
{.if|{.match|*.php*;*.js;*.py;*.vbs*;*.exe|%url%.}|{:{.disconnect.}:}.}{.add header|Cache-Control: no-cache, max-age=0.}<!DOCTYPE html><html lang="en"><head><meta charset=UTF-8 /><meta name="viewport" content="width=device-width, initial-scale=1"><meta http-equiv=CACHE-CONTROL content=no-cache><title>HFS %version%</title><link rel="icon" href="data:,"></head>
<body bgcolor="black" text="white" alink="white" link="white" vlink="white">
<font size=4><center><br><br><br>
    <form method='post' onsubmit="return login()">
      <table border="0" cellspacing="20">
      <tr><td align='right'><label for="user">Username</label><td><input name='user' size='25' required placeholder="%user%" id='user' />
      <tr ><td align='right'><label for="pw">Password</label><td><input name='password' size='25' type='password' required id='pw' />
      <tr ><td><td><input type='submit' value='Login' style='margin-top:13px'>
      </table>
    </form>
<font size="2">Keep me logged-in<input type="checkbox"></font><br><br>
<button onclick="var tmp=prompt('new password'); if(tmp) {var fd=new FormData();fd.append('new',tmp);fd.append('token','{.cookie|HFS_SID_.}');fetch('/~ajax.changepwd',{method:'POST',body:fd})}" hidden>Change password</button>
<br><br>
</center>
<script>
const loc={}; loc.Logout='Logout'
var sha256 = function(s) {return SHA256.hash(s)}
function logout() {fetch("/?mode=logout").then(res => location.reload()); return false;}
function login() {
    var sid = "{.cookie|HFS_SID_.}"  //getCookie('HFS_SID');
    if (!sid) return true;  //let the form act normally
    var usr = user.value;
    var pwd = pw.value;
var xhr = new XMLHttpRequest();
xhr.open("POST", "/?mode=login");  // /~login
var formData = new FormData();
formData.append("user",usr)
if (typeof SHA256 != 'undefined') formData.append("passwordSHA256",sha256(sha256(pwd).toLowerCase()+sid).toLowerCase()); else formData.append("password",pwd)
xhr.onload=function(){if(xhr.response=='ok') {
 if(document.querySelector("input[type=checkbox]").checked) localStorage.login=JSON.stringify([usr,pwd]); else localStorage.removeItem('login');
 location.replace({.if|{.match|*~login|%url%.}|{:document.referrer:}|{:"%encoded-folder%":}.})} else {alert("user or password don't match");document.querySelector("form").reset();location.reload(true)}}
xhr.send(formData)
    return false;
}
if(localStorage.login) document.querySelector("input[type=checkbox]").checked=true  //stop keep logged-in: call /~login and disable "Keep me logged-in"
document.querySelector("input[type=checkbox]").onchange=function(){if(!this.checked) localStorage.removeItem('login')}
if('%user%') {document.querySelector("input[type=submit]").value=loc.Logout; document.querySelector("input[type=submit]").onclick=function(){logout(); return false}; document.querySelector('button').hidden=false}
if(!'%user%' && localStorage.login) {
var tmp=JSON.parse(localStorage.login)
user.value=tmp[0]
pw.value=tmp[1]
var myform=document.querySelector("form"); if (myform.requestSubmit) myform.requestSubmit(); else myForm.submit()
} </script> <script src="/~sha256.js" onerror="setTimeout(()=> this.src='/~sha256.js',181)"></script>

[ajax.changepwd|public|no log]
{.check session.}{.break|if={.not|{.can change pwd.}.} |result=Forbidden (0).}{.if|{.length|{.set account||password={.postvar|new.}.}/length.}|OK (1)|Failed (2).}

[unauth]
{.redirect|/~login.}
if you clicked on a login link, then after login it goes back to where you had clicked
if you clicked on a passworded folder, then after login it goes Into the expected folder


Compact version: 
Code: [Select]
[login|public]
{.if|{.match|*.php*;*.js;*.py;*.vbs*;*.exe|%url%.}|{:{.disconnect.}:}.}{.add header|Cache-Control: no-cache, max-age=0.}<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"><meta http-equiv=CACHE-CONTROL content=no-cache><title>login</title><link rel="icon" href="data:,"></head>
<body bgcolor="black" text="white" alink="white" link="white" vlink="white"><font size=4><center><br><br><br>
<form method='post' onsubmit="return login()">
<table border="0" cellspacing="20">
<tr><td align='right'><label for="user">Username</label><td><input name='user' size='25' required placeholder="%user%" id='user' />
<tr><td align='right'><label for="pw">Password</label><td><input name='password' size='25' type='password' required id='pw' />
<tr><td><td><input type='submit' value='Login' style='margin-top:13px'>
</table></form>
<font size="2">Keep me logged-in<input type="checkbox"></font><br><br>
<button onclick="var tmp=prompt('new password'); if(tmp) {var fd=new FormData();fd.append('new',tmp);fd.append('token','{.cookie|HFS_SID_.}');fetch('/~ajax.changepwd',{method:'POST',body:fd})}" hidden>Change password</button><br><br></center></font>
<script>const loc={Logout:"Logout"};var sha256=function(e){return SHA256.hash(e)};function logout(){return fetch("/?mode=logout").then(e=>location.reload()),!1}function login(){var e="{.cookie|HFS_SID_.}";var o=user.value,r=pw.value,t=new XMLHttpRequest;t.open("POST","/?mode=login");var n=new FormData;return n.append("user",o),"undefined"!=typeof SHA256?n.append("passwordSHA256",sha256(sha256(r).toLowerCase()+e).toLowerCase()):n.append("password",r),t.onload=function(){"ok"==t.response?(document.querySelector("input[type=checkbox]").checked?localStorage.login=JSON.stringify([o,r]):localStorage.removeItem("login"),location.replace({.if|{.match|*~login|%url%.}|{:document.referrer:}|{:"%encoded-folder%":}.})):(alert("user or password don't match"),document.querySelector("form").reset(),location.reload(!0))},t.send(n),!1}
localStorage.login&&(document.querySelector("input[type=checkbox]").checked=!0),document.querySelector("input[type=checkbox]").onchange=function(){this.checked||localStorage.removeItem("login")};
if('%user%') {document.querySelector("input[type=submit]").value=loc.Logout; document.querySelector("input[type=submit]").onclick=function(){logout(); return false}; document.querySelector('button').hidden=false}
if(!'%user%' && localStorage.login) {var tmp=JSON.parse(localStorage.login); user.value=tmp[0]; pw.value=tmp[1]; var myform=document.querySelector("form"); if (myform.requestSubmit) myform.requestSubmit(); else myForm.submit(); }</script>
<script src="/~sha256.js" onerror="setTimeout(()=> this.src='/~sha256.js',181)"></script></body></html>

[ajax.changepwd|public|no log]
{.check session.}{.break|if={.not|{.can change pwd.}.} |result=Forbidden (0).}{.if|{.length|{.set account||password={.postvar|new.}.}/length.}|OK (1)|Failed (2).}

[unauth]
{.redirect|/~login.}
The compact version is caching-compatible so that you can go from/to cached content without confusing the login/logout buttons. 

Pages: 1 2 3 4 ... 15