updated to use HTTPS
This commit is contained in:
12
main.js
12
main.js
@@ -24,7 +24,7 @@ if (document.getElementById('registerForm')) {
|
||||
e.preventDefault();
|
||||
const username = document.getElementById('registerUsername').value;
|
||||
const password = document.getElementById('registerPassword').value;
|
||||
const res = await fetch('http://bangmail.org:8080/users', {
|
||||
const res = await fetch('https://bangmail.org:8080/users', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ username, password })
|
||||
@@ -46,7 +46,7 @@ if (document.getElementById('loginForm')) {
|
||||
const username = document.getElementById('loginUsername').value;
|
||||
const password = document.getElementById('loginPassword').value;
|
||||
// Try to fetch mailbox to verify credentials
|
||||
const res = await fetch(`http://bangmail.org:8080/mailbox?user=${encodeURIComponent(username)}`, {
|
||||
const res = await fetch(`https://bangmail.org:8080/mailbox?user=${encodeURIComponent(username)}`, {
|
||||
headers: { 'Authorization': 'Basic ' + btoa(username + ':' + password) }
|
||||
});
|
||||
if (res.ok) {
|
||||
@@ -64,7 +64,7 @@ if (document.getElementById('email-list')) {
|
||||
if (!username || !password) {
|
||||
window.location.href = 'login.html';
|
||||
} else {
|
||||
fetch(`http://bangmail.org:8080/mailbox?user=${encodeURIComponent(username)}`, {
|
||||
fetch(`https://bangmail.org:8080/mailbox?user=${encodeURIComponent(username)}`, {
|
||||
headers: { 'Authorization': 'Basic ' + btoa(username + ':' + password) }
|
||||
})
|
||||
.then(res => res.json())
|
||||
@@ -187,7 +187,7 @@ if (document.getElementById('email-list')) {
|
||||
// Send POST to /mailbox/open to indicate message was opened
|
||||
const { username, password } = getCredentials();
|
||||
if (username && password && email.id) {
|
||||
fetch('http://bangmail.org:8080/mailbox/open', {
|
||||
fetch('https://bangmail.org:8080/mailbox/open', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -271,7 +271,7 @@ if (document.getElementById('sendForm')) {
|
||||
const subject = document.getElementById('subject').value;
|
||||
const body = document.getElementById('body').value;
|
||||
const email = domain ? { from: username, to, domain, subject, body } : { from: username, to, subject, body };
|
||||
const res = await fetch('http://bangmail.org:8080/email', {
|
||||
const res = await fetch('https://bangmail.org:8080/email', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -325,7 +325,7 @@ if (document.getElementById('openComposeBtn')) {
|
||||
const subject = document.getElementById('composeSubject').value;
|
||||
const body = document.getElementById('composeBody').value;
|
||||
const email = domain ? { from: username, to, domain, subject, body } : { from: username, to, subject, body };
|
||||
const res = await fetch('http://bangmail.org:8080/email', {
|
||||
const res = await fetch('https://bangmail.org:8080/email', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
Reference in New Issue
Block a user