blob: c84f9d60c07e53c8fa38a9881a5a8da0752b55c5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// var openpgp = window.openpgp;
// var options = {
// userIds: [{ name:'Marvin Borner', email:'test@test.de' }], // multiple user IDs
// numBits: 4096, // RSA key size
// passphrase: 'cool password of private key'
// };
// openpgp.generateKey(options).then(function(key) {
// var privateKey = key.privateKeyArmored; // '-----BEGIN PGP PRIVATE KEY BLOCK ... '
// var publicKey = key.publicKeyArmored; // '-----BEGIN PGP PUBLIC KEY BLOCK ... '
// console.log(publicKey);
// console.log(privateKey);
// });
// $.ajax({
// type: "POST",
// url: "keys/public/1",
// data: {
// "key": "test_key_2"
// },
// cache: false,
// success: (results) => {
// console.log(results);
// }
// });
var socket = io('http://127.0.0.1:8890', {
transports: ['websocket']
});
socket.on('message', (data) => {
data = JSON.parse(data);
$("#messages").append("<p>" + data.user + " : " + data.message + "</p>");
});
$('input.send').click((e) => {
e.preventDefault();
sendMessage();
});
function sendMessage() {
var message = $('input.message').val();
$('input.message').val("");
$.ajax({
type: "POST",
url: "sendMessage",
data: {
"message": message
},
cache: false
});
}
|