Multi-day accumulated fixes: tag dispatch, session/pooling correctness, SPA rollout, jetc compiler
JetCore engine (Tag.cpp/.h, Global.cpp/.h, __*.cpp tag classes): - Numerous __mysql.cpp connection-pooling correctness fixes (stale result sets, double-indirection sessionid bugs, field caching, pool keying) and a session-registration-before-connection-confirmed ordering fix (dangling pointer on a failed connect) - Tag.cpp: large body of fixes to the tag-dispatch/container-scanning logic (bare-name fallback, database aliasing, single-quote handling, @-prefix session variable resolution, TAGDEF caching, nested split-tag scanning for if/while/until/ifrow so an inner one doesn't corrupt an outer one's own boundary scan) plus the process-first rendering order fix (a <process> now runs before <checksession>/page resolution, fixing a real "blank page after successful login" bug) - Global.h/.cpp: added imapSessions (parallel to the existing __mysql* session map) for the new <imap> tag family - __whiledir.cpp/__include.cpp: caching and directory-name-aliasing fixes - __call.cpp/.h: fixed a dangling-pointer bug - __write.cpp: fixed an O_WRONLY-only open that couldn't create a new file - __ifrow.cpp/__sql.cpp: fixed the same sessionid double-indirection bug __mysql.cpp had (resolveKeyword's result was being used as a map key lookup instead of the resolved value itself) jetc compiler (jetc/JetParser.cpp/.h, JetCodegen.cpp/.h, JetAST.h, jetc.cpp, build-shared.sh, build-compiled.sh): - Parser fixes: inline <include>, nested-quote handling, void-tag recognition - Codegen fixes and expanded AST support - build-shared.sh: atomic rename into place for a freshly-built .jtc (a live server dlopen()ing the same path mid-rebuild was corrupting its own already-mapped view of the old file) and a staleness check so a cached JetCore .o doesn't silently keep serving yesterday's fixes forever - Added -lssl to both build scripts' link lines (needed once the new <imap> tag's client-side TLS code existed - previously nothing in this codebase used OpenSSL's SSL/TLS client API, only libcrypto) Site content (jetc/barant-site/): SPA (fetch-and-swap navigation) rollout across essentially every .page/.jet/.section/.tag/.proc/.method file - dynamic-content fixes, fragment-mode stripping, native $[@name] session variables replacing older mechanisms, and this session's own checkout.page redesign, login start-param redirect fix, and per-page side-menu (menu.bar/$[PAGE].menu) refresh support. Completed the earlier main.css/control.css move from assets/ to assets/images/ (git still showed the old paths as tracked-but-deleted until now). Deliberately left out of this commit: dozens of .pre-<description>- <date> manual backup files (this session's and earlier ones' own before/after snapshots, not meant for permanent history), compiled .jtc build outputs, ad hoc test binaries and scripts under jetc/ (login_asan, wcwc_test, optest2_bin, etc.), and jetc/__pycache__/ - none of these are meant to be tracked; a .gitignore covering them would be worth adding separately.
This commit is contained in:
1 parent
54b6e522f9
commit
b0cadc3f08
162 files changed
+3567
-2887
No files matched your search
@@ -1,8 +1,8 @@
|
||||
<page template="mainpagetemplate" loggedin="yes">
|
||||
<page loggedin="yes">
|
||||
<title>SHOPPING CART - CHECKOUT</title>
|
||||
<script src="https://web.squarecdn.com/v1/square.js"></script>
|
||||
<contents>
|
||||
<script>
|
||||
<script src="https://web.squarecdn.com/v1/square.js"></script>
|
||||
<script>
|
||||
function processCardForm(token) {
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', '/pp.cgi', true);
|
||||
@@ -11,50 +11,111 @@
|
||||
console.log(">" + this.responseText + "<");
|
||||
if(this.responseText == "OK\n") {
|
||||
document.forms[0].PAGE.value = 'thankyou';
|
||||
document.forms[0].submit();
|
||||
} else {
|
||||
message.innerText = this.responseText;
|
||||
document.forms[0].requestSubmit();
|
||||
} else {
|
||||
var payBtn = document.getElementById('pay');
|
||||
payBtn.disabled = false;
|
||||
var processbanner = document.getElementById('process');
|
||||
processbanner.style.visibility = 'hidden';
|
||||
message.innerText = this.responseText;
|
||||
}
|
||||
};
|
||||
let data = 'id=$[_session_id]&token=' + token + '&tranonce=$[tranonce]';
|
||||
xhr.send(data);
|
||||
xhr.send(data);
|
||||
}
|
||||
var card;
|
||||
async function buildForm() {
|
||||
let payments = Square.payments('sq0idp-V4R4vEferpF9kr7d5x5abQ','LV0MRENX5ED3Z');
|
||||
const card = await payments.card({
|
||||
style: {
|
||||
'.input-container.is-focus': { borderColor: '#006AFF' },
|
||||
'.message-text.is-error': { color: '#BF0020' }
|
||||
input: {
|
||||
backgroundColor: '#1c1c24',
|
||||
color: '#e7e4dc',
|
||||
fontSize: '14px'
|
||||
},
|
||||
'input::placeholder': { color: '#8d8c92' },
|
||||
'.input-container': { borderColor: 'rgba(197, 164, 90, 0.28)' },
|
||||
'.input-container.is-focus': { borderColor: '#c5a45a' },
|
||||
'.input-container.is-error': { borderColor: '#a13a3a' },
|
||||
'.message-text': { color: '#8d8c92' },
|
||||
'.message-text.is-error': { color: '#a13a3a' }
|
||||
}
|
||||
});
|
||||
await card.attach('#card');
|
||||
let button = document.getElementById('pay');
|
||||
button.addEventListener('click', async () => {
|
||||
message.innerText = '';
|
||||
let result = await card.tokenize();
|
||||
if (result.status === 'OK') {
|
||||
button.disabled = true;
|
||||
let processbanner = document.getElementById('process');
|
||||
processbanner.style.visibility = 'visible';
|
||||
processCardForm(result.token);
|
||||
} else {
|
||||
let errorMessage = 'Please check your card details and try again.';
|
||||
if (result.errors && result.errors.length && result.errors[0].message)
|
||||
errorMessage = result.errors[0].message;
|
||||
message.innerText = errorMessage;
|
||||
}
|
||||
});
|
||||
}
|
||||
buildForm();
|
||||
buildForm();
|
||||
</script>
|
||||
<sql>select count(*) as number_of_items,
|
||||
sum(price * quantity) as total
|
||||
from product_list
|
||||
join cart_item on product_list.sku=cart_item.sku
|
||||
where cart_item.session_uuid='$[_session_id]'
|
||||
</sql>
|
||||
<sectionframe title="Pay with Credit Card">
|
||||
<div>Please enter your payment information:</div>
|
||||
<div style="font-size: 20px;">$[total]</div>
|
||||
<div id="card" style="background-color: #ddd;width: 300px; padding: 5px;"></div>
|
||||
<div style="padding: 5px;"><button id= "pay" type="button">Pay</button></div>
|
||||
<div id="process" style="background-color: #0f0; border: 2px solid #000; padding:
|
||||
5px; display: block-inline; margin: 10px; visibility: hidden;"> Processing Payment - Please wait... </div>
|
||||
<div id="message" style="color: #f00; margin-top: 20px;"></div>
|
||||
|
||||
<sql>select sum(price * quantity) as total
|
||||
from product_list
|
||||
join cart_item on product_list.sku=cart_item.sku
|
||||
where cart_item.session_uuid='$[_session_id]'</sql>
|
||||
$[sqlerror]
|
||||
<ifrow>
|
||||
<set name="checkout_total" value="$[.total]">
|
||||
</ifrow>
|
||||
|
||||
<sectionframe title="Order Summary">
|
||||
<sql>select product_list.sku as SKU,
|
||||
description as Description,
|
||||
quantity as Qty,
|
||||
price as Price
|
||||
from product_list
|
||||
join cart_item on product_list.sku=cart_item.sku
|
||||
where cart_item.session_uuid='$[_session_id]'
|
||||
order by description</sql>
|
||||
$[sqlerror]
|
||||
<div class="cart-wrap">
|
||||
<div class="checkout-header">
|
||||
<div class="cart-col-desc">Item</div>
|
||||
<div class="cart-col-price">Price</div>
|
||||
<div class="checkout-col-qty">Qty</div>
|
||||
<div class="cart-col-total">Total</div>
|
||||
</div>
|
||||
<div class="cart-items">
|
||||
<whilerow>
|
||||
<set name="linetotal" expr="$[.Price] * $[.Qty]">
|
||||
<div class="checkout-row">
|
||||
<div class="cart-col-desc">$[.Description]</div>
|
||||
<div class="cart-col-price">$$[.Price]</div>
|
||||
<div class="checkout-col-qty">$[.Qty]</div>
|
||||
<div class="cart-col-total">$$[linetotal]</div>
|
||||
</div>
|
||||
</whilerow>
|
||||
</div>
|
||||
<div class="cart-summary">
|
||||
<div class="cart-summary-row">
|
||||
<span>Total Due</span>
|
||||
<span class="cart-summary-total">$$[checkout_total]</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</sectionframe>
|
||||
|
||||
<sectionframe title="Payment">
|
||||
<div class="checkout-pay-wrap">
|
||||
<div class="checkout-pay-label">Card Details</div>
|
||||
<div id="card" class="checkout-card-input"></div>
|
||||
<button id="pay" type="button" class="button checkout-pay-btn">Pay $$[checkout_total]</button>
|
||||
<div id="process" class="checkout-processing">Processing Payment — Please wait…</div>
|
||||
<div id="message" class="checkout-error"></div>
|
||||
</div>
|
||||
</sectionframe>
|
||||
</contents>
|
||||
</page>
|
||||
Reference in new issue
Block a user