diff --git a/html/home.html b/html/home.html
new file mode 100644
index 0000000..89c4730
--- /dev/null
+++ b/html/home.html
@@ -0,0 +1,14 @@
+
+
+
+ hello!
+ here have some quick links:
+
+
+
+
\ No newline at end of file
diff --git a/html/index.html b/html/index.html
index f28a971..04d4c9f 100644
--- a/html/index.html
+++ b/html/index.html
@@ -123,7 +123,7 @@
var xhr = new XMLHttpRequest();
xhr.open("POST", window.location.href + 'login/submit', true);
xhr.setRequestHeader('Content-Type', 'application/json');
- xhr.onreadystatechange = function () {
+ xhr.onreadystatechange = async function () {
if (xhr.readyState == XMLHttpRequest.DONE) {
let dec = (kekw.decrypt(JSON.parse(xhr.responseText).data));
if (JSON.parse(xhr.responseText).html) {
@@ -132,7 +132,10 @@
if (JSON.parse(xhr.responseText).json && JSON.parse(xhr.responseText).type == 'key') {
let decc = new TextDecoder().decode(dec)
//console.log(JSON.parse(decc))
- setCookie('login_key', JSON.parse(decc).login_key, 7)
+ let u = await document.getElementById('user').value
+ await setCookie('login_key', JSON.parse(decc).login_key, 7)
+ await setCookie('user', u, 7)
+ location.href = location.href + 'home'
}
}
}
diff --git a/html/mail.html b/html/mail.html
index 6c66f3a..7e306e8 100644
--- a/html/mail.html
+++ b/html/mail.html
@@ -6,6 +6,12 @@
+
+
+
+
+
+
@@ -248,9 +276,9 @@
xhr.onreadystatechange = function () {
if (xhr.readyState == XMLHttpRequest.DONE) {
console.log('recived')
- pub = new TextDecoder().decode(kekw.decrypt(JSON.parse(xhr.responseText).data));
+ let pubb = new TextDecoder().decode(kekw.decrypt(JSON.parse(xhr.responseText).data));
console.log('decrypted')
- resolve(pub)
+ resolve(pubb)
}
}
let out = {}
@@ -323,6 +351,11 @@
async function lm(index) {
let m
+ if (preview == index) {
+ document.getElementById('box').style.display = 'none'
+ preview = -1
+ return
+ }
if (html) {
m = autoLink((emails[index]['body[2]']))
} else {
@@ -332,20 +365,62 @@
document.getElementById('box').style.display = 'block'
document.getElementById('view').innerHTML = (m)
+ preview = index
-
+ }
+ function del(index) {
+ preview = index //to not view in side
+ revved = emails.reverse()
+ index = revved.indexOf(emails[index]) - 1
+ //pretty proud of this reverse indexer :)
+ sendenc('/del', { 'index': index, 'fuck you': true, 'user': 'root', 'login_key': getCookie('login_key'), 'requested': 0 })
}
function umail() {
let ret = ''
let evo = false
for (let email of emails) {
- let c = '#2C3333'
+ let c = '#21252B'
if (evo) {
- c = '#395B64'
+ c = '#2A3135'
}
evo = !evo
ret += ''
+
+ ret += '
'
+
ret += '
sub:' + email.envelope.subject + 'frm:' + email.envelope.from[0].address + '' + email.envelope.date + ' '
}
@@ -361,7 +436,7 @@
if (getCookie('login_key') == null) {
window.location.href = '/'
}
- await update()
+ await init()
//return
//document.getElementsByClassName('loading')[0].style.display = 'none'
let xx = document.getElementsByClassName('card')[0]
@@ -377,7 +452,7 @@
setInterval(() => {
- umail()
+ //umail()
}, 5000)
}
//
diff --git a/index.ts b/index.ts
index 78de797..f59647c 100644
--- a/index.ts
+++ b/index.ts
@@ -138,6 +138,42 @@ app.post('/mail/get/update',(req:any,res:any)=>{
});
})
})
+app.post('/mail/del',(req:any,res:any)=>{
+ const key = new NodeRSA({b: 1024})
+
+ key.importKey(keyring[req.body.sid].mypriv,'pkcs1-private')
+ let dec:any = JSON.parse((atob(key.decrypt(req.body.data,'base64','base64'))))
+ //console.log(key)
+ //console.log(dec.data.login_key)
+ let users = JSON.parse(readFileSync('json/user.json').toString())
+ let logkey:any,mail:any
+ for(let user of users){
+ //console.log(user,dec)
+ if(user.name==dec.data.user){
+ logkey = (decrypt(user.login_key,dec.data.login_key))
+ mail =JSON.parse(decrypt(user.mail,logkey)).emails[parseInt(dec.data.requested)]
+ }
+ }
+ //console.log(JSON.parse(decrypt(users[0].mail,logkey)).emails)
+ var client = new ImapClient(mail.host, parseInt(mail.port), {
+ auth: {
+ user: mail.address,
+ pass: mail.creds,
+
+ },logLevel:1000
+ });
+ client.connect().then(()=>{
+ const skey = new NodeRSA()
+ skey.importKey(keyring[req.body.sid].theirpub,'pkcs8-public')
+ client.deleteMessages('INBOX',dec.data.index).then(()=>{
+ res.send(JSON.stringify({data:skey.encrypt(JSON.stringify({'comp':true}),'base64'),enc:true,html:true}))
+ client.close()
+ })
+ //console.log(users,(JSON.stringify(messages)))
+
+
+ })
+})
app.post('/mail/reg',async(req:any,res:any)=>{
const key = new NodeRSA({b: 1024})
const skey = new NodeRSA()
@@ -147,7 +183,6 @@ app.post('/mail/reg',async(req:any,res:any)=>{
let users = JSON.parse(readFileSync('./json/user.json').toString())
let logkey:any,mail:any
- console.log(dec)
for(let user of users){
if(user.name==dec.data.user){
@@ -215,6 +250,12 @@ app.get('/src/lights-out.gif', (req:any, res:any) => {
app.get('/src/kanna.gif', (req:any, res:any) => {
res.sendFile(__dirname+'/src/kanna.gif')
})
+app.get('/src/sauce-code-mono.ttf', (req:any, res:any) => {
+ res.sendFile(__dirname+'/src/sauce-code-mono.ttf')
+})
+app.get('/home', (req:any, res:any) => {
+ res.sendFile(__dirname+'/html/home.html')
+})
app.post('/pub.key', async (req:{body:{json:boolean,sid:keyof keyring,pub:string}}, res:any) => {
if(req.body.json){
diff --git a/readme.md b/readme.md
index 8a988ce..e12060d 100644
--- a/readme.md
+++ b/readme.md
@@ -77,5 +77,6 @@ visit the [main git](https://git.disroot.org/grantsquires/kanna-site) or the [gi
- [ ] sub domains
- [ ] make my own libs
- [ ] encryption (md5 hashing, and rsa)
+ - [ ] add aliases that are used in cookies and randomly gen.
FeMail (iron mail)
diff --git a/src/sauce-code-mono.ttf b/src/sauce-code-mono.ttf
new file mode 100644
index 0000000..12b7752
Binary files /dev/null and b/src/sauce-code-mono.ttf differ