rejetto forum

Recent Posts

91
HTML & templates / Re: Stripes, the template for simple and easy. Update Surprise!!
« Last post by danny on April 15, 2021, 05:07:59 PM »
Stripes 4.6 is available in classic black; or, modern light color scheme.

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
92
Beta / login hits the right target
« Last post by danny 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. 
93
HTML & templates / Re: Responsive small screen template
« Last post by danny on April 15, 2021, 09:40:49 AM »
Thanks! 
Code: [Select]
var ext='a[href$=".mp3" i],a[href$=".ogg" i],a[href$=".m4a" i],a[href$=".flac" i],a[href$=".wma" i],a[href$=".aac" i]'
94
HTML & templates / Re: Responsive small screen template
« Last post by dj on April 15, 2021, 04:21:29 AM »
Adding an i before the closing bracket causes the value to be compared case-insensitively
a[href$=".mp3" i]
95
HTML & templates / Re: Responsive small screen template
« Last post by danny on April 15, 2021, 01:32:54 AM »
Does javascript have a case-blind option, or does it need something like this?:
Code: [Select]
var ext='a[href$=".mp3"],a[href$=".Mp3"],a[href$=".MP3"],a[href$=".ogg"],a[href$=".OGG"],a[href$=".m4a"],a[href$=".M4A"],a[href$=".flac"],a[href$=".FLAC"],a[href$=".wma"],a[href$=".WMA"],a[href$=".aac"],a[href$=".AAC"],a[href$=".mp4"],a[href$=".MP4"]'  //edit here
96
Bug reports / back to 2.3
« Last post by danny on April 15, 2021, 01:11:09 AM »
... revert from 2.4 back to 2.3...
The Virtual File System, VFS, may need to be renewed/replaced. 

For my testing purposes, I had to put HFS2.3 and HFS2.4RC into 2 different folders so as to prevent VFS trouble. 

These may help: 
HFS > Menu > Clear file system
HFS > Menu > Save options > Clear options and quit
Also, right click house icon, bind root to real folder (your new empty folder) and then don't add any virtual folders (use only real folders).

P.S.
I also reverted to HFS2.3, because HFS2.4RC does "please wait server busy" too much (can't adjust?).
97
Bug reports / hfs 2.3 to 2.4 and back to 2.3 again
« Last post by regchan on April 14, 2021, 09:07:51 PM »
ok was testing out new version of hfs and i came across an issue if site has hfs on nd you revert from 2.4 back to 2.3  site refuses to load and says tried to many times 

i close browser totally and reopen site again a few hours later and it works again

 browser chrome latest

but using incognito works fine
98
HTML & templates / Re: Responsive small screen template
« Last post by dj on April 14, 2021, 04:55:46 AM »
Audioplayer(srt) shows srt subtitles (srt to vtt on-the-fly)
99
Bug reports / Re: user account login
« Last post by regchan on April 13, 2021, 10:54:40 PM »
i actually have  my file layout is   
i secure the login section to force the login
and i have a simple webpage as the root directory



url/login/private files


each line is the hierachy
/----myhtml.html
/-----Login -- folder has padlock on it to make user login
/---login-------- > your private files mormally red icon folder
100
HTML & templates / Re: Stripes, the template for simple and easy
« Last post by regchan on April 13, 2021, 08:35:36 PM »
i do have a html page on the front end too though that i have thrown up and works the charm thats why i have connection established also edited the login page too
i didnt feel like trying to remove the background on that theme