Jet interpreter (Tag.cpp, __call.cpp, __imap*.cpp/h, __smtpsend.cpp/h, __imapemptyfolder.cpp/h - new): assorted parser/tag fixes found across this work - a stray literal-tag-in-comment and backslash-quote parser corruption class, a dangling-pointer fix, a __call.cpp fd leak, IMAP folder-management tags, multi-account/per-host IMAP support, and a smtpsend Message-ID fix. barant.com site (jetc/barant-site/): - A site-wide persistent music player (header band, playlist/queue, stereo FFT EQ, session-persisted state) fed by new library/ ianslibrary/music song-list subpages. - /account split into info/phones/invoices subpages; a full invoicing and Square payment system (create/edit/copy/pay/email invoice); admin invoice management and mail-account management subpages. - /services split into overview/hosting/siptrunking/documents subpages, retiring the old standalone pages. - SIPPHONE.tag: a Jet 2.0 WebRTC softphone tag. - main.css/spa.js/email.js: the SPA loading indicator, the music player band styling, and assorted fixes accumulated alongside this work. qualityiron-site/: the qualityiron.vegas job/contractor/customer/ document management app, ported from its original Jet 1.4 codebase to Jet 2.0 as barant.coms APIServers second multi-tenant site. wcwc/wcwc.jet: the WCWC site Jet source (wcwc.jtc build output not included). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
99 lines
4.1 KiB
Plaintext
99 lines
4.1 KiB
Plaintext
<h3>Mail Accounts</h3>
|
|
<div style="margin-bottom: 10px;">
|
|
<button type="button" id="new_mailaccount_toggle" class="button">+ Add Mail Account</button>
|
|
<div id="new_mailaccount_form" style="display: none; margin-top: 8px; align-items: center; gap: 6px;">
|
|
<input type="text" id="new_mailaccount_host" placeholder="Mail Server" value="mail.barant.com">
|
|
<input type="text" id="new_mailaccount_email" placeholder="E-Mail Address">
|
|
<input type="password" id="new_mailaccount_password" placeholder="Password">
|
|
<button type="button" id="new_mailaccount_create_btn" class="button">Add</button>
|
|
<span id="new_mailaccount_status" style="font-size: 12px; color: var(--bond-text-dim);"></span>
|
|
</div>
|
|
</div>
|
|
<table>
|
|
<tr>
|
|
<th>E-Mail</th>
|
|
<th>Server</th>
|
|
<th>Added</th>
|
|
<th></th>
|
|
</tr>
|
|
<sql>select id,email,host,created from email_accounts where user_id=$[@_login_id] order by email</sql>
|
|
<whilerow>
|
|
<tr>
|
|
<td>$[.email]</td>
|
|
<td>$[.host]</td>
|
|
<td>$[.created]</td>
|
|
<td><button type="button" class="button remove_mailaccount_btn" data-account-id="$[.id]">Remove</button></td>
|
|
</tr>
|
|
</whilerow>
|
|
</table>
|
|
<p style="font-size: 12px; color: var(--bond-text-dim);">Saved accounts automatically reconnect the next time you log in.</p>
|
|
<script>
|
|
(function() {
|
|
var toggle = document.getElementById('new_mailaccount_toggle');
|
|
var form = document.getElementById('new_mailaccount_form');
|
|
var hostInput = document.getElementById('new_mailaccount_host');
|
|
var emailInput = document.getElementById('new_mailaccount_email');
|
|
var passwordInput = document.getElementById('new_mailaccount_password');
|
|
var createBtn = document.getElementById('new_mailaccount_create_btn');
|
|
var status = document.getElementById('new_mailaccount_status');
|
|
if (!toggle || !form || !hostInput || !emailInput || !passwordInput || !createBtn || !status) return;
|
|
|
|
toggle.addEventListener('click', function() {
|
|
form.style.display = form.style.display === 'none' ? 'flex' : 'none';
|
|
});
|
|
|
|
createBtn.addEventListener('click', function() {
|
|
var host = hostInput.value.trim();
|
|
var email = emailInput.value.trim();
|
|
var password = passwordInput.value;
|
|
if (!host || !email || !password) {
|
|
status.textContent = 'Please enter a mail server, e-mail address, and password.';
|
|
status.style.color = '#a13a3a';
|
|
return;
|
|
}
|
|
createBtn.disabled = true;
|
|
status.textContent = 'Connecting…';
|
|
status.style.color = 'var(--bond-text-dim)';
|
|
fetch('/admin/add-mail-account', {
|
|
method: 'POST',
|
|
credentials: 'same-origin',
|
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
body: new URLSearchParams({ mail_host: host, mail_email: email, mail_password: password }).toString()
|
|
}).then(function(r) { return r.json(); }).then(function(res) {
|
|
if (res.ok) {
|
|
window.location.href = '/admin/mailaccounts';
|
|
} else {
|
|
createBtn.disabled = false;
|
|
status.textContent = res.error || 'Could not add the account.';
|
|
status.style.color = '#a13a3a';
|
|
}
|
|
}).catch(function() {
|
|
createBtn.disabled = false;
|
|
status.textContent = 'Request failed. Please try again.';
|
|
status.style.color = '#a13a3a';
|
|
});
|
|
});
|
|
|
|
document.querySelectorAll('.remove_mailaccount_btn').forEach(function(btn) {
|
|
btn.addEventListener('click', function() {
|
|
var accountId = btn.getAttribute('data-account-id');
|
|
document.querySelectorAll('.remove_mailaccount_btn').forEach(function(b) { b.disabled = true; });
|
|
fetch('/admin/remove-mail-account', {
|
|
method: 'POST',
|
|
credentials: 'same-origin',
|
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
body: new URLSearchParams({ account_id: accountId }).toString()
|
|
}).then(function(r) { return r.json(); }).then(function(res) {
|
|
if (res.ok) {
|
|
window.location.href = '/admin/mailaccounts';
|
|
} else {
|
|
document.querySelectorAll('.remove_mailaccount_btn').forEach(function(b) { b.disabled = false; });
|
|
}
|
|
}).catch(function() {
|
|
document.querySelectorAll('.remove_mailaccount_btn').forEach(function(b) { b.disabled = false; });
|
|
});
|
|
});
|
|
});
|
|
})();
|
|
</script>
|