Recent Posts

Pages: [1] 2 3 ... 10
1
HTML & templates / Re: Chat for HFS.
« Last post by username1565 on Today at 11:31:34 AM »
Hello again, @LeoNeeson.
I understand what do you mean about signing message in PGPSuite.
You can sign/verify and encrypt/decrypt the small files, this will be base64 encoded, then.
Also you can do signing+encrypt and decrypt+verify. But yeap, I cann't see there, a readable text.

You cann't get only signed message with readable text there, because as you say, there is using another stansard (keybase.io).
For more secure, result not containing open text, and this is encoded or encrypted and added fingerprint + encoding this.

PGPSuite is based on script kbpgp.js (that means, keybase pgp).
To using openPGP, maybe need to write separate OpenPGP.js library.  ::)
But as you say this already exists, and need to integrate and include this.
Maybe this will be easy, but I don't see, in the Internet,
the working HTML-examples, with included openPGP.js:
Quote
OpenPGP.js v1.6.2, v2.6.2 and the latest v3.1.0
and maybe this project for node.js and need server-side module requirements on the node.

And also, at any time, you can yourself do your own fork of this project on github,
download this, rewrite the souce code, and upload new files to your own public branch.

Also, if you want to generate signature only, without encrypting text message (for emailing as example),
and then check signature (verify this message) with leaving readable message - you can using bitcoin signature tool,
for sign and verify readable messages. Other altcoins keys and address - there is available too!
Signing and verify, for not large files, is available there too (as base64 encoded text).

To use this:
1. Generate your own private key, and get address from this key.
For example, I used the message as passphrase to get priv and compressed vertcoin address in next example.
2. Save private key, and address.
3. Sign text or file by private key. You'll see readable message there.
4. Transfer this to someone else, and this can be verified, and will be still readable (if text).

This seems like pgp signature. My example:
Quote
-----BEGIN BITCOIN SIGNED MESSAGE-----
Blah-blah-blah - this is a readable text.
-----BEGIN SIGNATURE-----
VrrZoy5Dc6tPWib4TmchBgkc87mrAJg8Pd
HyVlWz2WoVWuMq6dh5I/MQSHtE2Up/1t1q4JYKPfqSNfZzYENvELoOZ2qBCrjN0TkmYWtITT/GMTcuqub+uEr0U=
-----END BITCOIN SIGNED MESSAGE-----
You can use the text from this message as passphrase in generator tab,
then get private key, and see the address corresponding to this,
but if you will at first, select in right-side list - Vertcoin.
Address will switch to compressed automatically, because Vertcoin have compressed addresses.

This brainwallet, can be hosted in LAN, using HFS! Code is JS+JQuery only. No any server-side software.
If your IP is static, you can tell in email your own permalink to open for your friends the way to verify signature of your messages.
You can also open the port and using static IP, or DDNS, to make this available from Internet.
And of cource you can using TOR + any tor2web services - without using any unstable DDNS services.

Quote
Back about your chat template, perhaps (to implement private rooms) you can take some ideas for inspiration, by looking this project: ZeroBin (where the server has zero knowledge of the stored data). They use URL Hash to exchange a decryption key (the same way Mega.nz does). But it's only an idea or a suggestion, I don't know if it is feasible to implement.
Zerobin seems nice, like jsfiddle.net, codepen.io
and another sites for sharing code notes.
But in the source code this have index.php.
I don't see database, like MySQL, but PHP is a server-side language.
Maybe this can be re-writed as HFS templates using scripting commands, because HFS not working as PHP-server.
I didn't saw intently this code and don't working with this...

URL Hash implies GET-query to the server, and JS can emulate this, like t-addr converter link or permalink in brainwallet,
but JS cann't responce as server and tell any files - because this is client-side language.
Maybe this is possible to using URL Hash, if keep-alive peer connection will be opened,
like this WebRTC file-sharing, for example.
This working in 2 tabs in Chrome (I don't test it in LAN without Internet)...
You can see random ID for each private rooms, p2p connection and peer exchange services (socket.io, or peer.js)
in the source code.

And still... If by using URL Hash, can be created folders on the HFS server,
then can be available opportunity to use this for create folders,
but not temporary folders, because there is no any option for deletion files and folders for anonymous users
(else backdoor for damage any files from anyone).
And maybe private rooms can be realized, using HFS scripting commands, but as separate template or module for this great portable HFS.
I see this option in chat version from DJ (but there is '...' bug).
2
HTML & templates / Re: Responsive small screen template
« Last post by dj on Today at 10:51:18 AM »
V3 comes with a user selectable (dark) theme ⚙
V3.1 remember settings
3
HTML & templates / Re: Simple contact template
« Last post by LeoNeeson on Today at 05:58:28 AM »
alternativ this can also be done without macros
Without macros? How?... (I'm curious)

you can use a form without jquery
Yes, I already know that.

But I was trying to avoid using <form method="GET"></form> at all, if that's possible (that's why I haven't used it).

My mistake, I see that I've uploaded the wrong file. :-[ Now I've uploaded the correct file, but the .txt file is being generated only when the page loads, and not when clicking on the button. Is using a <form method="GET"> the only way to send the data to the server?...
4
HTML & templates / Re: Simple contact template
« Last post by dj on Today at 05:12:51 AM »
you can use a form without jquery (GET or POST)
alternativ this can also be done without macros (done in upload with drag&drop)

update: https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects
5
HTML & templates / Simple contact template
« Last post by LeoNeeson on Today at 03:26:42 AM »
Today I was trying to get working a simple contact template, that automatically save its contents as a local .txt file. To apply this template, follow these steps:

1. Create a folder named, for example as: contact (add it as real folder)

2. Save the code below as a file name with the name: "hfs.diff.tpl" (or download the file).

3. Copy that file (hfs.diff.tpl) to the "contact" (or whatever name you choose) folder you made on the first step.



THIS IS IN A WORK-IN-PROGRESS [ALPHA STATE]
(it currently doesn't work correctly)


My problem here is: I don't know how an alias or a HFS's symbol can read and store in memory the content of a HTML object (like a textbox or an input), the same way a JavaScript variable work. I would like NOT to use a 'form' (postvar) as I would like to keep it as simple as possible (at least in this first revision), and just using plain JavaScript (no jQuery).

The final saved file should look like this:

Private-Message-2018.07.20-at-10.46.36.txt
Code: [Select]
-----[ BEGIN MESSAGE ]-----

Name: John Example
From: <johnexample@gmail.com>
IP Address: 127.0.0.1 (Username: demo)
Date: 2018/07/20 @ 10:46:36 (GMT-07:00)
Subject: This is only a test message...

Message:

Hello! this is working fine! :)

-----[ END MESSAGE ]-----

What I can do to fix it?... :-\
(Suggestions welcome)

Cheers,
Leo.-
6
HTML & templates / Re: Chat for HFS.
« Last post by LeoNeeson on Today at 03:18:49 AM »
@username1565: +1 for all the detailed and technical explanation. :)

- Add an optional 'Send' button (as a fail-over, for old browsers not detecting when the 'Enter' key is pressed).
This is HTML/JS - coding. You can add this yourself using standard form methods. And post the source code in this thread, then. In this case javascript functions can be called by methods form onsubmit="function_name()", and onclick="function_name()" By default, message will be sent after press "enter", according JQuery code //textarea functions...
Thank you, I was using a outdated Chrome version, but it's working fine if I use the latest version. Anyway, my idea was to give wider compatibility among browsers, but only as a suggestion (it's not very important).

After reading all your explanation, I do understand now that's fairly complex to save messages in have another way (not using increment suffix), so, I think it's OK the way it is. About TOR (which I've only tested a few times), I don't know how secure it is, since I've read the last node can read or save everything (but I still think is a great project, since it works like a free VPN but with extra security).

Back about your chat template, perhaps (to implement private rooms) you can take some ideas for inspiration, by looking this project: ZeroBin (where the server has zero knowledge of the stored data). They use URL Hash to exchange a decryption key (the same way Mega.nz does). But it's only an idea or a suggestion, I don't know if it is feasible to implement.



» Very off-topic: I've found on your GitHub repository, your fork of the 'PGP Suite' (based on the 'Keybase OpenPGP') and it's like a dream :) it has everything a PGP Suite should have: Key Generation, Sign, Verify, Encrypt and Decrypt (the only option missing is handling files, like for 'Signing files', but I don't know if that is possible or if it's easy to add). Sadly, nobody I know uses PGP, but I'm sure your fork should be 'the default' option to anyone who wants to use a easy-to-use PGP Suite.

My main interest on the PGP world is for the 'signing' option. Sadly the 'Keybase OpenPGP' code doesn't seem to support 'plain text' signing, like this:


Code: [Select]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

This is a sample message!

-----BEGIN PGP SIGNATURE-----
Version: OpenPGP.js v1.6.2
Comment: http://openpgpjs.org

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxx==
xxxxx
-----END PGP SIGNATURE-----

...but instead gives an encrypted result like this:

Code: [Select]
-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP v2.0.76
Comment: https://keybase.io/crypto

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxx==
xxxxx
-----END PGP MESSAGE-----

...which forces the final user to use PGP to read the message, and my main purpose of 'signing' is only to add extra layer of trust to my messages (along a way to promote PGP), so the main message should be easily be read by any user, even if they don't use PGP. You can check about the kind of 'signing' I'm talking about, here.

I'm not a PGP expert, but in your free time, and just for fun, you can see if it's possible to add in your 'PGP Suite' another PGP 'engines' (using a simple <select> menu), like: OpenPGP.js (v1.6.2 2016-06-08) (to enable support to old/outdated browsers, like for example Chrome 24, and also to enable clear text signing). And if it's easy for you to do, you can include OpenPGP.js v1.6.2, v2.6.2 and the latest v3.1.0, along with the 'Keybase OpenPGP' engine as the default option. That would give people a lot of freedom of choice and would keep backward compatibility (since not always the last version is the best version).

About my PGP usage, you may think is very 'silly' to use PGP only for 'signing', but I think the signing of clear text, it's a great way to promote a wider use of PGP (it's like saying everyone: 'Hey!, I'm using PGP, you can send me a encrypted message if you want', without having to ask every contact if they use PGP or not).


I was born on days where having a Firewall (along an Antivirus) was a must option, but it's sad on how today only a very few people care about security and privacy. So, it's nice to have you in the forum, keep the good work! :)

Cheers,
Leo.-
7
The %item-size% is fast; however, the %item-modified% is problematic.  It would also be cool to use the modern asynchronous (non-blocking) script methods to shorten the anti-phone date format to a phone friendly mm/dd/yy.  That processing can occur on the client, without blocking the server's progress in listing files.
I agree, but it would be nice to have working that modal screen first (then we can choose if include %item-size% or not). But it seems almost nobody tested my 'Throwback7rev1-preview.tpl', so I'll post the code here, so the 'experts' on macro coding have easier way to read it... ;)

Throwback7rev1-preview.tpl
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 bgcolor="black" text="#CCCCCC" alink="#88DD88" link="#88DD88" vlink="CCCCCC">
<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>

<div id="InfoModal" class="modal">
  <div class="modal-content">
    <span class="close">&times;</span>
    <p style="color:black;"><b>Size:</b> %item-size%</p>
    <p style="color:black;"><b>Date:</b> %item-modified%</p>
    <button value=1 class="option_button">Rename</button>
    <button value=2 class="option_button">Delete</button>
    <button value=3 class="option_button" onclick='moveClicked()'>Move</button>
  </div>
</div>

<script>
var modal=document.getElementById("InfoModal"),btn=document.getElementById("MoreInfoBtn"),span=document.getElementsByClassName("close")[0];btn.onclick=function(){modal.style.display="block"},span.onclick=function(){modal.style.display="none"},window.onclick=function(n){n.target==modal&&(modal.style.display="none")};
</script>

<script>
document.querySelectorAll(".option_button").forEach(function(o){o.onclick=function(){window.alert(o.value)}});
</script>

</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:0px;font-weight:normal;font-family:"Arial Unicode MS","Lucida Sans Unicode","DejaVu Sans","Geneva",Arial,"Helvetica",Sans-Serif;background:linear-gradient(90deg,#000,#001825,#000,#000,#000);margin:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-smoothing:antialiased;}
.col,body,.rw,.body,#hm{color:#AAA}
body,.big,.lil,th,comment{font-size:9pt}
.inbtn{font-size:12pt;background:radial-gradient(black,#001825)}
.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}
.flg,.lil{font-size:8pt}
.inbtn{border:1px solid #222;padding:3px}
.btn{padding:3px;float:right}
.body{border:0px;padding:0px;margin:0px}
a{text-decoration:none;font-size:14pt}
a:visited{color:#CCC}
a:hover{color:yellow}
img{border:0}
.rw{font-size:11pt;border:1px solid #222;width:25%;white-space:nowrap;background:radial-gradient(black,#001825)}
.rwi{font-size:11pt;border:1px solid #222;overflow:hidden;word-wrap:normal;white-space:nowrap;background:radial-gradient(black,#001825)}
.cmnt{font-size:7pt;padding:3px;margin-top:2px}
.inpt,.cmnt{border:1px inset #000}
.col{font-size:14px;color:#AAA;text-align:left;}
.flg{text-align:center;border:1px solid;}
.lol{width:90%;white-space:nowrap}
//.del{background:transparent;border:none;color:#A00;font-size:14pt}
.plus{background:transparent;border:none;color:green;font-size:14pt}
.modal{display:none;position:fixed;z-index:1;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:#000;background-color:rgba(0,0,0,.4)}.modal-content{background-color:#fefefe;margin:15% auto;padding:20px;border:1px solid #888;width:50%;text-align:center}.close{color:#aaa;float:right;font-size:28px;font-weight:700}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer}

[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><center>
<table class=lol>
<tr>
<th class=col width="95%"><a href="%encoded-folder%?sort=n" style="color:#AAA;font-size:14px">FileName</a></th
</tr>
%list%
</table></center>

[file]
<tr>
<td class=rwi>%new%<a href="%item-url%">&nbsp;<font color="white">&#9671;</font>&nbsp;%item-name%</a></td>
<td class=rw align=center><button class='plus' id="MoreInfoBtn">&#9776;</button></td>
</tr>

[file.mp3 = file.m4a = file.wma = file.flac = file.ogg]
<tr>
<td class=rwi>%new%<a href="%item-url%">&nbsp;<font color="#ADE8F9">&#9836;</font>&nbsp;%item-name%</a></td>
<!-- <td class=rw align=center><a href="mms://%host%%encoded-folder%%item-url%">&#128266;</a></td> -->
<td class=rw align=center><button class='plus' id="MoreInfoBtn">&#9776;</button></td>
</tr>

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

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

[link]
<tr>
<td class=rwi>%new%<a href="%item-url%" target="_blank">&nbsp;<font color="pink">&#8663;</font>&nbsp;%item-name%</a>%comment%</td>
<!-- <td colspan=2 class=rw><i>&nbsp;Hyperlink</i></td> -->
<td class=rw align=center><button class='plus' id="MoreInfoBtn">&#9776;</button></td>
</tr>

[folder]
<tr>
<td class=rwi>%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>
</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"><meta name="viewport" content="width=device-width, initial-scale=1">%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]
<!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>Upload to: %folder%</title><style type="text/css">%style%</style>
<script type="text/javascript" language="javascript">var counter = 0;function addUpload() {counter++;if (counter < 6) document.getElementById("addupload").innerHTML += "<br><input name=\"fileupload"+counter+"\" size=\"50\" type=\"file\">";if (counter == 5) {document.getElementById("addUploadLink").innerHTML = "<a style=\"cursor:text;color:yellow;\">- PLEASE PUT MULTIPLE FILES INTO A ZIP FILE -</a>";}}</script>
</head><body bgcolor="black" text="#CCCCCC" alink="#88DD88" link="#88DD88" vlink="CCCCCC">
<div class=btn><span class=inbtn>&#128100; %user%</span></div>
<div class=lil><b>Upload to:</b> %folder%</div>
<div class=big><a href="./">&#8678; Back</a></div>
<div class=body>
<center>
<b>Free Space Available For Upload: %diskfree%</b><br><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="Send File(s)"></form>
Results page appears after uploads complete
</center>
</div>
</body></html>

[upload-results]
<!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">
<META HTTP-EQUIV="Refresh" CONTENT="4;URL=./">
<title>Upload results for: %folder%</title><style type="text/css">%style%</style>
</head><body bgcolor="black" text="#CCCCCC" alink="#88DD88" link="#88DD88" vlink="CCCCCC">
%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><font size=3><b>SUCCESS!</b> Uploaded: %item-name% - %item-size% (Speed: %speed% KB/s)</font>

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

[newfile]
&nbsp;<span class=flg>&nbsp;NEW&nbsp;</span>
8
HTML & templates / Re: Chat for HFS.
« Last post by username1565 on July 21, 2018, 12:33:27 PM »
After this all - fix. File - chat.js:
Code: [Select]
line 83: //': ' in message bug - fixed.
//message received.
var nickname = this.responseText.split(': ', 1)[0]; //insert nickname
var message = this.responseText.split(nickname+': ', 2)[1]; //insert message

line 89: //multiply sound elements in HTML code - bug fixed.
//add sound and play this.
if ($("#chatAudio").length) {
$('#chatAudio')[0].play();
} else {
$('body').append($('<audio id="chatAudio"><source src="notify.ogg" type="audio/ogg"><source src="notify.mp3" type="audio/mpeg"><source src="notify.wav" type="audio/wav"></audio>'));
$('#chatAudio')[0].play();
}

line 98: //1000 messages limit with last message in the top - without need scrolling
//display in chat window
var code = '<p>'+'<span>'+nickname+'</span>'+message+'</p>'; //add tags to message
var old_code = document.getElementById('chat-area').innerHTML;
var messages_limit = 1000;
old_code = old_code.split("</p>", messages_limit);
old_code = old_code.join('');
console.log('old_code', old_code);
document.getElementById('chat-area').innerHTML = code+old_code; //display this

Recommend to set messages_limit 100 or 10, because for each message will be working many cycles for largest value.
But if there is many users, they can make a spam, so then need to make this value greather to read needed message.
9
HTML & templates / Re: Chat for HFS.
« Last post by username1565 on July 21, 2018, 10:05:03 AM »
Hello, @LeoNeeson! Thanks for your interest and time for test this.
Quote
- (Bug) if we insert ":" in a message, then any text/word after that is not shown.
This because ":" symbol is the delimiter, you can see this in source code and inside the file content.
As you can see in the source code, delimiter is ": " (":+white_space"), so links with https:// is working, for example.
File with message contains next data: "USERNAME,delimiter,message".
This delimiter can be any symbol, or even dynamic delimiter, as the hash from message, for example.  ;D
We can using special unicode characters, like Zero-width space or another symbol, which will be trimmed or cann't be writed.
Just rewrite this strings in chat.js:
Code: [Select]
//message received.
83: var nickname = this.responseText.split(': ')[0]; //insert nickname
84: var message = this.responseText.split(': ')[1]; //insert message
...
131: name+ ': ';
But I fixed this bug, using this code:
Code: [Select]
//message received.
var nickname = this.responseText.split(': ', 1)[0]; //insert nickname
var message = this.responseText.split(nickname+': ', 2)[1]; //insert message

Also, I see another bug - many sounds elements with id="chatAudio" in the source code in html-page in browser.
This was been fixed by code in last message.


If delimiter will be changed, I see another problem. Anyone can uploading any message with custom delimiter,
then not all messages will be available for each user.
Incrementing message nubmer is automatically for each uploading.
As you can see in the source code, each message saved by POST query, as file with one name "message.txt".

Quote
- Automatically scroll-down messages, so we can always see the last posted message.
You can scroll fasly if you press SHIFT button, and click in the end of scroll bar.
But you are right, it can be automatically.
This is client-side software, and you can do with this source code anything, what do you want.

Just using css-code "overflow: scroll" for div element, and Javascript or jquery scrolling functions.
And... I want to say next for you...
When many messages there is exists in textarea, scrolling functions can lagging...
I tested this JQuery method:
Quote
$('#chat-area').animate({ scrollTop: window_height + chat_height }, 'slow', function (){});
So better way to already see last message, will be next... Just invert message filling in textarea!
Code: [Select]
function get_file(number){...
    xhr.onload = function(){
        ...
        //replase this
        //var code = '<p>'+'<span>'+nickname+'</span>'+message+'</p>'; //add tags to message
//document.getElementById('chat-area').innerHTML += code; //display this
        //to this ->
        var code = '<p>'+'<span>'+nickname+'</span>'+message+'</p>'; //add tags to message
document.getElementById('chat-area').innerHTML = code + document.getElementById('chat-area').innerHTML; //display this in top
    }
}
Now, last message you can always see in the top of textarea, without any scrolling.
As you can see all textarea data will be copying every time when this will be filled.
So you can limit this in this step, for example to see last 100, 1000 messages only and not more than.

For example, in last message, I did set limit as 1000 messages, using split html content by '</p>' delimiter with 100 messages limit.
I did test '<p>' and '</p>' tags inside the messages, and I see all tags is closed autumatically in my browser, without any bugs.

Quote
- Show the number of users online, or even better, have a simple online user list.
There is no any signalling about the status "online".
Maybe, to do this, need to create a separate file, and rewrite this when user authorized,
and correct this, if user is not active within some time limit (not wrote any message).
But any rewrition of file will opening the backdoor to do damage this file from anyone.
I think will be better to using another server-side script, implemented to HFS.

Quote
- Save/remember nickname on a cookie, and allow change nickname when clicking on it.
Is HFS working with cookies? I see only 1 cookie file with HFS_SID in my browser settings.
If cookies can be sent, then you can rewrite the souce code and don't ask username in prompt, if cookie is exists.
I wrote this chat as simple and portable IRC-althernative, to working in TOR.
I have .onion domain and this is better than any DDNS. And as I remember, Tor Browser have strength cookies-policy.

Quote
- Add an optional 'Send' button (as a fail-over, for old browsers not detecting when the 'Enter' key is pressed).
This is HTML/JS - coding. You can add this yourself using standard form methods. And post the source code in this thread, then.
In this case javascript functions can be called by methods form onsubmit="function_name()", and onclick="function_name()"
By default, message will be sent after press "enter", according JQuery code
//textarea functions...
in the file chat.js
I don't know what browsers cann't using JQuery, but this can be excluded too.

Quote
- Privacy: If possible, save messages using the epoch Unix Time,
to avoid someone automatically stealing all the messages,
since it's currently searching for "message (2).txt", "message (3).txt", etc.
Nice idea. Seems like private rooms.
But as I said I created this as analogue of public IRC-channel in Local Network.
In IRC you can see private rooms too, but this is a channel, and this need Internet connection.
For example, you can connect here: https://webchat.freenode.net/ to #tox channel with any username,
and do chating online with Tox developers community.
In LAN IRC - not working... And this HFS-chat working in LAN.

If number in filename will be changed, then any random user cann't do loading this simply.
I saw the problem in this, earler, but now...
How I see private rooms implementation?
1. Alice and Bob, select the key and do key exchange using DH.
2. Both calculating hash(from this key).
3. Rewtire "message" prefix (not number) as "hash(from_key)" and save the messages, encrypted by this key.
(For example, can be using AES algoritm to do encryption/decryption message content, and save this as HEX.)
4.
 - No any user must not and cann't download this messages.
 - Admin cann't read this messages (he don't know key for encryption/decryption.)
 - Admin can delete this messages, as admin for files in folder.
 - Bob and Alice can download messages, by simply incremention suffix (number about which you say).

Quote
- Add a private chat mode: when a private chat with some user is started, a new window is opened, and a new -temporal- folder is created on HFS, with a random folder name (for example "TempChat-5560AFHG") so, another users can't guess the folder path and steal or retrieve private chats.
Hehheh... This folder must be uploadable, and only HFS-admin can switch this.
To using security, as I said, Alice and Bob can using encryption/decryption in public chat.
No any user cann't read message without decryption key in this case,
but so many messages can be available in public to download...
If folder not recursively hidden, then any user can see file prefix,
and then save the same files with spam random values,
and in this case, Alice and Bob cann't decrypt this, but will got spam-loading.
So the private rooms, as I said Alice and Bob can using hash of key as prefix for filename with messages.
And in this case loading to server will be lower than in the case with just encrypted messages in public room.

Quote
And when one of the users close your browser, the private chat ends, and the another user gets a message like 'John has closed this chat' (similar as IRC).
Hm... This seems like WebRTC. Peer2Peer connection with random identifier for each private chat-room.
To make p2p connections, need the stun-server, or another relay-server - must be implemented in server-side software for make peers exchange.
To see any status value, need to do signalling between users.
All signals will be go to the server in this case, and as you can see this is HFS server, then signals will be saved AS FILES.
AS MANY-MANY FILES (without deletion, of course)...  :D
So will be better to do peer exchange, and directly data exchange between the peers.
Then will be possible to do video-chat, or voice chat, like VOIP, with lowest server loading.

Quote
And then, we can also automatically delete that temporal folder, when both parts close the window.
You cann't delete the folder, because in this case, this deletion can do anyone then.
But admin can do special permissions for you, as for authorized user.
In this case you must to contact to admin, and do logining to HFS server.

Quote
We can also create a -permanent- private chat (with a folder name like "PermChat-EASY777"), adding a button to make it, so if 2 users know the 'private chat name' (aka: private chat folder name), for example "EASY777", then, they can join the chat anytime without having to post anything on the public chat (that folder stores the messages permanently).
Hm... In this case, you need to be authorized on admin's HFS-server, or download HFS yourself, create folder with your own name,
and rewrite the pathways in HFS_JQuery_chat. Folder must be uploadable.
You can hide this folder! And you can do this - recursivelly hidden! To hide files inside this folder from anyone. Yeap...
But not from sniffers, because XHR using DNS. In TOR this can be secure, because TOR use encryption.

Quote
So basically, we can have a public chat, and a private chat and all without a database or anything special.
As I wrote in the top, this is possible in 1 uploadable folder, if:
1. Messages will be encrypted. (Can be used assymetric cryptography!)
2. Prefix for files will be changed in the source code.
3. Auto-increment for files containing the encrypted messages with this prefix.
And more no need nothing. To use assymetric cryptography can be used JS library, like js-nacl,
RSA, Diffie-Hellman key exchange, etc... You can find this here + BigInteger: https://github.com/username1565

Quote
You can also check the chat made by DJ, here (which can give you some new fresh ideas).
Thanks for your link. I did test this, but private messages in last version not working.
There is "..." for receiver. Template not working for me, in HFS 2.2.

https://rawr.thatstevensguy.com/
I did download Thunderchicken of Glory v4.0.3 and test this.
I see "mini chat" with id="Shoutbox" and the folder "template\shoutbox"
I see there is each message in each file too.
There is IP of user and timestamp in filename, and HTML content inside the file.
This chat is not secure if IP leak to admin, because any admin can be not good, IMHO.

Best regards, and have a nice day.
10
To work fast and don't overload the server, %item-size% and %item-modified% should be only asked to the server "on-demand" when we click on the menu button. . .
The %item-size% is fast; however, the %item-modified% is problematic.  It would also be cool to use the modern asynchronous (non-blocking) script methods to shorten the anti-phone date format to a phone friendly mm/dd/yy.  That processing can occur on the client, without blocking the server's progress in listing files. 
Pages: [1] 2 3 ... 10