From ef5d91154713635f63e401353d83978e558c6f1f Mon Sep 17 00:00:00 2001 From: Nite <67828948+Niteletsplay@users.noreply.github.com> Date: Mon, 10 Apr 2023 19:44:06 +0200 Subject: [PATCH 01/11] save --- .gitignore | 1 + web/css/tempmail.css | 19 +++++++++++++++---- web/js/tempmail.js | 2 +- web/tempmail.html | 5 ++++- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index fd9b3c20..1de8a281 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ main.h a.out notes.txt data.json.old +data/ dist/ diff --git a/web/css/tempmail.css b/web/css/tempmail.css index aae4f9ce..39299aa8 100644 --- a/web/css/tempmail.css +++ b/web/css/tempmail.css @@ -6,10 +6,21 @@ background-color: var(--bg-bright); background: linear-gradient(0deg, var(--bg-bright) 50%, var(--bg) 100%); box-shadow: 0.3rem 0.3rem 0.6rem var(--shadow-1), -0.2rem -0.2rem 0.5rem var(--shadow-2); + display: flex; + align-content: center; + flex-wrap: wrap; } -.create-mail-btn { - width: 10vw; - height: 10vh; - margin: 9rem; +.tempmail-manage { + height: 6vh; + margin-bottom: unset; + justify-content: center; +} + +.tempmail-new-email, +.tempmail-delete-email { + width: 5rem; + color: var(--textColor-1); + font-size: 1.5rem; + text-align: center; } \ No newline at end of file diff --git a/web/js/tempmail.js b/web/js/tempmail.js index f2bda899..74e8d081 100644 --- a/web/js/tempmail.js +++ b/web/js/tempmail.js @@ -24,7 +24,7 @@ const myBtn = document.querySelector(".create-mail-btn"); const myPara = document.querySelector(".email-headline"); myBtn.addEventListener("click", () => { - fetch("https://cors-anywhere.herokuapp.com/https://www.developermail.com/api/v1/mailbox", { + fetch("http://localhost:8081/api/mailbox", { method: "PUT", headers: { "accept": "application/json" diff --git a/web/tempmail.html b/web/tempmail.html index e5fef59a..121ed7ae 100644 --- a/web/tempmail.html +++ b/web/tempmail.html @@ -32,7 +32,10 @@
-

TEMPORARY EMAIL

+
+
New
+
Delete
+
From 2a59c46fd6cd7b811c90edefd49e2aa33778ba6a Mon Sep 17 00:00:00 2001 From: 9glenda Date: Fri, 21 Apr 2023 07:33:02 +0000 Subject: [PATCH 02/11] allow cors credentials --- api/temp_mail.go | 1 + 1 file changed, 1 insertion(+) diff --git a/api/temp_mail.go b/api/temp_mail.go index 16c4bed4..1880f938 100644 --- a/api/temp_mail.go +++ b/api/temp_mail.go @@ -13,6 +13,7 @@ func (config ApiConfig) ServeTempMail() { // Add CORS middleware to allow all requests corsConfig := cors.DefaultConfig() corsConfig.AllowAllOrigins = true + corsConfig.AllowCredentials = true router.Use(cors.New(corsConfig)) // Reverse proxy to https://www.developermail.com/api/v1/ From 075431e35973251a90c55ba9ed773a059ad579a2 Mon Sep 17 00:00:00 2001 From: 9glenda Date: Fri, 21 Apr 2023 07:35:41 +0000 Subject: [PATCH 03/11] allow headers --- api/temp_mail.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/temp_mail.go b/api/temp_mail.go index 1880f938..2a7f0568 100644 --- a/api/temp_mail.go +++ b/api/temp_mail.go @@ -14,6 +14,10 @@ func (config ApiConfig) ServeTempMail() { corsConfig := cors.DefaultConfig() corsConfig.AllowAllOrigins = true corsConfig.AllowCredentials = true + corsConfig.AllowHeaders = []string{ + "X-MailboxToken", + //"accept", + } router.Use(cors.New(corsConfig)) // Reverse proxy to https://www.developermail.com/api/v1/ From 613ba94c3be699ae71bc6411dba9a3005a84f1d9 Mon Sep 17 00:00:00 2001 From: Nite <67828948+Niteletsplay@users.noreply.github.com> Date: Fri, 21 Apr 2023 22:26:57 +0200 Subject: [PATCH 04/11] WIP --- api/temp_mail.go | 6 +- web/css/tempmail.css | 238 ++++++++++++++++++++++++++++++++++++++++++- web/desktop.html | 6 +- web/js/tempmail.js | 206 ++++++++++++++++++++++++++++++++----- web/tempmail.html | 110 +++++++++++++++++++- 5 files changed, 527 insertions(+), 39 deletions(-) diff --git a/api/temp_mail.go b/api/temp_mail.go index 2a7f0568..23442e33 100644 --- a/api/temp_mail.go +++ b/api/temp_mail.go @@ -1,10 +1,11 @@ package api import ( - "github.com/gin-contrib/cors" - "github.com/gin-gonic/gin" "net/http/httputil" "net/url" + + "github.com/gin-contrib/cors" + "github.com/gin-gonic/gin" ) func (config ApiConfig) ServeTempMail() { @@ -16,6 +17,7 @@ func (config ApiConfig) ServeTempMail() { corsConfig.AllowCredentials = true corsConfig.AllowHeaders = []string{ "X-MailboxToken", + "Content-Type", //"accept", } router.Use(cors.New(corsConfig)) diff --git a/web/css/tempmail.css b/web/css/tempmail.css index 39299aa8..54f8b258 100644 --- a/web/css/tempmail.css +++ b/web/css/tempmail.css @@ -1,3 +1,5 @@ +/* TOP NAV BAR */ + .dd-nav-bar { position: absolute; top: 0; @@ -15,12 +17,238 @@ height: 6vh; margin-bottom: unset; justify-content: center; + width: fit-content; } -.tempmail-new-email, -.tempmail-delete-email { - width: 5rem; - color: var(--textColor-1); +#create-mail-btn, +#del-mail-btn { + width: 6.5rem; + height: 3.5rem; font-size: 1.5rem; - text-align: center; + justify-content: center; + margin: 0.5rem; +} + +#show-current-mail { + position: absolute; + left: 50%; + display: flex; + align-items: center; + top: 50%; + -ms-transform: translateY(-50%) translateX(-50%); + transform: translateY(-50%) translateX(-50%); +} + +#current-mail { + width: 28rem; + height: 4rem; + border: none; + border-radius: 1rem; + font-size: 1.4rem; + padding-left: 3.8rem; + box-shadow: var(--shadowPreset-2); + background: none; + font-family: inherit; + color: var(--textColor-1); +} + +#current-mail::placeholder { + color: var(--textColor-1); +} + +#current-mail::-moz-placeholder { + color: var(--textColor-1); +} + +#current-mail:-ms-input-placeholder { + color: var(--textColor-1); +} + +.tempmail-icon { + height: 2rem; + position: absolute; + font-size: 2rem; + padding: 0 1rem; + display: flex; + color: var(--textColor-1); + transition: 0.3s ease; +} + +#mail-token { + width: 0; + height: 0; + color: transparent; +} + +/* MAIL INBOX */ + +.tempmail-scroll-box { + overflow: hidden; + overflow-y: scroll; + align-items: unset; +} + +.tempmail-scroll-box p { + display: flex; +} + +.tempmail-scroll-box::-webkit-scrollbar { + width: 12px; + -webkit-appearance: none; +} + +.tempmail-scroll-box::-webkit-scrollbar-thumb { + background: var(--bg); + border-radius: 3rem; + box-shadow: var(--shadowPreset-6); +} + +#mail-view-scroll-box { + position: relative; + margin-top: 11vh; + width: 55%; + height: 87vh; +} + +#content-view-scroll-box { + position: relative; + margin-top: 11vh; + width: 45%; + height: 87vh; + margin-right: 1.75rem; +} + +#emails { + width: 100%; + display: flex; + flex-direction: column; + padding-top: 2rem; +} + +#split-view { + display: flex; + flex-direction: row; + width: 100%; + height: 100%; +} + +#content { + width: 100%; + display: flex; + padding-top: 2rem; + flex-direction: column; +} + + +.mail-chip { + width: 95.5%; + height: 6vh; + display: flex; + font-size: 1.6rem; + color: var(--textColor-1); + cursor: pointer; + align-items: unset; + transition: 0.3s ease; + margin-left: 2rem; + align-items: center; + flex-direction: row; +} + +.mail-chip-detail { + display: block; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + display: block !important; +} + +.mail-chip-detail.mail-header { + font-weight: bold; + margin-right: 2rem; + width: calc(35% - 2rem); +} + +.mail-chip-detail.mail-sender { + margin-right: 2rem; + width: calc(45% - 2rem); +} + +.mail-chip-detail.mail-date { + margin-left: 2rem; + width: calc(20% - 2rem); +} + +.mail-header-chip { + width: 95%; + min-height: calc(12vh + 2rem); + display: flex; + font-size: 1.6rem; + color: var(--textColor-1); + align-items: unset; + transition: 0.3s ease; + padding: 2rem; + flex-direction: column; +} + +.mail-content-detail { + margin-bottom: 0.5rem; +} + +.top-header { + flex-direction: column; +} + +#content-mail-header { + margin-bottom: 0; + margin-left: 0; + margin-top: 0.5rem; + font-weight: bold; + font-size: 2rem; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + display: block !important; +} + +#content-mail-header { + width: 100%; + height: 100%; +} + +#mail-loading-spinner { + align-self: center; + position: unset; + margin-left: 1rem; +} + +#refresh-loading-spinner { + align-self: center; + position: unset; + margin-left: 1rem; + position: absolute; + top: 0; + right: 0; + top: 50%; + -ms-transform: translateY(-50%) translateX(-50%); + transform: translateY(-50%) translateX(-50%); +} + +#refresh-btn { + position: absolute; + top: 0; + right: 0; + width: 4rem; + height: 4rem; + border-radius: 4rem; + position: absolute; + display: flex; + align-items: center; + top: 50%; + -ms-transform: translateY(-50%) translateX(-50%); + transform: translateY(-50%) translateX(-50%); + margin: 0 !important; +} + +#refresh-icon { + font-size: 2rem; } \ No newline at end of file diff --git a/web/desktop.html b/web/desktop.html index 07944f9c..8d9a4023 100644 --- a/web/desktop.html +++ b/web/desktop.html @@ -50,9 +50,9 @@
Guide
- - - +
+ TempMail +
WhoIs
diff --git a/web/js/tempmail.js b/web/js/tempmail.js index 74e8d081..8ff688b2 100644 --- a/web/js/tempmail.js +++ b/web/js/tempmail.js @@ -20,31 +20,185 @@ channel.addEventListener('message', (event) => { -const myBtn = document.querySelector(".create-mail-btn"); -const myPara = document.querySelector(".email-headline"); - -myBtn.addEventListener("click", () => { - fetch("http://localhost:8081/api/mailbox", { - method: "PUT", - headers: { - "accept": "application/json" - }, - body: "" - }) - .then(response => response.json()) // Parse the response as JSON - .then(data => { - // Check if the API call was successful and there are no errors - if (data.success && data.errors === null) { - // Set the text of the paragraph tag to the name and token values - myPara.textContent = `Name: ${data.result.name}, Token: ${data.result.token}`; - } else { - // Set the text of the paragraph tag to indicate an error occurred - myPara.textContent = "An error occurred."; +const mailDetailsFrame = document.getElementById("content") +const mailDetailsDate = document.getElementById("content-mail-date") +const mailDetailsSender = document.getElementById("content-mail-sender") +const mailDetailsHeader = document.getElementById("content-mail-header") +const mailDetailsBody = document.getElementById("content-mail-body") + +const mailListFrame = document.getElementById("emails") +const newBtn = document.getElementById("create-mail-btn"); +const delBtn = document.getElementById("del-mail-btn"); +const refreshBtn = document.getElementById("refresh-btn"); +const currentMail = document.getElementById("current-mail"); +const mailToken = document.getElementById("mail-token"); +const loadingSpinner = document.getElementById("mail-loading-spinner"); +const refreshLoadingSpinner = document.getElementById("refresh-loading-spinner"); + +newBtn.addEventListener("click", () => { + if (mailToken.innerHTML == "") { + loadingSpinner.style.display = "flex"; + + fetch("http://localhost:8569/developermail/api/mailbox", { + method: "PUT", + headers: { + "accept": "application/json" + }, + body: "" + }) + .then(response => response.json()) + .then(data => { + if (data.success && data.errors === null) { + currentMail.value = data.result.name + "@developermail.com"; + + mailToken.innerHTML = data.result.token; + } else { + currentMail.value = "An error occurred."; + } + }) + .then(() => { + loadingSpinner.style.display = "none"; + }) + .catch(error => { + currentMail.value = "An error occurred."; + console.error(error); + }); + } +}); + +delBtn.addEventListener("click", () => { + if (mailToken.innerHTML != "") { + loadingSpinner.style.display = "flex"; + + fetch("http://localhost:8569/developermail/api/mailbox/" + currentMail.value.split("@")[0], { + method: "DELETE", + headers: { + "accept": "application/json", + "X-MailboxToken": mailToken.innerHTML + }, + body: "" + }) + .then(response => response.json()) + .then(data => { + if (data.success && data.errors === null) { + mailToken.innerHTML = ""; + + currentMail.value = "Tempmail deleted!"; + + setTimeout(() => { + currentMail.value = ""; + }, 3000); + } else { + currentMail.value = "An error occurred."; + } + }) + .then(() => { + loadingSpinner.style.display = "none"; + }) + .catch(error => { + currentMail.value = "An error occurred."; + console.error(error); + }); + } +}); + +refreshBtn.addEventListener("click", () => { + if (mailToken.innerHTML != "") { + refreshLoadingSpinner.style.display = "flex"; + + // Get message IDs + + fetch("http://localhost:8569/developermail/api/mailbox/" + currentMail.value.split("@")[0], { + method: "GET", + headers: { + "accept": "application/json", + "X-MailboxToken": mailToken.innerHTML } }) - .catch(error => { - // Set the text of the paragraph tag to indicate an error occurred - myPara.textContent = "An error occurred."; - console.error(error); - }); -}); \ No newline at end of file + .then(response => response.json()) + .then(data => { + if (data.success && data.errors === null) { + + console.log(data.result); + + // Get messages using IDs + + if (data.result.length > 0) { + fetch("http://localhost:8569/developermail/api/mailbox/" + currentMail.value.split("@")[0] + "/messages", { + method: "POST", + headers: { + "accept": "application/json", + "X-MailboxToken": mailToken.innerHTML, + "Content-Type": "application/json" + }, + body: JSON.stringify(data.result) + }) + .then(response => { + if (response.ok) { + return response.json(); + } else { + throw new Error('Network response was not ok.'); + } + }) + .then(data => { + if (data.success && data.errors === null) { + for (let i = 0; i < data.result.length; i++) { + const mailChip = document.createElement("div"); + mailChip.className = "mail-chip chip"; + + const mailDate = document.createElement("p"); + mailDate.className = "mail-chip-detail mail-date"; + mailDate.innerHTML = data.result[i].value.split("Date: ")[1].split("\r\nMessage-ID")[0].match(/\d{2}:\d{2}/)[0]; + + const mailSender = document.createElement("p"); + mailSender.className = "mail-chip-detail mail-sender"; + mailSender.innerHTML = data.result[i].value.split("From: ")[1].split("\r\nDate:")[0].match(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/)[0]; + + const mailHeader = document.createElement("p"); + mailHeader.className = "mail-chip-detail mail-header"; + mailHeader.innerHTML = data.result[i].value.split("Subject: ")[1].split("\r\nTo: ")[0]; + + + mailListFrame.appendChild(mailChip); + mailChip.appendChild(mailDate); + mailChip.appendChild(mailSender); + mailChip.appendChild(mailHeader); + + mailChip.addEventListener("click", () => { + mailDetailsDate.innerHTML = data.result[i].value.split("Date: ")[1].split("\r\nMessage-ID")[0].match(/\d{2}:\d{2}/)[0]; + mailDetailsSender.innerHTML = data.result[i].value.split("From: ")[1].split("\r\nDate:")[0].match(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/)[0]; + mailDetailsHeader.innerHTML = data.result[i].value.split("Subject: ")[1].split("\r\nTo: ")[0]; + mailDetailsBody.innerHTML = data.result[i].value.split("Content-Type: text/plain; charset=\"UTF-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n")[1].split("\r\n\r\n--")[0]; + }); + } + } else { + console.log("An error occurred."); + } + }) + .then(() => { + refreshLoadingSpinner.style.display = "none"; + }) + .catch(error => { + console.log("An error occurred."); + console.error(error); + }); + } + } else { + console.log("An error occurred."); + } + }) + .then(() => { + refreshLoadingSpinner.style.display = "none"; + }) + .catch(error => { + console.log("An error occurred."); + console.error(error); + }); + } +}); + + +// { +// "key": "638176942571524819", +// "value": "Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-3f17e584462so20288345e9.2\r\n for ; Fri, 21 Apr 2023 10:17:35 -0700 (PDT)\r\nDKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r\n d=gmail.com; s=20221208; t=1682097454; x=1684689454;\r\n h=to:subject:message-id:date:from:mime-version:from:to:cc:subject\r\n :date:message-id:reply-to;\r\n bh=MGtAwkOPhhOK6xhGXRsv5NlFTcVWDQz1Orv8i2rlbkE=;\r\n b=QB/rjB2l4YQmRuhq3hl1Wd5GecPv3okJCqDxG0oI5LPa7dEqPcH8S6g2yEPZRCvQtT\r\n 0NOO5pFYIQ1dxDCd+1VWUrN2mSIxwyY0YJQR5AvY3hiRaYvPJqFmECiFjSSi6umAT0ho\r\n 1eRb/QjtuoBiKvTt5D7uR0SKMAubpTZFM5Aiih8rWVgvdzSZMb96Wn1CIC1dMeobn6Ye\r\n bj17iX7TwyOfej5akLhT2K6cx64+/9WSP9DWhHuxk6Dvgb6V/TKm3qc6xPZiZJDv2VKQ\r\n bs+SJdkjCe+vMvq1Ee6ZLXWRhd1QkjUPF+FvcA+mHpwbgU0cd6N0kb7u/lHf85I5Tan+\r\n 4lWA==\r\nX-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r\n d=1e100.net; s=20221208; t=1682097454; x=1684689454;\r\n h=to:subject:message-id:date:from:mime-version:x-gm-message-state\r\n :from:to:cc:subject:date:message-id:reply-to;\r\n bh=MGtAwkOPhhOK6xhGXRsv5NlFTcVWDQz1Orv8i2rlbkE=;\r\n b=TjyrN2qPfyCTyC7J/x2BveiPKZE66Gg5bpqzlHN0FpkXTJRXjmBsfiEj6tUXRf0Dre\r\n Pw71HMqyRytSqNcHX4rZ0yR7kgf959m5u4Iba2n/pV/QLdEMJtQWJc8LajGcFb1bF0f1\r\n qsN9rWegP6GyO8fDU09LXgHFqr+/CxTCGuF5ZUQdy4r6clNeve+8BPMbtJcNQDQ+rT7a\r\n BQLQlOhjtk8QJq0wTIS6ssack7teXHvGWTa4kUp6HCTVLHDZLiO/mqd+8JXy3/NpsTb+\r\n 1cdYaOWLPaZNw5u+H87/6f2hYL7HOFJy9CFshha+zEeXxETqempsgkyDSFl07YLyAIBl\r\n h+CQ==\r\nX-Gm-Message-State: AAQBX9e5DIHZrK2Z5bcOYriiKNYIZrqwyhD98F2q2aivgAdQXeAw82XT\r\n\tFKLEM8VkPdk7aaV8aS+yJ9qFxWKlf1OrkO0OnKy9eDRA\r\nX-Google-Smtp-Source: AKy350ZCj9rTseJsPkP9ztIj6wDbyQzbpR/YWZfvLJHtYL50AsFFjM7Am2lYXtx6DJ2eJRybacDK9zGlYeD8eUfh9Ec=\r\nX-Received: by 2002:adf:fc87:0:b0:2d1:e517:4992 with SMTP id\r\n g7-20020adffc87000000b002d1e5174992mr4524402wrr.69.1682097453980; Fri, 21 Apr\r\n 2023 10:17:33 -0700 (PDT)\r\nMIME-Version: 1.0\r\nFrom: Forks are better than spoons \r\nDate: Fri, 21 Apr 2023 19:17:22 +0200\r\nMessage-ID: \r\nSubject: tets\r\nTo: z-tsmyw5@developermail.com\r\nContent-Type: multipart/alternative; boundary=\"00000000000038e10805f9dbd5a5\"\r\n\r\n--00000000000038e10805f9dbd5a5\r\nContent-Type: text/plain; charset=\"UTF-8\"\r\n\r\nte\r\n\r\n--00000000000038e10805f9dbd5a5\r\nContent-Type: text/html; charset=\"UTF-8\"\r\n\r\n
te
\r\n\r\n--00000000000038e10805f9dbd5a5--" +// } \ No newline at end of file diff --git a/web/tempmail.html b/web/tempmail.html index 121ed7ae..5347f718 100644 --- a/web/tempmail.html +++ b/web/tempmail.html @@ -31,13 +31,117 @@ +

+
-
New
-
Delete
+
New
+
Delete
+
+ +
+
+
+
+
+
+
+
+
+
+ +
+ +
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+ +
+
- +
+
+
+
+

7.06 AM

+ +

support@developermail.com

+ +

This is an email! This is an email! This is an email! This is an email! This is an email!

+
+ +
+

7.06 AM

+ +

support@developermail.com

+ +

This is an email! This is an email! This is an email! This is an email! This is an email!

+
+ +
+

7.06 AM

+ +

support@developermail.com

+ +

This is an email! This is an email! This is an email! This is an email! This is an email!

+
+ +
+

7.06 AM

+ +

support@developermail.com

+ +

This is an email! This is an email! This is an email! This is an email! This is an email!

+
+ +
+

7.06 AM

+ +

support@developermail.com

+ +

This is an email! This is an email! This is an email! This is an email! This is an email!

+
+ +
+

7.06 AM

+ +

support@developermail.com

+ +

This is an email! This is an email! This is an email! This is an email! This is an email!

+
+
+
+ +
+
+
+
+

Date: 04/21/2023 07:06:57 +00:00

+

From: support@developermail.com

+
+ +

Welcome to DeveloperMail.com!

+
+ +
+ +
+
+
+
\ No newline at end of file From 47cfb977cf67c3cb68d6fbff7ae828f5530d6da6 Mon Sep 17 00:00:00 2001 From: Nite <67828948+Niteletsplay@users.noreply.github.com> Date: Sat, 22 Apr 2023 07:02:52 +0200 Subject: [PATCH 05/11] Trying to get stuff to work --- web/js/tempmail.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/web/js/tempmail.js b/web/js/tempmail.js index 8ff688b2..d75ab609 100644 --- a/web/js/tempmail.js +++ b/web/js/tempmail.js @@ -165,10 +165,13 @@ refreshBtn.addEventListener("click", () => { mailChip.appendChild(mailHeader); mailChip.addEventListener("click", () => { + console.log(data.result[i].value) + console.log(data.result[i].value.split("Content-Type: text/plain; charset=\"UTF-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n")[1].split("\r\n\r\n--")[0]) + mailDetailsDate.innerHTML = data.result[i].value.split("Date: ")[1].split("\r\nMessage-ID")[0].match(/\d{2}:\d{2}/)[0]; mailDetailsSender.innerHTML = data.result[i].value.split("From: ")[1].split("\r\nDate:")[0].match(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/)[0]; mailDetailsHeader.innerHTML = data.result[i].value.split("Subject: ")[1].split("\r\nTo: ")[0]; - mailDetailsBody.innerHTML = data.result[i].value.split("Content-Type: text/plain; charset=\"UTF-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n")[1].split("\r\n\r\n--")[0]; + mailDetailsBody.innerHTML = data.result[i].value.split("Content-Type: text/plain; charset=\"UTF-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n")[1].split("\r\n\r\n--\w{32}--")[0]; }); } } else { @@ -195,10 +198,4 @@ refreshBtn.addEventListener("click", () => { console.error(error); }); } -}); - - -// { -// "key": "638176942571524819", -// "value": "Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-3f17e584462so20288345e9.2\r\n for ; Fri, 21 Apr 2023 10:17:35 -0700 (PDT)\r\nDKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r\n d=gmail.com; s=20221208; t=1682097454; x=1684689454;\r\n h=to:subject:message-id:date:from:mime-version:from:to:cc:subject\r\n :date:message-id:reply-to;\r\n bh=MGtAwkOPhhOK6xhGXRsv5NlFTcVWDQz1Orv8i2rlbkE=;\r\n b=QB/rjB2l4YQmRuhq3hl1Wd5GecPv3okJCqDxG0oI5LPa7dEqPcH8S6g2yEPZRCvQtT\r\n 0NOO5pFYIQ1dxDCd+1VWUrN2mSIxwyY0YJQR5AvY3hiRaYvPJqFmECiFjSSi6umAT0ho\r\n 1eRb/QjtuoBiKvTt5D7uR0SKMAubpTZFM5Aiih8rWVgvdzSZMb96Wn1CIC1dMeobn6Ye\r\n bj17iX7TwyOfej5akLhT2K6cx64+/9WSP9DWhHuxk6Dvgb6V/TKm3qc6xPZiZJDv2VKQ\r\n bs+SJdkjCe+vMvq1Ee6ZLXWRhd1QkjUPF+FvcA+mHpwbgU0cd6N0kb7u/lHf85I5Tan+\r\n 4lWA==\r\nX-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r\n d=1e100.net; s=20221208; t=1682097454; x=1684689454;\r\n h=to:subject:message-id:date:from:mime-version:x-gm-message-state\r\n :from:to:cc:subject:date:message-id:reply-to;\r\n bh=MGtAwkOPhhOK6xhGXRsv5NlFTcVWDQz1Orv8i2rlbkE=;\r\n b=TjyrN2qPfyCTyC7J/x2BveiPKZE66Gg5bpqzlHN0FpkXTJRXjmBsfiEj6tUXRf0Dre\r\n Pw71HMqyRytSqNcHX4rZ0yR7kgf959m5u4Iba2n/pV/QLdEMJtQWJc8LajGcFb1bF0f1\r\n qsN9rWegP6GyO8fDU09LXgHFqr+/CxTCGuF5ZUQdy4r6clNeve+8BPMbtJcNQDQ+rT7a\r\n BQLQlOhjtk8QJq0wTIS6ssack7teXHvGWTa4kUp6HCTVLHDZLiO/mqd+8JXy3/NpsTb+\r\n 1cdYaOWLPaZNw5u+H87/6f2hYL7HOFJy9CFshha+zEeXxETqempsgkyDSFl07YLyAIBl\r\n h+CQ==\r\nX-Gm-Message-State: AAQBX9e5DIHZrK2Z5bcOYriiKNYIZrqwyhD98F2q2aivgAdQXeAw82XT\r\n\tFKLEM8VkPdk7aaV8aS+yJ9qFxWKlf1OrkO0OnKy9eDRA\r\nX-Google-Smtp-Source: AKy350ZCj9rTseJsPkP9ztIj6wDbyQzbpR/YWZfvLJHtYL50AsFFjM7Am2lYXtx6DJ2eJRybacDK9zGlYeD8eUfh9Ec=\r\nX-Received: by 2002:adf:fc87:0:b0:2d1:e517:4992 with SMTP id\r\n g7-20020adffc87000000b002d1e5174992mr4524402wrr.69.1682097453980; Fri, 21 Apr\r\n 2023 10:17:33 -0700 (PDT)\r\nMIME-Version: 1.0\r\nFrom: Forks are better than spoons \r\nDate: Fri, 21 Apr 2023 19:17:22 +0200\r\nMessage-ID: \r\nSubject: tets\r\nTo: z-tsmyw5@developermail.com\r\nContent-Type: multipart/alternative; boundary=\"00000000000038e10805f9dbd5a5\"\r\n\r\n--00000000000038e10805f9dbd5a5\r\nContent-Type: text/plain; charset=\"UTF-8\"\r\n\r\nte\r\n\r\n--00000000000038e10805f9dbd5a5\r\nContent-Type: text/html; charset=\"UTF-8\"\r\n\r\n
te
\r\n\r\n--00000000000038e10805f9dbd5a5--" -// } \ No newline at end of file +}); \ No newline at end of file From de844c0ed370486c1e5847bc6ca7cd385c86e39f Mon Sep 17 00:00:00 2001 From: Nite <67828948+Niteletsplay@users.noreply.github.com> Date: Sat, 22 Apr 2023 12:39:54 +0200 Subject: [PATCH 06/11] God help me --- web/js/tempmail.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/js/tempmail.js b/web/js/tempmail.js index d75ab609..b941d39d 100644 --- a/web/js/tempmail.js +++ b/web/js/tempmail.js @@ -165,13 +165,13 @@ refreshBtn.addEventListener("click", () => { mailChip.appendChild(mailHeader); mailChip.addEventListener("click", () => { - console.log(data.result[i].value) - console.log(data.result[i].value.split("Content-Type: text/plain; charset=\"UTF-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n")[1].split("\r\n\r\n--")[0]) + console.log(data.result[i].value); mailDetailsDate.innerHTML = data.result[i].value.split("Date: ")[1].split("\r\nMessage-ID")[0].match(/\d{2}:\d{2}/)[0]; mailDetailsSender.innerHTML = data.result[i].value.split("From: ")[1].split("\r\nDate:")[0].match(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/)[0]; mailDetailsHeader.innerHTML = data.result[i].value.split("Subject: ")[1].split("\r\nTo: ")[0]; - mailDetailsBody.innerHTML = data.result[i].value.split("Content-Type: text/plain; charset=\"UTF-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n")[1].split("\r\n\r\n--\w{32}--")[0]; + mailDetailsBody.innerHTML = data.result[i].value.split(`--([0-9]+([A-Za-z]+[0-9]+)+)`)[0]; //.split(`\r\n\r\n--\w{28}--`)[0] + console.log(mailDetailsBody.innerHTML); }); } } else { From ddd5fe1df1b0f2ab9bc1dc07ddf20c26f2257833 Mon Sep 17 00:00:00 2001 From: Nite <67828948+Niteletsplay@users.noreply.github.com> Date: Sat, 22 Apr 2023 18:55:32 +0200 Subject: [PATCH 07/11] hardcoded test data --- web/js/tempmail.js | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/web/js/tempmail.js b/web/js/tempmail.js index b941d39d..2cf8b8bb 100644 --- a/web/js/tempmail.js +++ b/web/js/tempmail.js @@ -35,6 +35,61 @@ const mailToken = document.getElementById("mail-token"); const loadingSpinner = document.getElementById("mail-loading-spinner"); const refreshLoadingSpinner = document.getElementById("refresh-loading-spinner"); +const testData = `Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-3f1950f5676so13982675e9.3 +for ; Sat, 22 Apr 2023 03:37:23 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; +d=gmail.com; s=20221208; t=1682159842; x=1684751842; +h=to:subject:message-id📅from:mime-version:from:to:cc:subject + 📅message-id:reply-to; +bh=z42V4dDYdrFpBK0is0aEjnMzMoSgnXIKTfsQHNl3GLA=; +b=Qc/cmtIboGSWl7TTf3qEGDwob9//E+5CBTTGQj+H5jGqIU8DBh3KBy7e2/P4HpRs5H + qwVyxdQe82dcJG7Udwoxwm/bG7Ss5P9yKn9HsDMyF+bHaATUjW1D4342DFGEer3WFxuX + zqFkcoiVq2sJJnaqGhTrw7SDtd2/Jgokwrn79J72wQf8UOYG31Ln/8BMy9+Ypr1BANZt + dnnfwp6Z+YlUZWie1bgifXBdLM020A6DVzbojFuMKEVavsF1jcFD8dzzVX5+/UqD73SF + xgVwHCWiN5ebjLLBc+VEq9N0mlZMcfCDGwaw0VLl7tmRY6DLi5BPhgZLLKCNNDuI1+XE + 9xOw== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; +d=1e100.net; s=20221208; t=1682159842; x=1684751842; +h=to:subject:message-id📅from:mime-version:x-gm-message-state + :from:to:cc:subject📅message-id:reply-to; +bh=z42V4dDYdrFpBK0is0aEjnMzMoSgnXIKTfsQHNl3GLA=; +b=fc+y4uilysz+OMsjafjYH5wzWGEbmOh7xeyy1IrQSUSs+V+iJ2S7DWW1O+5IO3sDNn + 75qxVhITPFCp4MDZse6LeHSPr7WmYErk/cBiQih7mFXMVMGW1h98M3wRearf3wtqY/yx + NVbdzmQBLeVJrvfeOY7Lh1j0+uIISjBPEtaLtwhzbfi+BVD3OToub/6NixIwj414v6rQ + WxujOolaLakcrKARM+w2KNkPNSRJi3a1UJdZYoYGK33hPZ9teZWW5sYmVX23IDEyVeD0 + CdbCsLE5RIGqYlbaOZYi7VjUYBrbi2qU+onq8wZwKXe122NPW8yQ0wOcThT60tt8pF22 + Uw0g== +X-Gm-Message-State: AAQBX9d8vkgJm9TS8fnaOROsOz2uqE3kpWCRgvDIogtoSpBnUz4UOWSK +Q13V2BQJw5NaFNwOWnEkPsKARXJ3hx0nQh0WHtSd9rAY +X-Google-Smtp-Source: AKy350ZWaVCc1n1xSErkCq9qKudQJSsBafibxC5fvjUWkaMEis2GKuYOdqoUATgLpceWXRmOiFtcKmkJpSpH840Vap0= +X-Received: by 2002:adf:dc4e:0:b0:2f2:7a49:c6cc with SMTP id +m14-20020adfdc4e000000b002f27a49c6ccmr5547370wrj.70.1682159842209; Sat, 22 +Apr 2023 03:37:22 -0700 (PDT) +MIME-Version: 1.0 +From: Some guy +Date: Sat, 22 Apr 2023 12:37:10 +0200 +Message-ID: +Subject: tes +To: z-rptjp7@developermail.com +Content-Type: multipart/alternative; boundary="000000000000d9b24c05f9ea5bff" + +--000000000000d9b24c05f9ea5bff +Content-Type: text/plain; charset="UTF-8" + +pls +work + +--000000000000d9b24c05f9ea5bff +Content-Type: text/html; charset="UTF-8" +Content-Transfer-Encoding: quoted-printable + +
pls=C2=A0
work
+ +--000000000000d9b24c05f9ea5bff--` + +mailDetailsBody.innerHTML = testData.split(`--([0-9]+([A-Za-z]+[0-9]+)+)`)[0]; + + newBtn.addEventListener("click", () => { if (mailToken.innerHTML == "") { loadingSpinner.style.display = "flex"; From dbbeba2eb608498d3a2fd7a358520f0f5b0ac22c Mon Sep 17 00:00:00 2001 From: 9glenda Date: Sat, 22 Apr 2023 18:56:50 +0000 Subject: [PATCH 08/11] extracting html --- web/js/tempmail.js | 122 ++++++++++++++++++++++++++------------------- web/tempmail.html | 2 +- 2 files changed, 72 insertions(+), 52 deletions(-) diff --git a/web/js/tempmail.js b/web/js/tempmail.js index 2cf8b8bb..f8c7cd69 100644 --- a/web/js/tempmail.js +++ b/web/js/tempmail.js @@ -15,11 +15,6 @@ channel.addEventListener('message', (event) => { } }); - - - - - const mailDetailsFrame = document.getElementById("content") const mailDetailsDate = document.getElementById("content-mail-date") const mailDetailsSender = document.getElementById("content-mail-sender") @@ -35,59 +30,78 @@ const mailToken = document.getElementById("mail-token"); const loadingSpinner = document.getElementById("mail-loading-spinner"); const refreshLoadingSpinner = document.getElementById("refresh-loading-spinner"); -const testData = `Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-3f1950f5676so13982675e9.3 -for ; Sat, 22 Apr 2023 03:37:23 -0700 (PDT) +const testData = `Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-505934ccc35so4855281a12.2 +for ; Sat, 22 Apr 2023 11:25:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; -d=gmail.com; s=20221208; t=1682159842; x=1684751842; -h=to:subject:message-id📅from:mime-version:from:to:cc:subject - 📅message-id:reply-to; -bh=z42V4dDYdrFpBK0is0aEjnMzMoSgnXIKTfsQHNl3GLA=; -b=Qc/cmtIboGSWl7TTf3qEGDwob9//E+5CBTTGQj+H5jGqIU8DBh3KBy7e2/P4HpRs5H - qwVyxdQe82dcJG7Udwoxwm/bG7Ss5P9yKn9HsDMyF+bHaATUjW1D4342DFGEer3WFxuX - zqFkcoiVq2sJJnaqGhTrw7SDtd2/Jgokwrn79J72wQf8UOYG31Ln/8BMy9+Ypr1BANZt - dnnfwp6Z+YlUZWie1bgifXBdLM020A6DVzbojFuMKEVavsF1jcFD8dzzVX5+/UqD73SF - xgVwHCWiN5ebjLLBc+VEq9N0mlZMcfCDGwaw0VLl7tmRY6DLi5BPhgZLLKCNNDuI1+XE - 9xOw== +d=gmail.com; s=20221208; t=1682187955; x=1684779955; +h=to:subject:message-id:date:from:mime-version:from:to:cc:subject + :date:message-id:reply-to; +bh=lum9DbkH3N1hbHsgEq0AlY9Wwvjg7O89ppGKncH3YzU=; +b=VIkhYF2Nr6vXKnB5Qmh3F5c1q4HS5Eky65vXOBqWBEBcdrwZ20rV5s4nW+KpSEY3iA + SahhN3+kqmNtCw8exeS5NYq2vU63HwpR0iFkizVD2LiiocngUOza0GuBdbLZSTk05Twj + P2X4i58h9UGDW1DPhGgM1fi4FaFC3fhrT2i9lqJqVow9PVcc3D/WxE5XNkruiZFnqBxX + CdJPMOm6szAUasdZnWc72gc4YtW1/x053VDfCZOyt37WJHOkKKpjT6dsuhrX0LMKaZUv + jwzRzRbngZPUCdRBiFAAUACal3+iGtpYgFJ8zmIdZjRrXpf+MDjJw5S51hzXZvTniI2H + WZLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; -d=1e100.net; s=20221208; t=1682159842; x=1684751842; -h=to:subject:message-id📅from:mime-version:x-gm-message-state - :from:to:cc:subject📅message-id:reply-to; -bh=z42V4dDYdrFpBK0is0aEjnMzMoSgnXIKTfsQHNl3GLA=; -b=fc+y4uilysz+OMsjafjYH5wzWGEbmOh7xeyy1IrQSUSs+V+iJ2S7DWW1O+5IO3sDNn - 75qxVhITPFCp4MDZse6LeHSPr7WmYErk/cBiQih7mFXMVMGW1h98M3wRearf3wtqY/yx - NVbdzmQBLeVJrvfeOY7Lh1j0+uIISjBPEtaLtwhzbfi+BVD3OToub/6NixIwj414v6rQ - WxujOolaLakcrKARM+w2KNkPNSRJi3a1UJdZYoYGK33hPZ9teZWW5sYmVX23IDEyVeD0 - CdbCsLE5RIGqYlbaOZYi7VjUYBrbi2qU+onq8wZwKXe122NPW8yQ0wOcThT60tt8pF22 - Uw0g== -X-Gm-Message-State: AAQBX9d8vkgJm9TS8fnaOROsOz2uqE3kpWCRgvDIogtoSpBnUz4UOWSK -Q13V2BQJw5NaFNwOWnEkPsKARXJ3hx0nQh0WHtSd9rAY -X-Google-Smtp-Source: AKy350ZWaVCc1n1xSErkCq9qKudQJSsBafibxC5fvjUWkaMEis2GKuYOdqoUATgLpceWXRmOiFtcKmkJpSpH840Vap0= -X-Received: by 2002:adf:dc4e:0:b0:2f2:7a49:c6cc with SMTP id -m14-20020adfdc4e000000b002f27a49c6ccmr5547370wrj.70.1682159842209; Sat, 22 -Apr 2023 03:37:22 -0700 (PDT) +d=1e100.net; s=20221208; t=1682187955; x=1684779955; +h=to:subject:message-id:date:from:mime-version:x-gm-message-state + :from:to:cc:subject:date:message-id:reply-to; +bh=lum9DbkH3N1hbHsgEq0AlY9Wwvjg7O89ppGKncH3YzU=; +b=k2KaUIF2Mqg5DWQd2JtjsrM7s4WDXCAWhAB9XrSei/M84jVlRNAti/YTocJfxR/7Ef + aCD56/prn40sMIuDJr/5lpHA+Rvs0tQmw2MXNSv8wS4MSJjW1tKBwACrTIKGquAlLkKq + ulzMvMSFCVJ7pwnGuCdTINxS/lg4HB+CHQeK1S2Adq3cP38m4gZ4gO5OiGPOJUPFMyAY + QdclJJTqhkA1PeiJltlGPUsvUSPI8Ej+GFrfxJvcyCLH7dp3/WPU75uz6B9iPHC3hxTd + B7JWvbEqEDsToYz1z21riOLytN1zJspWbb4pBLJ329iMJ2tS+cqaNF/VmWkVskmb8Knw + wncg== +X-Gm-Message-State: AAQBX9eNMYf4aE9hcokkjxO0vODcrA8Bbto7nPJydt6vtiX1PFVGz3vS +9RZcz6uYpf5Z7qh1+FtlHL7fBUFujaxfDVYrCRBlETltdPGug+5C +X-Google-Smtp-Source: AKy350YNtfiDyAjHCur4oE25fF/xOt7AVfoh7lXY8nYP/QG3IhYNHeyDSy52PsnjmQmjtDY/6TzQlNYaRBYFohA9IOA= +X-Received: by 2002:aa7:d281:0:b0:506:b88a:cab4 with SMTP id +w1-20020aa7d281000000b00506b88acab4mr7984149edq.3.1682187954715; Sat, 22 Apr +2023 11:25:54 -0700 (PDT) MIME-Version: 1.0 -From: Some guy -Date: Sat, 22 Apr 2023 12:37:10 +0200 -Message-ID: -Subject: tes -To: z-rptjp7@developermail.com -Content-Type: multipart/alternative; boundary="000000000000d9b24c05f9ea5bff" - ---000000000000d9b24c05f9ea5bff +From: Tom Spitz +Date: Sat, 22 Apr 2023 18:25:43 +0000 +Message-ID: +Subject: js suck +To: z-tpwpj5@developermail.com +Content-Type: multipart/alternative; boundary="0000000000007c7e1505f9f0e7ee" + +--0000000000007c7e1505f9f0e7ee Content-Type: text/plain; charset="UTF-8" -pls -work +js +suck +suck +suck ---000000000000d9b24c05f9ea5bff +--0000000000007c7e1505f9f0e7ee Content-Type: text/html; charset="UTF-8" -Content-Transfer-Encoding: quoted-printable -
pls=C2=A0
work
+
js
suck
suck
suck
+ +--0000000000007c7e1505f9f0e7ee--` ---000000000000d9b24c05f9ea5bff--` +function extractData(data) { + const pattern = /Content-Type: multipart\/alternative; boundary="([^"]*)"/; + const match = data.match(pattern); + if (!match) { + throw new Error("Invalid data: missing boundary"); + } + const boundary = match[1]; + const split = data.split(`--${boundary}`); + if (split.length < 4) { + throw new Error("Invalid data: not enough parts"); + } + return [ split[1].replace(/Content-Type:[^<]+/, ''), split[2].replace(/Content-Type:[^<]+/, '') ]; +} + +console.log(extractData(testData)); -mailDetailsBody.innerHTML = testData.split(`--([0-9]+([A-Za-z]+[0-9]+)+)`)[0]; +console.log(extractData(testData)[0]); +console.log(extractData(testData)[1]); +console.log(extractData(testData)[2]); newBtn.addEventListener("click", () => { @@ -225,8 +239,13 @@ refreshBtn.addEventListener("click", () => { mailDetailsDate.innerHTML = data.result[i].value.split("Date: ")[1].split("\r\nMessage-ID")[0].match(/\d{2}:\d{2}/)[0]; mailDetailsSender.innerHTML = data.result[i].value.split("From: ")[1].split("\r\nDate:")[0].match(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/)[0]; mailDetailsHeader.innerHTML = data.result[i].value.split("Subject: ")[1].split("\r\nTo: ")[0]; - mailDetailsBody.innerHTML = data.result[i].value.split(`--([0-9]+([A-Za-z]+[0-9]+)+)`)[0]; //.split(`\r\n\r\n--\w{28}--`)[0] - console.log(mailDetailsBody.innerHTML); + let actualData = data.result[i].value + console.log(extractData(actualData)[0]); + console.log(extractData(actualData)[1]); + + iframe = document.getElementById('content-mail-body-iframe'); + iframe.srcdoc = extractData(actualData)[1] + //console.log(mailDetailsBody.innerHTML); }); } } else { @@ -253,4 +272,5 @@ refreshBtn.addEventListener("click", () => { console.error(error); }); } -}); \ No newline at end of file +}); + diff --git a/web/tempmail.html b/web/tempmail.html index 5347f718..41a95836 100644 --- a/web/tempmail.html +++ b/web/tempmail.html @@ -137,7 +137,7 @@

Welcome to DeveloperMail.com!

-
+
From 8f673e9e3571e4d9995307591c2f99009817ae8f Mon Sep 17 00:00:00 2001 From: Niteletsplay Date: Sun, 23 Apr 2023 13:28:14 +0200 Subject: [PATCH 09/11] github sign up email test data --- web/js/tempmail.js | 290 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 285 insertions(+), 5 deletions(-) diff --git a/web/js/tempmail.js b/web/js/tempmail.js index f8c7cd69..f03f7bfe 100644 --- a/web/js/tempmail.js +++ b/web/js/tempmail.js @@ -30,7 +30,7 @@ const mailToken = document.getElementById("mail-token"); const loadingSpinner = document.getElementById("mail-loading-spinner"); const refreshLoadingSpinner = document.getElementById("refresh-loading-spinner"); -const testData = `Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-505934ccc35so4855281a12.2 +const testData1 = `Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-505934ccc35so4855281a12.2 for ; Sat, 22 Apr 2023 11:25:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682187955; x=1684779955; @@ -83,6 +83,286 @@ Content-Type: text/html; charset="UTF-8" --0000000000007c7e1505f9f0e7ee--` +const testData2 = ` +Received: from github-highworker-4bd0f4f.ash1-iad.github.net (github-highworker-4bd0f4f.ash1-iad.github.net [10.56.101.39]) + by smtp.github.com (Postfix) with ESMTP id 84965600267 + for ; Sun, 23 Apr 2023 04:23:41 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; + s=pf2023; t=1682249021; + bh=gV4eli2RcwC8Awt098BQtuQYbJLMi6j0s+4MYVSrMsQ=; + h=Date:From:To:Subject:From; + b=gRCOkHgxgI4+E55xLQ4RF8rV202u9jzWBU0w4LDIU4Mum1oMFk94Xvf5j+EOv514G + kUeMEGM2GY7EoWu4cKBGBaw1dXw6tH4UL97VpxBcIIsc4YKX9igQK07aXk0r05krHA + 3yewxyKFgFFvgf9cD/8Tya/gt1fGhg9AtCe6q95o= +Date: Sun, 23 Apr 2023 04:23:41 -0700 +From: GitHub +To: Hank3r-gh +Message-ID: <6445153d76bc7_38bbc97c26a3@github-highworker-4bd0f4f.ash1-iad.github.net.mail> +Subject: =?UTF-8?Q?=F0=9F=9A=80_Your_GitHub_launch_code?= +Mime-Version: 1.0 +Content-Type: multipart/alternative; + boundary="--==_mimepart_6445153ca0e93_38bbc97c25a9"; + charset=UTF-8 +Content-Transfer-Encoding: 7bit +X-Auto-Response-Suppress: All + + +----==_mimepart_6445153ca0e93_38bbc97c25a9 +Content-Type: text/plain; + charset=UTF-8 +Content-Transfer-Encoding: quoted-printable + +Here's your GitHub launch code, @Hank3r-gh! + +Continue signing up for GitHub by entering the code below: + +21337452 + +You can enter it by visiting the link below: + +https://github.com/account_verifications?via_launch_code_email=3Dtrue + +You=E2=80=99re receiving this email because you recently created a new Gi= +tHub account. If this wasn=E2=80=99t you, please ignore this email. + +Not able to enter the code? Paste the following link into your browser: + +https://github.com/users/Hank3r-gh/emails/253608093/confirm_verification/= +21337452?via_launch_code_email=3Dtrue + +--- +Sent with <3 by GitHub. +GitHub, Inc. 88 Colin P Kelly Jr Street +San Francisco, CA 94107 + +----==_mimepart_6445153ca0e93_38bbc97c25a9 +Content-Type: text/html; + charset=UTF-8 +Content-Transfer-Encoding: 7bit + + + + + + + + + + + + + + +
+
+ + + + +
+ + + + + + +
 
+ + + + + +
+ GitHub +

+ Here's your GitHub launch code, @Hank3r-gh! + +

+
+ + + + + + +
 
+ +
+ + + + +
+ + + + +
+ + + + +
+ +an octocat standing next to a rocket + + + + + + + +
 
+ + + + Continue signing up for GitHub by entering the code below: + + + + + + + + +
 
+ + +21337452 + + + + + + + +
 
+ + + + + + +
+ + + + +
+ Open GitHub +
+
+ + + + +
+
+
+ + + + + +
+ + + + + + +
 
+ + + + + + + + + +
+ + + + + +
+ Once completed, you can start using all of GitHub's features to explore, build, and share projects. + + + + + + + +
 
+ + + Not able to enter the code? Paste the following link into your browser:
+ https://github.com/users/Hank3r-gh/emails/253608093/confirm_verification/21337452?via_launch_code_email=true +
+
+ +
+
+ + + + + +
+ + + + + + +
 
+ +

+ Email preferences ・ + Terms ・ + Privacy ・ + Sign in to GitHub +

+ + + + + + +
 
+ +

You’re receiving this email because you recently created a new GitHub account. If this wasn’t you, please ignore this email. +

+
+ + + + +
+ + + + + + +
 
+ +

GitHub, Inc. ・88 Colin P Kelly Jr Street ・San Francisco, CA 94107

+
+ +
+
+ +
                                                           
+ + + +----==_mimepart_6445153ca0e93_38bbc97c25a9-- +` + function extractData(data) { const pattern = /Content-Type: multipart\/alternative; boundary="([^"]*)"/; const match = data.match(pattern); @@ -97,11 +377,11 @@ function extractData(data) { return [ split[1].replace(/Content-Type:[^<]+/, ''), split[2].replace(/Content-Type:[^<]+/, '') ]; } -console.log(extractData(testData)); +console.log(extractData(testData2)); -console.log(extractData(testData)[0]); -console.log(extractData(testData)[1]); -console.log(extractData(testData)[2]); +console.log(extractData(testData2)[0]); +console.log(extractData(testData2)[1]); +console.log(extractData(testData2)[2]); newBtn.addEventListener("click", () => { From 5097cad08a20abadeecf190f99da32ae770af38d Mon Sep 17 00:00:00 2001 From: Nite <67828948+Niteletsplay@users.noreply.github.com> Date: Thu, 24 Aug 2023 21:45:39 +0200 Subject: [PATCH 10/11] I hate regex --- web/css/tempmail.css | 13 +- web/js/tempmail.js | 611 ++++++++++++++-------------- web/ts-gen/config.ts | 55 +++ web/ts-gen/mapservicecheckresult.ts | 11 + web/ts-gen/person.ts | 407 ++++++++++++++++++ web/ts-gen/servicecheckresult.ts | 103 +++++ 6 files changed, 890 insertions(+), 310 deletions(-) create mode 100644 web/ts-gen/config.ts create mode 100644 web/ts-gen/mapservicecheckresult.ts create mode 100644 web/ts-gen/person.ts create mode 100644 web/ts-gen/servicecheckresult.ts diff --git a/web/css/tempmail.css b/web/css/tempmail.css index 54f8b258..e8aa597c 100644 --- a/web/css/tempmail.css +++ b/web/css/tempmail.css @@ -186,8 +186,10 @@ color: var(--textColor-1); align-items: unset; transition: 0.3s ease; - padding: 2rem; + padding: 1.5rem; flex-direction: column; + height: fit-content; + max-height: 33.3%; } .mail-content-detail { @@ -204,15 +206,12 @@ margin-top: 0.5rem; font-weight: bold; font-size: 2rem; - white-space: nowrap; + display: block !important; + white-space: initial; overflow: hidden; text-overflow: ellipsis; - display: block !important; -} - -#content-mail-header { width: 100%; - height: 100%; + height: fit-content; } #mail-loading-spinner { diff --git a/web/js/tempmail.js b/web/js/tempmail.js index f03f7bfe..c257cbd8 100644 --- a/web/js/tempmail.js +++ b/web/js/tempmail.js @@ -83,305 +83,305 @@ Content-Type: text/html; charset="UTF-8" --0000000000007c7e1505f9f0e7ee--` -const testData2 = ` -Received: from github-highworker-4bd0f4f.ash1-iad.github.net (github-highworker-4bd0f4f.ash1-iad.github.net [10.56.101.39]) - by smtp.github.com (Postfix) with ESMTP id 84965600267 - for ; Sun, 23 Apr 2023 04:23:41 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; - s=pf2023; t=1682249021; - bh=gV4eli2RcwC8Awt098BQtuQYbJLMi6j0s+4MYVSrMsQ=; - h=Date:From:To:Subject:From; - b=gRCOkHgxgI4+E55xLQ4RF8rV202u9jzWBU0w4LDIU4Mum1oMFk94Xvf5j+EOv514G - kUeMEGM2GY7EoWu4cKBGBaw1dXw6tH4UL97VpxBcIIsc4YKX9igQK07aXk0r05krHA - 3yewxyKFgFFvgf9cD/8Tya/gt1fGhg9AtCe6q95o= -Date: Sun, 23 Apr 2023 04:23:41 -0700 -From: GitHub -To: Hank3r-gh -Message-ID: <6445153d76bc7_38bbc97c26a3@github-highworker-4bd0f4f.ash1-iad.github.net.mail> -Subject: =?UTF-8?Q?=F0=9F=9A=80_Your_GitHub_launch_code?= -Mime-Version: 1.0 -Content-Type: multipart/alternative; - boundary="--==_mimepart_6445153ca0e93_38bbc97c25a9"; - charset=UTF-8 -Content-Transfer-Encoding: 7bit -X-Auto-Response-Suppress: All - - -----==_mimepart_6445153ca0e93_38bbc97c25a9 -Content-Type: text/plain; - charset=UTF-8 -Content-Transfer-Encoding: quoted-printable - -Here's your GitHub launch code, @Hank3r-gh! - -Continue signing up for GitHub by entering the code below: - -21337452 - -You can enter it by visiting the link below: - -https://github.com/account_verifications?via_launch_code_email=3Dtrue - -You=E2=80=99re receiving this email because you recently created a new Gi= -tHub account. If this wasn=E2=80=99t you, please ignore this email. - -Not able to enter the code? Paste the following link into your browser: - -https://github.com/users/Hank3r-gh/emails/253608093/confirm_verification/= -21337452?via_launch_code_email=3Dtrue - ---- -Sent with <3 by GitHub. -GitHub, Inc. 88 Colin P Kelly Jr Street -San Francisco, CA 94107 - -----==_mimepart_6445153ca0e93_38bbc97c25a9 -Content-Type: text/html; - charset=UTF-8 -Content-Transfer-Encoding: 7bit - - - - - - - +// const testData2 = ` +// Received: from github-highworker-4bd0f4f.ash1-iad.github.net (github-highworker-4bd0f4f.ash1-iad.github.net [10.56.101.39]) +// by smtp.github.com (Postfix) with ESMTP id 84965600267 +// for ; Sun, 23 Apr 2023 04:23:41 -0700 (PDT) +// DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; +// s=pf2023; t=1682249021; +// bh=gV4eli2RcwC8Awt098BQtuQYbJLMi6j0s+4MYVSrMsQ=; +// h=Date:From:To:Subject:From; +// b=gRCOkHgxgI4+E55xLQ4RF8rV202u9jzWBU0w4LDIU4Mum1oMFk94Xvf5j+EOv514G +// kUeMEGM2GY7EoWu4cKBGBaw1dXw6tH4UL97VpxBcIIsc4YKX9igQK07aXk0r05krHA +// 3yewxyKFgFFvgf9cD/8Tya/gt1fGhg9AtCe6q95o= +// Date: Sun, 23 Apr 2023 04:23:41 -0700 +// From: GitHub +// To: Hank3r-gh +// Message-ID: <6445153d76bc7_38bbc97c26a3@github-highworker-4bd0f4f.ash1-iad.github.net.mail> +// Subject: =?UTF-8?Q?=F0=9F=9A=80_Your_GitHub_launch_code?= +// Mime-Version: 1.0 +// Content-Type: multipart/alternative; +// boundary="--==_mimepart_6445153ca0e93_38bbc97c25a9"; +// charset=UTF-8 +// Content-Transfer-Encoding: 7bit +// X-Auto-Response-Suppress: All + + +// ----==_mimepart_6445153ca0e93_38bbc97c25a9 +// Content-Type: text/plain; +// charset=UTF-8 +// Content-Transfer-Encoding: quoted-printable + +// Here's your GitHub launch code, @Hank3r-gh! + +// Continue signing up for GitHub by entering the code below: + +// 21337452 + +// You can enter it by visiting the link below: + +// https://github.com/account_verifications?via_launch_code_email=3Dtrue + +// You=E2=80=99re receiving this email because you recently created a new Gi= +// tHub account. If this wasn=E2=80=99t you, please ignore this email. + +// Not able to enter the code? Paste the following link into your browser: + +// https://github.com/users/Hank3r-gh/emails/253608093/confirm_verification/= +// 21337452?via_launch_code_email=3Dtrue + +// --- +// Sent with <3 by GitHub. +// GitHub, Inc. 88 Colin P Kelly Jr Street +// San Francisco, CA 94107 + +// ----==_mimepart_6445153ca0e93_38bbc97c25a9 +// Content-Type: text/html; +// charset=UTF-8 +// Content-Transfer-Encoding: 7bit + +// +// +// +// +// +// - - - - - +// +//
-
- - - - -
- - - - - - -
 
- - - - - -
- GitHub -

- Here's your GitHub launch code, @Hank3r-gh! - -

-
- - - - - - -
 
- -
- - - + +// +// +//
- - - - -
- - - +// +//
+// +// +// +// +// +// +//
+//
+// +// +// +// +//
+// +// +// +// +// +// +//
 
+ +// +// +// +// +//
+// GitHub +//

+// Here's your GitHub launch code, @Hank3r-gh! + +//

+//
+// +// +// +// +// +// +//
 
+ +//
+// +// +// - -
+// +// +// - -
+// +// +// - -
-an octocat standing next to a rocket - - - - - - - -
 
- - - - Continue signing up for GitHub by entering the code below: - - - - - - - - -
 
- - -21337452 - - - - - - - -
 
- - - - - - -
- - - - -
- Open GitHub -
-
- - - - -
-
-
- - - - +// +//
- - - - - - -
 
- - - - +// an octocat standing next to a rocket + +//
+// +// +// +// +// +//
 
+ + +// +// Continue signing up for GitHub by entering the code below: +// + +// +// +// +// +// +// +//
 
+ + +// 21337452 + +// +// +// +// +// +// +//
 
+ + +// +// +// +// +//
+// +// +// +// +//
+// Open GitHub +//
+//
+ + + + +//
+//
+//
+ +// +// +// - -
+// +// +// +// +// +// +//
 
+ +// +// +// - - - - -
- - - - - -
- Once completed, you can start using all of GitHub's features to explore, build, and share projects. - - - - - - - -
 
- - - Not able to enter the code? Paste the following link into your browser:
- https://github.com/users/Hank3r-gh/emails/253608093/confirm_verification/21337452?via_launch_code_email=true -
-
- -
-
- - - - - -
- - - - - - -
 
- -

- Email preferences ・ - Terms ・ - Privacy ・ - Sign in to GitHub -

- - - - - - -
 
- -

You’re receiving this email because you recently created a new GitHub account. If this wasn’t you, please ignore this email. -

-
- - - - -
- - - - - - -
 
- -

GitHub, Inc. ・88 Colin P Kelly Jr Street ・San Francisco, CA 94107

-
- - -
- -
                                                           
- - - -----==_mimepart_6445153ca0e93_38bbc97c25a9-- -` - -function extractData(data) { - const pattern = /Content-Type: multipart\/alternative; boundary="([^"]*)"/; - const match = data.match(pattern); - if (!match) { - throw new Error("Invalid data: missing boundary"); - } - const boundary = match[1]; - const split = data.split(`--${boundary}`); - if (split.length < 4) { - throw new Error("Invalid data: not enough parts"); - } - return [ split[1].replace(/Content-Type:[^<]+/, ''), split[2].replace(/Content-Type:[^<]+/, '') ]; -} - -console.log(extractData(testData2)); - -console.log(extractData(testData2)[0]); -console.log(extractData(testData2)[1]); -console.log(extractData(testData2)[2]); +//
+// +// +// +// +// +//
+// Once completed, you can start using all of GitHub's features to explore, build, and share projects. + +// +// +// +// +// +// +//
 
+ + +// Not able to enter the code? Paste the following link into your browser:
+// https://github.com/users/Hank3r-gh/emails/253608093/confirm_verification/21337452?via_launch_code_email=true +//
+//
+ +//
+//
+ +// +// +// +// +//
+// +// +// +// +// +// +//
 
+ +//

+// Email preferences ・ +// Terms ・ +// Privacy ・ +// Sign in to GitHub +//

+// +// +// +// +// +// +//
 
+ +//

You’re receiving this email because you recently created a new GitHub account. If this wasn’t you, please ignore this email. +//

+//
+// +// +// +// +//
+// +// +// +// +// +// +//
 
+ +//

GitHub, Inc. ・88 Colin P Kelly Jr Street ・San Francisco, CA 94107

+//
+ +// +// +// +// +// +//
                                                           
+// +// + +// ----==_mimepart_6445153ca0e93_38bbc97c25a9-- +// ` + +// function extractData(data) { +// const pattern = /Content-Type: multipart\/alternative; boundary="([^"]*)"/; +// const match = data.match(pattern); +// if (!match) { +// throw new Error("Invalid data: missing boundary"); +// } +// const boundary = match[1]; +// const split = data.split(`--${boundary}`); +// if (split.length < 4) { +// throw new Error("Invalid data: not enough parts"); +// } +// return [ split[1].replace(/Content-Type:[^<]+/, ''), split[2].replace(/Content-Type:[^<]+/, '') ]; +// } + +// console.log(extractData(testData2)); + +// console.log(extractData(testData2)[0]); +// console.log(extractData(testData2)[1]); +// console.log(extractData(testData2)[2]); newBtn.addEventListener("click", () => { @@ -470,6 +470,11 @@ refreshBtn.addEventListener("click", () => { console.log(data.result); + // Delete old mail chips + while (mailListFrame.firstChild) { + mailListFrame.removeChild(mailListFrame.firstChild); + } + // Get messages using IDs if (data.result.length > 0) { @@ -505,7 +510,7 @@ refreshBtn.addEventListener("click", () => { const mailHeader = document.createElement("p"); mailHeader.className = "mail-chip-detail mail-header"; - mailHeader.innerHTML = data.result[i].value.split("Subject: ")[1].split("\r\nTo: ")[0]; + mailHeader.innerHTML = data.result[i].value.split("Subject: ")[1].split("From: ")[0]; mailListFrame.appendChild(mailChip); @@ -518,14 +523,14 @@ refreshBtn.addEventListener("click", () => { mailDetailsDate.innerHTML = data.result[i].value.split("Date: ")[1].split("\r\nMessage-ID")[0].match(/\d{2}:\d{2}/)[0]; mailDetailsSender.innerHTML = data.result[i].value.split("From: ")[1].split("\r\nDate:")[0].match(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/)[0]; - mailDetailsHeader.innerHTML = data.result[i].value.split("Subject: ")[1].split("\r\nTo: ")[0]; + mailDetailsHeader.innerHTML = data.result[i].value.split("Subject: ")[1].split("From: ")[0]; + + console.log(data.result[i].value.split("Subject: ")[1].split("From: ")[0]); + let actualData = data.result[i].value - console.log(extractData(actualData)[0]); - console.log(extractData(actualData)[1]); - iframe = document.getElementById('content-mail-body-iframe'); - iframe.srcdoc = extractData(actualData)[1] - //console.log(mailDetailsBody.innerHTML); + const myIframe = document.getElementById('content-mail-body-iframe'); + myIframe.srcdoc = "" + actualData.split("")[1].split("")[0]; }); } } else { diff --git a/web/ts-gen/config.ts b/web/ts-gen/config.ts new file mode 100644 index 00000000..754f0d5f --- /dev/null +++ b/web/ts-gen/config.ts @@ -0,0 +1,55 @@ +/* Do not change, this code is generated from Golang structs */ + + +export class General { + force_port: boolean; + browser: boolean; + discord: boolean; + workers: number; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.force_port = source["force_port"]; + this.browser = source["browser"]; + this.discord = source["discord"]; + this.workers = source["workers"]; + } +} +export class Server { + port: number; + ip: string; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.port = source["port"]; + this.ip = source["ip"]; + } +} +export class Config { + server: Server; + general: General; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.server = this.convertValues(source["server"], Server); + this.general = this.convertValues(source["general"], General); + } + + convertValues(a: any, classs: any, asMap: boolean = false): any { + if (!a) { + return a; + } + if (a.slice) { + return (a as any[]).map(elem => this.convertValues(elem, classs)); + } else if ("object" === typeof a) { + if (asMap) { + for (const key of Object.keys(a)) { + a[key] = new classs(a[key]); + } + return a; + } + return new classs(a); + } + return a; + } +} \ No newline at end of file diff --git a/web/ts-gen/mapservicecheckresult.ts b/web/ts-gen/mapservicecheckresult.ts new file mode 100644 index 00000000..11d02929 --- /dev/null +++ b/web/ts-gen/mapservicecheckresult.ts @@ -0,0 +1,11 @@ +/* Do not change, this code is generated from Golang structs */ + + +export class MapServiceCheckResult { + + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + + } +} \ No newline at end of file diff --git a/web/ts-gen/person.ts b/web/ts-gen/person.ts new file mode 100644 index 00000000..2beb1b9f --- /dev/null +++ b/web/ts-gen/person.ts @@ -0,0 +1,407 @@ +/* Do not change, this code is generated from Golang structs */ + + +export class Bio { + bio: string; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.bio = source["bio"]; + } +} +export class Account { + service: string; + id: string; + username: string; + url: string; + profilePicture: {[key: string]: Picture}; + bio: {[key: string]: Bio}; + firstname: string; + lastname: string; + location: string; + created: string; + updated: string; + blog: string; + followers: number; + following: number; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.service = source["service"]; + this.id = source["id"]; + this.username = source["username"]; + this.url = source["url"]; + this.profilePicture = this.convertValues(source["profilePicture"], Picture, true); + this.bio = this.convertValues(source["bio"], Bio, true); + this.firstname = source["firstname"]; + this.lastname = source["lastname"]; + this.location = source["location"]; + this.created = source["created"]; + this.updated = source["updated"]; + this.blog = source["blog"]; + this.followers = source["followers"]; + this.following = source["following"]; + } + + convertValues(a: any, classs: any, asMap: boolean = false): any { + if (!a) { + return a; + } + if (a.slice) { + return (a as any[]).map(elem => this.convertValues(elem, classs)); + } else if ("object" === typeof a) { + if (asMap) { + for (const key of Object.keys(a)) { + a[key] = new classs(a[key]); + } + return a; + } + return new classs(a); + } + return a; + } +} +export class Tag { + name: string; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.name = source["name"]; + } +} +export class Errors { + exists: any; + info: any; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.exists = source["exists"]; + this.info = source["info"]; + } +} +export class AccountInfo { + url: string; + profile_picture: { latest: { data: string } } ; + bio: { latest: { data: {bio: string} } }; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.url = source["url"]; + this.profile_picture = source["profile_picture"]; + this.bio = source["bio"]; + } +} +export class Service { + name: string; + domain: string; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.name = source["name"]; + this.domain = source["domain"]; + } +} +export class User { + Username: string; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.Username = source["Username"]; + } +} +export class InputData { + user: User; + service: Service; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.user = this.convertValues(source["user"], User); + this.service = this.convertValues(source["service"], Service); + } + + convertValues(a: any, classs: any, asMap: boolean = false): any { + if (!a) { + return a; + } + if (a.slice) { + return (a as any[]).map(elem => this.convertValues(elem, classs)); + } else if ("object" === typeof a) { + if (asMap) { + for (const key of Object.keys(a)) { + a[key] = new classs(a[key]); + } + return a; + } + return new classs(a); + } + return a; + } +} +export class ServiceCheckResult { + input_data: InputData; + exists: boolean; + info: AccountInfo; + errors: Errors; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.input_data = this.convertValues(source["input_data"], InputData); + this.exists = source["exists"]; + this.info = this.convertValues(source["info"], AccountInfo); + this.errors = this.convertValues(source["errors"], Errors); + } + + convertValues(a: any, classs: any, asMap: boolean = false): any { + if (!a) { + return a; + } + if (a.slice) { + return (a as any[]).map(elem => this.convertValues(elem, classs)); + } else if ("object" === typeof a) { + if (asMap) { + for (const key of Object.keys(a)) { + a[key] = new classs(a[key]); + } + return a; + } + return new classs(a); + } + return a; + } +} +export class Source { + url: string; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.url = source["url"]; + } +} +export class Club { + club: string; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.club = source["club"]; + } +} +export class EmailService { + name: string; + link: string; + username: string; + icon: string; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.name = source["name"]; + this.link = source["link"]; + this.username = source["username"]; + this.icon = source["icon"]; + } +} +export class Email { + mail: string; + value: number; + src: string; + services: {[key: string]: EmailService}; + skipped_services: {[key: string]: boolean}; + valid: boolean; + provider: string; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.mail = source["mail"]; + this.value = source["value"]; + this.src = source["src"]; + this.services = this.convertValues(source["services"], EmailService, true); + this.skipped_services = source["skipped_services"]; + this.valid = source["valid"]; + this.provider = source["provider"]; + } + + convertValues(a: any, classs: any, asMap: boolean = false): any { + if (!a) { + return a; + } + if (a.slice) { + return (a as any[]).map(elem => this.convertValues(elem, classs)); + } else if ("object" === typeof a) { + if (asMap) { + for (const key of Object.keys(a)) { + a[key] = new classs(a[key]); + } + return a; + } + return new classs(a); + } + return a; + } +} +export class Hobby { + hobby: string; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.hobby = source["hobby"]; + } +} +export class Ip { + ip: string; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.ip = source["ip"]; + } +} +export class Number { + Valid: boolean; + RawLocal: string; + Local: string; + E164: string; + International: string; + CountryCode: number; + Country: string; + Carrier: string; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.Valid = source["Valid"]; + this.RawLocal = source["RawLocal"]; + this.Local = source["Local"]; + this.E164 = source["E164"]; + this.International = source["International"]; + this.CountryCode = source["CountryCode"]; + this.Country = source["Country"]; + this.Carrier = source["Carrier"]; + } +} +export class PhoneNumber { + number: string; + valid: boolean; + national_format: string; + tag: string; + phoneinfoga: Number; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.number = source["number"]; + this.valid = source["valid"]; + this.national_format = source["national_format"]; + this.tag = source["tag"]; + this.phoneinfoga = this.convertValues(source["phoneinfoga"], Number); + } + + convertValues(a: any, classs: any, asMap: boolean = false): any { + if (!a) { + return a; + } + if (a.slice) { + return (a as any[]).map(elem => this.convertValues(elem, classs)); + } else if ("object" === typeof a) { + if (asMap) { + for (const key of Object.keys(a)) { + a[key] = new classs(a[key]); + } + return a; + } + return new classs(a); + } + return a; + } +} +export class Picture { + img: string; + img_hash: number; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.img = source["img"]; + this.img_hash = source["img_hash"]; + } +} +export class Person { + id: string; + name: string; + gender: string; + ethnicity: string; + pictures: {[key: string]: Picture}; + maidenname: string; + age: number; + bday: string; + address: string; + phone: {[key: string]: PhoneNumber}; + ips: {[key: string]: Ip}; + civilstatus: string; + kids: string; + hobbies: {[key: string]: Hobby}; + email: {[key: string]: Email}; + occupation: string; + prevoccupation: string; + education: string; + military: string; + religion: string; + pets: string; + clubs: {[key: string]: Club}; + legal: string; + political: string; + notes: string; + relations: {[key: string]: string[]}; + sources: {[key: string]: Source}; + accounts: {[key: string]: ServiceCheckResult}; + tags: Tag[]; + notaccounts: {[key: string]: Account}; + custom: any; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.id = source["id"] || ''; + this.name = source["name"] || ''; + this.gender = source["gender"] || ''; + this.ethnicity = source["ethnicity"] || ''; + this.pictures = this.convertValues(source["pictures"], Picture, true); + this.maidenname = source["maidenname"] || ''; + this.age = source["age"]; + this.bday = source["bday"] || ''; + this.address = source["address"] || ''; + this.phone = this.convertValues(source["phone"], PhoneNumber, true); + this.ips = this.convertValues(source["ips"], Ip, true); + this.civilstatus = source["civilstatus"] || ''; + this.kids = source["kids"] || ''; + this.hobbies = this.convertValues(source["hobbies"], Hobby, true); + this.email = this.convertValues(source["email"], Email, true); + this.occupation = source["occupation"] || ''; + this.prevoccupation = source["prevoccupation"] || ''; + this.education = source["education"] || ''; + this.military = source["military"] || ''; + this.religion = source["religion"] || ''; + this.pets = source["pets"] || ''; + this.clubs = this.convertValues(source["clubs"], Club, true); + this.legal = source["legal"] || ''; + this.political = source["political"] || ''; + this.notes = source["notes"] || ''; + this.relations = source["relations"]; + this.sources = this.convertValues(source["sources"], Source, true); + this.accounts = this.convertValues(source["accounts"], ServiceCheckResult, true); + this.tags = this.convertValues(source["tags"], Tag); + this.notaccounts = this.convertValues(source["notaccounts"], Account, true); + this.custom = source["custom"]; + } + + convertValues(a: any, classs: any, asMap: boolean = false): any { + if (!a) { + return a; + } + if (a.slice) { + return (a as any[]).map(elem => this.convertValues(elem, classs)); + } else if ("object" === typeof a) { + if (asMap) { + for (const key of Object.keys(a)) { + a[key] = new classs(a[key]); + } + return a; + } + return new classs(a); + } + return a; + } +} \ No newline at end of file diff --git a/web/ts-gen/servicecheckresult.ts b/web/ts-gen/servicecheckresult.ts new file mode 100644 index 00000000..b668371d --- /dev/null +++ b/web/ts-gen/servicecheckresult.ts @@ -0,0 +1,103 @@ +/* Do not change, this code is generated from Golang structs */ + + +export class Errors { + exists: any; + info: any; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.exists = source["exists"]; + this.info = source["info"]; + } +} +export class AccountInfo { + url: string; + profile_picture: { latest: { data: string } } ; + bio: { latest: { data: {bio: string} } }; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.url = source["url"]; + this.profile_picture = source["profile_picture"]; + this.bio = source["bio"]; + } +} +export class Service { + name: string; + domain: string; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.name = source["name"]; + this.domain = source["domain"]; + } +} +export class User { + Username: string; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.Username = source["Username"]; + } +} +export class InputData { + user: User; + service: Service; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.user = this.convertValues(source["user"], User); + this.service = this.convertValues(source["service"], Service); + } + + convertValues(a: any, classs: any, asMap: boolean = false): any { + if (!a) { + return a; + } + if (a.slice) { + return (a as any[]).map(elem => this.convertValues(elem, classs)); + } else if ("object" === typeof a) { + if (asMap) { + for (const key of Object.keys(a)) { + a[key] = new classs(a[key]); + } + return a; + } + return new classs(a); + } + return a; + } +} +export class ServiceCheckResult { + input_data: InputData; + exists: boolean; + info: AccountInfo; + errors: Errors; + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.input_data = this.convertValues(source["input_data"], InputData); + this.exists = source["exists"]; + this.info = this.convertValues(source["info"], AccountInfo); + this.errors = this.convertValues(source["errors"], Errors); + } + + convertValues(a: any, classs: any, asMap: boolean = false): any { + if (!a) { + return a; + } + if (a.slice) { + return (a as any[]).map(elem => this.convertValues(elem, classs)); + } else if ("object" === typeof a) { + if (asMap) { + for (const key of Object.keys(a)) { + a[key] = new classs(a[key]); + } + return a; + } + return new classs(a); + } + return a; + } +} \ No newline at end of file From 8b23a1fb37c7135ce595de919a6d6c80f6a784cd Mon Sep 17 00:00:00 2001 From: Nite <67828948+Niteletsplay@users.noreply.github.com> Date: Thu, 24 Aug 2023 21:49:13 +0200 Subject: [PATCH 11/11] Remove test data --- web/js/tempmail.js | 353 --------------------------------------------- 1 file changed, 353 deletions(-) diff --git a/web/js/tempmail.js b/web/js/tempmail.js index c257cbd8..d122274b 100644 --- a/web/js/tempmail.js +++ b/web/js/tempmail.js @@ -30,359 +30,6 @@ const mailToken = document.getElementById("mail-token"); const loadingSpinner = document.getElementById("mail-loading-spinner"); const refreshLoadingSpinner = document.getElementById("refresh-loading-spinner"); -const testData1 = `Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-505934ccc35so4855281a12.2 -for ; Sat, 22 Apr 2023 11:25:56 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; -d=gmail.com; s=20221208; t=1682187955; x=1684779955; -h=to:subject:message-id:date:from:mime-version:from:to:cc:subject - :date:message-id:reply-to; -bh=lum9DbkH3N1hbHsgEq0AlY9Wwvjg7O89ppGKncH3YzU=; -b=VIkhYF2Nr6vXKnB5Qmh3F5c1q4HS5Eky65vXOBqWBEBcdrwZ20rV5s4nW+KpSEY3iA - SahhN3+kqmNtCw8exeS5NYq2vU63HwpR0iFkizVD2LiiocngUOza0GuBdbLZSTk05Twj - P2X4i58h9UGDW1DPhGgM1fi4FaFC3fhrT2i9lqJqVow9PVcc3D/WxE5XNkruiZFnqBxX - CdJPMOm6szAUasdZnWc72gc4YtW1/x053VDfCZOyt37WJHOkKKpjT6dsuhrX0LMKaZUv - jwzRzRbngZPUCdRBiFAAUACal3+iGtpYgFJ8zmIdZjRrXpf+MDjJw5S51hzXZvTniI2H - WZLQ== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; -d=1e100.net; s=20221208; t=1682187955; x=1684779955; -h=to:subject:message-id:date:from:mime-version:x-gm-message-state - :from:to:cc:subject:date:message-id:reply-to; -bh=lum9DbkH3N1hbHsgEq0AlY9Wwvjg7O89ppGKncH3YzU=; -b=k2KaUIF2Mqg5DWQd2JtjsrM7s4WDXCAWhAB9XrSei/M84jVlRNAti/YTocJfxR/7Ef - aCD56/prn40sMIuDJr/5lpHA+Rvs0tQmw2MXNSv8wS4MSJjW1tKBwACrTIKGquAlLkKq - ulzMvMSFCVJ7pwnGuCdTINxS/lg4HB+CHQeK1S2Adq3cP38m4gZ4gO5OiGPOJUPFMyAY - QdclJJTqhkA1PeiJltlGPUsvUSPI8Ej+GFrfxJvcyCLH7dp3/WPU75uz6B9iPHC3hxTd - B7JWvbEqEDsToYz1z21riOLytN1zJspWbb4pBLJ329iMJ2tS+cqaNF/VmWkVskmb8Knw - wncg== -X-Gm-Message-State: AAQBX9eNMYf4aE9hcokkjxO0vODcrA8Bbto7nPJydt6vtiX1PFVGz3vS -9RZcz6uYpf5Z7qh1+FtlHL7fBUFujaxfDVYrCRBlETltdPGug+5C -X-Google-Smtp-Source: AKy350YNtfiDyAjHCur4oE25fF/xOt7AVfoh7lXY8nYP/QG3IhYNHeyDSy52PsnjmQmjtDY/6TzQlNYaRBYFohA9IOA= -X-Received: by 2002:aa7:d281:0:b0:506:b88a:cab4 with SMTP id -w1-20020aa7d281000000b00506b88acab4mr7984149edq.3.1682187954715; Sat, 22 Apr -2023 11:25:54 -0700 (PDT) -MIME-Version: 1.0 -From: Tom Spitz -Date: Sat, 22 Apr 2023 18:25:43 +0000 -Message-ID: -Subject: js suck -To: z-tpwpj5@developermail.com -Content-Type: multipart/alternative; boundary="0000000000007c7e1505f9f0e7ee" - ---0000000000007c7e1505f9f0e7ee -Content-Type: text/plain; charset="UTF-8" - -js -suck -suck -suck - ---0000000000007c7e1505f9f0e7ee -Content-Type: text/html; charset="UTF-8" - -
js
suck
suck
suck
- ---0000000000007c7e1505f9f0e7ee--` - -// const testData2 = ` -// Received: from github-highworker-4bd0f4f.ash1-iad.github.net (github-highworker-4bd0f4f.ash1-iad.github.net [10.56.101.39]) -// by smtp.github.com (Postfix) with ESMTP id 84965600267 -// for ; Sun, 23 Apr 2023 04:23:41 -0700 (PDT) -// DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; -// s=pf2023; t=1682249021; -// bh=gV4eli2RcwC8Awt098BQtuQYbJLMi6j0s+4MYVSrMsQ=; -// h=Date:From:To:Subject:From; -// b=gRCOkHgxgI4+E55xLQ4RF8rV202u9jzWBU0w4LDIU4Mum1oMFk94Xvf5j+EOv514G -// kUeMEGM2GY7EoWu4cKBGBaw1dXw6tH4UL97VpxBcIIsc4YKX9igQK07aXk0r05krHA -// 3yewxyKFgFFvgf9cD/8Tya/gt1fGhg9AtCe6q95o= -// Date: Sun, 23 Apr 2023 04:23:41 -0700 -// From: GitHub -// To: Hank3r-gh -// Message-ID: <6445153d76bc7_38bbc97c26a3@github-highworker-4bd0f4f.ash1-iad.github.net.mail> -// Subject: =?UTF-8?Q?=F0=9F=9A=80_Your_GitHub_launch_code?= -// Mime-Version: 1.0 -// Content-Type: multipart/alternative; -// boundary="--==_mimepart_6445153ca0e93_38bbc97c25a9"; -// charset=UTF-8 -// Content-Transfer-Encoding: 7bit -// X-Auto-Response-Suppress: All - - -// ----==_mimepart_6445153ca0e93_38bbc97c25a9 -// Content-Type: text/plain; -// charset=UTF-8 -// Content-Transfer-Encoding: quoted-printable - -// Here's your GitHub launch code, @Hank3r-gh! - -// Continue signing up for GitHub by entering the code below: - -// 21337452 - -// You can enter it by visiting the link below: - -// https://github.com/account_verifications?via_launch_code_email=3Dtrue - -// You=E2=80=99re receiving this email because you recently created a new Gi= -// tHub account. If this wasn=E2=80=99t you, please ignore this email. - -// Not able to enter the code? Paste the following link into your browser: - -// https://github.com/users/Hank3r-gh/emails/253608093/confirm_verification/= -// 21337452?via_launch_code_email=3Dtrue - -// --- -// Sent with <3 by GitHub. -// GitHub, Inc. 88 Colin P Kelly Jr Street -// San Francisco, CA 94107 - -// ----==_mimepart_6445153ca0e93_38bbc97c25a9 -// Content-Type: text/html; -// charset=UTF-8 -// Content-Transfer-Encoding: 7bit - -// -// -// -// -// -// - -// -// -// -// -// -// -//
-//
-// -// -// -// -//
-// -// -// -// -// -// -//
 
- -// -// -// -// -//
-// GitHub -//

-// Here's your GitHub launch code, @Hank3r-gh! - -//

-//
-// -// -// -// -// -// -//
 
- -//
-// -// -// -// -//
-// -// -// -// -//
-// -// -// -// -//
- -// an octocat standing next to a rocket - -// -// -// -// -// -// -//
 
- - -// -// Continue signing up for GitHub by entering the code below: -// - -// -// -// -// -// -// -//
 
- - -// 21337452 - -// -// -// -// -// -// -//
 
- - -// -// -// -// -//
-// -// -// -// -//
-// Open GitHub -//
-//
- - - - -//
-//
-//
- -// -// -// -// -//
-// -// -// -// -// -// -//
 
- -// -// -// - -// - -// -// -//
-// -// -// -// -// -//
-// Once completed, you can start using all of GitHub's features to explore, build, and share projects. - -// -// -// -// -// -// -//
 
- - -// Not able to enter the code? Paste the following link into your browser:
-// https://github.com/users/Hank3r-gh/emails/253608093/confirm_verification/21337452?via_launch_code_email=true -//
-//
- -//
-//
- -// -// -// -// -//
-// -// -// -// -// -// -//
 
- -//

-// Email preferences ・ -// Terms ・ -// Privacy ・ -// Sign in to GitHub -//

-// -// -// -// -// -// -//
 
- -//

You’re receiving this email because you recently created a new GitHub account. If this wasn’t you, please ignore this email. -//

-//
-// -// -// -// -//
-// -// -// -// -// -// -//
 
- -//

GitHub, Inc. ・88 Colin P Kelly Jr Street ・San Francisco, CA 94107

-//
- -//
-//
-// -//
                                                           
-// -// - -// ----==_mimepart_6445153ca0e93_38bbc97c25a9-- -// ` - -// function extractData(data) { -// const pattern = /Content-Type: multipart\/alternative; boundary="([^"]*)"/; -// const match = data.match(pattern); -// if (!match) { -// throw new Error("Invalid data: missing boundary"); -// } -// const boundary = match[1]; -// const split = data.split(`--${boundary}`); -// if (split.length < 4) { -// throw new Error("Invalid data: not enough parts"); -// } -// return [ split[1].replace(/Content-Type:[^<]+/, ''), split[2].replace(/Content-Type:[^<]+/, '') ]; -// } - -// console.log(extractData(testData2)); - -// console.log(extractData(testData2)[0]); -// console.log(extractData(testData2)[1]); -// console.log(extractData(testData2)[2]); - newBtn.addEventListener("click", () => { if (mailToken.innerHTML == "") {