Add IMAP webmail tag, admin/opensource subpage tiers, store/cart, htmleditor, uploads
New __imap*/__smtpsend/__eval Jet tags give templates real IMAP (list/message/flag/delete/move/search/folders/accounts) and SMTP-send capability, backing the new /email webmail client (email.jet/ email.menu, assets/images/email.js + newemail.js) and its mainpagetemplate.jet-based page shell. Most of this tag family's source was already being built into the live site (Tag.cpp already registered __imap/__imaplist/__imapmessage/__imapflag/__imapdelete/ __eval) but had never actually been committed; this also registers and commits the remaining five (__imapmove/__imapfolders/ __imapsearch/__smtpsend/__imapaccounts). admin.page/admin.menu gain a real subpage tier (admin-email, admin-newemail, admin-invoices, admin-products, admin-users) replacing several previously top-level pages, mirrored by a similar opensource.page subpage tier (opensource-overview/asm1802/barantmail/ jet/serverframework/synthmax) - old top-level pages retired via git rename (asm1802.page, jet.page, serverframework.page, admin_invoices.page); barantmail.page is dropped outright, folded into opensource-barantmail.subpage. New storefront (store.page, store-createstore.subpage, barantstore.page) and cart flow (cart.jet, updatecartqty.proc, removecartitem.proc, editproduct.page/selectproduct.proc/ update_product.proc for inventory maintenance against the barant database). New document upload/download manager (documents.jet, documents_api.jet, documents_upload.proc, documents_delete.proc, assets/images/documents.js + documents-page.js) with a persistent floating panel, and a rich-text page editor (htmleditor.jet/.page, createhtmleditor.proc, savehtmleditor.proc, assets/images/htmleditor.js + its icon/logo assets). SESSIONCTL.tag: login now redirects back to the originally-requested page instead of always landing on /account ($[start:0] vs $[start] variable-name mismatch). main.css/menu.bar/invoices.menu/jet_overview.section/login.menu: styling and navigation updates for the above; new site assets (fonts, images, audio) referenced by them. jetc/build-assets.sh, list_jet_files.sh, lowercase_jet.py, strip_fragments.py: small dev tooling used while building the above.
This commit is contained in:
1 parent
b0cadc3f08
commit
c1491b044b
115 files changed
+6174
-137
No files matched your search
@@ -0,0 +1,69 @@
|
||||
#ifndef ____smtpsend_h__
|
||||
# define ____smtpsend_h__
|
||||
|
||||
# include "Tag.h"
|
||||
# include "ZString.h"
|
||||
# include "MString.h"
|
||||
# include <openssl/ssl.h>
|
||||
# include <string>
|
||||
|
||||
namespace jet {
|
||||
|
||||
///
|
||||
/// <smtpsend config="./email.cfg" user="..." password="..."
|
||||
/// to="..." subject="..." html="...">
|
||||
///
|
||||
/// One-shot authenticated SMTP submission to BARANTMAIL's own
|
||||
/// implicit-TLS submission port (config key "smtpPort" - matches
|
||||
/// barantmail.cfg's smtpTLS.port, :465, the same implicit-TLS style
|
||||
/// as IMAP's :993 - no STARTTLS negotiation). Connects, TLS-
|
||||
/// handshakes, AUTH LOGIN with the SAME mailbox credentials already
|
||||
/// used by <imap> (so the message goes out authenticated as the
|
||||
/// actual connected mailbox, not the site's own transactional-mail
|
||||
/// identity - see barant.tag's separate <email> tag for that), then
|
||||
/// MAIL FROM/RCPT TO/DATAs a freshly-built RFC 5322 message
|
||||
/// (Date/From/To/Subject/MIME headers, HTML body), then QUITs. The
|
||||
/// authenticated user IS the From address - SMTP submission
|
||||
/// requires MAIL FROM to match the authenticated identity anyway, so
|
||||
/// there's no separate "from" keyword.
|
||||
///
|
||||
/// No connection pooling, unlike __imap - composing mail is rare
|
||||
/// enough that a fresh connect/auth/send/close per message is fine.
|
||||
///
|
||||
/// Throws coreutils::Exception (401 for a bad login, 502 for any
|
||||
/// other connect/protocol/rejected-recipient failure) on any
|
||||
/// failure - same convention as __imap.
|
||||
///
|
||||
class __smtpsend : public Tag {
|
||||
|
||||
public:
|
||||
__smtpsend(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local);
|
||||
|
||||
private:
|
||||
SSL_CTX *ctx = nullptr;
|
||||
SSL *ssl = nullptr;
|
||||
int fd = -1;
|
||||
std::string recvBuffer;
|
||||
size_t recvPos = 0;
|
||||
|
||||
void sendLine(const std::string &line);
|
||||
char readByte();
|
||||
std::string readLine();
|
||||
// Reads one (possibly multi-line, "250-text"/"250 text"
|
||||
// continuation-marked) SMTP reply and returns its 3-digit code;
|
||||
// throws if the code's first digit doesn't match expectedCode's.
|
||||
int readReply(int expectedCode);
|
||||
|
||||
void closeConnection();
|
||||
|
||||
static std::string base64Encode(const std::string &s);
|
||||
static std::string rfc2822Date();
|
||||
// Builds the full RFC 5322 message (headers + dot-stuffed body)
|
||||
// handed to SMTP's DATA command.
|
||||
static std::string buildMessage(const std::string &from, const std::string &to,
|
||||
const std::string &subject, const std::string &html);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user