aboutsummaryrefslogtreecommitdiff
path: root/html
diff options
context:
space:
mode:
authorgrant-kun <[email protected]>2022-10-04 15:06:22 -0500
committergrant-kun <[email protected]>2022-10-04 15:06:22 -0500
commitd6cb93f137ef669a1727d29d15426582baae4e97 (patch)
treeafb49ce3ea286402479c3100eb3077189240e539 /html
parent1d799f67eb394048e4ac39cd1dec999e2c0ebb5c (diff)
fixed
Diffstat (limited to 'html')
-rw-r--r--html/mail.html55
1 files changed, 55 insertions, 0 deletions
diff --git a/html/mail.html b/html/mail.html
new file mode 100644
index 0000000..2aad8ab
--- /dev/null
+++ b/html/mail.html
@@ -0,0 +1,55 @@
+<html>
+
+<head>
+ <title>mail</title>
+</head>
+
+<body>
+ <script>
+ function sendenc(location, content) {
+ var xhr = new XMLHttpRequest();
+ xhr.open("POST", window.location.href + location, true);
+ xhr.setRequestHeader('Content-Type', 'application/json');
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState == XMLHttpRequest.DONE) {
+ pub = kekw.decrypt(JSON.parse(xhr.responseText).data);
+ return pub
+ }
+ }
+ let out = {}
+ Object.assign(out, { json: true, enc: false }, { data: nodersa(pub, 'pkcs8-public').encrypt(content, { date: new Date() }, 'base64') })
+ xhr.send(JSON.stringify(out))
+ }
+ function sendnoenc(location, content) {
+ var promise = new Promise((resolve, reject) => {
+ var xhr = new XMLHttpRequest();
+ xhr.open("POST", window.location.href + location, true);
+ xhr.setRequestHeader('Content-Type', 'application/json');
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState == XMLHttpRequest.DONE) {
+ resolve(xhr.responseText);
+ }
+ }
+ let out = {}
+ Object.assign(out, { json: true, enc: false }, content)
+ xhr.send(JSON.stringify(out))
+ })
+ return (promise)
+ }
+ document.onkeypress = function (key) {
+ key = key || window.event;
+ if (key.key == "Enter") {
+ submit()
+ }
+ };
+ function update() {
+ console.log('hi')
+ sendnoenc('', { 'user': 'root', 'pass': 'password' }).then(res => {
+ console.log(res)
+ })
+ }
+ </script>
+</body>
+<button onclick="update()">update mail</button>
+
+</html> \ No newline at end of file