Add global music player, invoicing/payment system, account subpages, mail account admin, and the qualityiron.vegas Jet 2.0 port
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>
This commit is contained in:
1 parent
905fbafa5a
commit
b8f7793773
406 files changed
+15803
-587
No files matched your search
+43
-19
@@ -37,8 +37,8 @@ namespace jet {
|
||||
return s.substr(start, end - start + 1);
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> __imapaccounts::decodeList(const std::string &encodedRaw) {
|
||||
std::vector<std::pair<std::string, std::string>> entries;
|
||||
std::vector<__imapaccounts::Account> __imapaccounts::decodeList(const std::string &encodedRaw) {
|
||||
std::vector<Account> entries;
|
||||
coreutils::Base64 base64;
|
||||
// The list value round-trips through <eval>/<set> template
|
||||
// captures, which include whatever whitespace/newlines surround
|
||||
@@ -56,26 +56,35 @@ namespace jet {
|
||||
entry = trimWhitespace(entry);
|
||||
if (entry.empty())
|
||||
continue;
|
||||
size_t colon = entry.find(':');
|
||||
if (colon == std::string::npos)
|
||||
size_t colon1 = entry.find(':');
|
||||
if (colon1 == std::string::npos)
|
||||
continue;
|
||||
std::string userB64 = trimWhitespace(entry.substr(0, colon));
|
||||
std::string passB64 = trimWhitespace(entry.substr(colon + 1));
|
||||
std::string user = base64.decode(userB64).str();
|
||||
std::string password = base64.decode(passB64).str();
|
||||
entries.push_back(std::make_pair(user, password));
|
||||
size_t colon2 = entry.find(':', colon1 + 1);
|
||||
if (colon2 == std::string::npos)
|
||||
continue;
|
||||
std::string hostB64 = trimWhitespace(entry.substr(0, colon1));
|
||||
std::string userB64 = trimWhitespace(entry.substr(colon1 + 1, colon2 - colon1 - 1));
|
||||
std::string passB64 = trimWhitespace(entry.substr(colon2 + 1));
|
||||
Account account;
|
||||
account.host = base64.decode(hostB64).str();
|
||||
account.user = base64.decode(userB64).str();
|
||||
account.password = base64.decode(passB64).str();
|
||||
entries.push_back(account);
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
std::string __imapaccounts::encodeList(const std::vector<std::pair<std::string, std::string>> &entries) {
|
||||
std::string __imapaccounts::encodeList(const std::vector<Account> &entries) {
|
||||
coreutils::Base64 base64;
|
||||
std::string result;
|
||||
for (size_t i = 0; i < entries.size(); i++) {
|
||||
if (i > 0)
|
||||
result += ";";
|
||||
std::string user = entries[i].first;
|
||||
std::string password = entries[i].second;
|
||||
std::string host = entries[i].host;
|
||||
std::string user = entries[i].user;
|
||||
std::string password = entries[i].password;
|
||||
result += base64.encode(host).str();
|
||||
result += ":";
|
||||
result += base64.encode(user).str();
|
||||
result += ":";
|
||||
result += base64.encode(password).str();
|
||||
@@ -90,20 +99,25 @@ namespace jet {
|
||||
auto entries = decodeList(listStr);
|
||||
|
||||
if (action == "add") {
|
||||
std::string host = trimWhitespace(resolveKeyword("host").str());
|
||||
std::string user = trimWhitespace(resolveKeyword("user").str());
|
||||
std::string password = trimWhitespace(resolveKeyword("password").str());
|
||||
for (size_t i = 0; i < entries.size(); i++) {
|
||||
if (entries[i].first == user) {
|
||||
if (entries[i].user == user) {
|
||||
entries.erase(entries.begin() + (long)i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
entries.push_back(std::make_pair(user, password));
|
||||
Account account;
|
||||
account.host = host;
|
||||
account.user = user;
|
||||
account.password = password;
|
||||
entries.push_back(account);
|
||||
out = coreutils::MString(encodeList(entries));
|
||||
} else if (action == "remove") {
|
||||
std::string user = trimWhitespace(resolveKeyword("user").str());
|
||||
for (size_t i = 0; i < entries.size(); i++) {
|
||||
if (entries[i].first == user) {
|
||||
if (entries[i].user == user) {
|
||||
entries.erase(entries.begin() + (long)i);
|
||||
break;
|
||||
}
|
||||
@@ -113,21 +127,31 @@ namespace jet {
|
||||
std::string user = trimWhitespace(resolveKeyword("user").str());
|
||||
std::string password;
|
||||
for (size_t i = 0; i < entries.size(); i++) {
|
||||
if (entries[i].first == user) {
|
||||
password = entries[i].second;
|
||||
if (entries[i].user == user) {
|
||||
password = entries[i].password;
|
||||
break;
|
||||
}
|
||||
}
|
||||
out = coreutils::MString(password);
|
||||
} else if (action == "gethost") {
|
||||
std::string user = trimWhitespace(resolveKeyword("user").str());
|
||||
std::string host;
|
||||
for (size_t i = 0; i < entries.size(); i++) {
|
||||
if (entries[i].user == user) {
|
||||
host = entries[i].host;
|
||||
break;
|
||||
}
|
||||
}
|
||||
out = coreutils::MString(host);
|
||||
} else if (action == "firstuser") {
|
||||
out = coreutils::MString(entries.empty() ? std::string() : entries[0].first);
|
||||
out = coreutils::MString(entries.empty() ? std::string() : entries[0].user);
|
||||
} else if (action == "list") {
|
||||
std::string active = resolveKeyword("active").str();
|
||||
std::string json = "{\"accounts\":[";
|
||||
for (size_t i = 0; i < entries.size(); i++) {
|
||||
if (i > 0)
|
||||
json += ",";
|
||||
json += "\"" + jsonEscape(entries[i].first) + "\"";
|
||||
json += "\"" + jsonEscape(entries[i].user) + "\"";
|
||||
}
|
||||
json += "],\"active\":\"" + jsonEscape(active) + "\"}";
|
||||
out = coreutils::MString(json);
|
||||
|
||||
Reference in new issue
Block a user