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.
60 lines
2.4 KiB
C++
60 lines
2.4 KiB
C++
#ifndef ____imapaccounts_h__
|
|
# define ____imapaccounts_h__
|
|
|
|
# include "Tag.h"
|
|
# include "ZString.h"
|
|
# include "MString.h"
|
|
# include <string>
|
|
# include <utility>
|
|
# include <vector>
|
|
|
|
namespace jet {
|
|
|
|
///
|
|
/// <imapaccounts action="add|remove|getpassword|firstuser|list"
|
|
/// list="$[@_imap_accounts]" user="..." password="...">
|
|
///
|
|
/// Pure list-transform tag (no session-variable access of its own,
|
|
/// no IMAP connection) that manages the multi-account list webmail
|
|
/// keeps in the single session variable "_imap_accounts" - the .jet
|
|
/// route wraps each call in <eval name="_imap_accounts"> itself and
|
|
/// <set>s it back, the same separation-of-concerns every other
|
|
/// session variable in this codebase already uses (this tag never
|
|
/// touches Global's session-variable map directly).
|
|
///
|
|
/// The list's own on-the-wire encoding (semicolon-separated
|
|
/// "base64(user):base64(password)" entries) is private to this tag -
|
|
/// callers only ever pass the whole `list` value back in verbatim
|
|
/// and use the returned value the same way, so the choice of
|
|
/// delimiter can't collide with any real username or password
|
|
/// character.
|
|
///
|
|
/// action="add": upserts user/password (removing any existing entry
|
|
/// for the same user first, so reconnecting with a changed password
|
|
/// updates it) - returns the updated encoded list.
|
|
/// action="remove": drops the entry for user, if present - returns
|
|
/// the updated encoded list.
|
|
/// action="getpassword": returns the stored password for user, or
|
|
/// an empty string if not present.
|
|
/// action="firstuser": returns the first entry's username, or an
|
|
/// empty string if the list is empty.
|
|
/// action="list": returns JSON ({"accounts":[...],"active":"..."})
|
|
/// - the one client-facing action; "active" echoes the `active`
|
|
/// keyword (typically $[@_imap_user]) back verbatim so the sidebar
|
|
/// can highlight the current one, and never includes any password.
|
|
///
|
|
class __imapaccounts : public Tag {
|
|
|
|
public:
|
|
__imapaccounts(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local);
|
|
|
|
private:
|
|
static std::vector<std::pair<std::string, std::string>> decodeList(const std::string &encoded);
|
|
static std::string encodeList(const std::vector<std::pair<std::string, std::string>> &entries);
|
|
static std::string jsonEscape(const std::string &s);
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|