return async (env, head, body, scripts) => {
//let cart = await _require('/online_store/cart.jst')
- let globals = await env.site.get_json('/_config/globals.json')
//let icon_cart_small = await env.site.get_min_svg('/_svg/icon_cart_small.svg')
let icon_search_mono = await env.site.get_min_svg('/_svg/icon_search_mono.svg')
let logo_large = await env.site.get_min_svg('/_svg/logo_large.svg')
let dir = index === -1 ? '' : env.parsed_url.pathname.slice(1, index)
title {
- _out.push(
- globals.site_title + ': ' + (
+ let transaction = await env.site.database.Transaction()
+ try {
+ let globals = await (await transaction.get({})).get('globals')
+ ;`${await globals.get_json('site_title')}: ${
dir.length === 0 ?
- 'Home' :
- menu.entries[menu.index[dir]].name
- )
- )
+ 'Home' :
+ menu.entries[menu.index[dir]].name
+ }`
+ }
+ finally {
+ transaction.rollback()
+ }
}
await head(_out)
p {'Example code fragments embedded within the text are placed in the public domain unless otherwise noted.'}
- p {`Copyright © ${new XDate().getUTCFullYear()} ${globals.copyright}.`}
+ p {
+ let transaction = await env.site.database.Transaction()
+ try {
+ let globals = await (await transaction.get({})).get('globals')
+ ;`Copyright © ${new XDate().getUTCFullYear()} ${await globals.get('copyright')}.`
+ }
+ finally {
+ transaction.rollback()
+ }
+ }
}
}
let XDate = require('xdate')
return async env => {
- let globals = await env.site.get_json('/_config/globals.json')
let nodemailer_noreply = await env.site.get_nodemailer(
'/_config/nodemailer_noreply.json'
)
{password, link_code, expires: expires.getTime()}
)
+ let globals = await (await transaction.get({})).get('globals')
+ let site_url = await globals.get_json('site_url')
+ let noreply_from = await globals.get_json('noreply_from')
+ let noreply_signature = await globals.get_json('noreply_signature')
+
let given_names = await account.get_json('given_names', '')
let family_name = await account.get_json('family_name', '')
let name =
await nodemailer_noreply.sendMail(
{
- from: globals.noreply_from,
+ from: noreply_from,
to: `${name} <${email}>`,
subject: 'Password reset',
text: `Dear ${given_names},
We have received a request to reset the account password for your email address.
If this request is valid, please verify the new password by visiting the below link:
-${globals.site_url}/my_account/verify_password/index.html?email=${encodeURIComponent(email)}&link_code=${encodeURIComponent(link_code)}
+${site_url}/my_account/verify_password/index.html?email=${encodeURIComponent(email)}&link_code=${encodeURIComponent(link_code)}
The link is valid for 24 hours.
Thanks,
-${globals.noreply_signature}
+${noreply_signature}
`
}
)
return async env => {
- let globals = await env.site.get_json('/_config/globals.json')
- let nodemailer_noreply = await env.site.get_nodemailer(
- '/_config/nodemailer_noreply.json'
- )
let post_request = await _require('/_lib/post_request.jst')
let session_cookie = await _require('/_lib/session_cookie.jst')
let Problem = await _require('/_lib/Problem.jst')
return async env => {
- let globals = await env.site.get_json('/_config/globals.json')
- let nodemailer_noreply = await env.site.get_nodemailer(
- '/_config/nodemailer_noreply.json'
- )
let post_request = await _require('/_lib/post_request.jst')
let session_cookie = await _require('/_lib/session_cookie.jst')
let Problem = await _require('/_lib/Problem.jst')
let XDate = require('xdate')
return async env => {
- let globals = await env.site.get_json('/_config/globals.json')
let nodemailer_noreply = await env.site.get_nodemailer(
'/_config/nodemailer_noreply.json'
)
{link_code, expires: expires.getTime()}
)
+ let globals = await (await transaction.get({})).get('globals')
+ let site_url = await globals.get_json('site_url')
+ let noreply_from = await globals.get_json('noreply_from')
+ let noreply_signature = await globals.get_json('noreply_signature')
+
let given_names = await account.get_json('given_names', '')
let family_name = await account.get_json('family_name', '')
let name =
await nodemailer_noreply.sendMail(
{
- from: globals.noreply_from,
+ from: noreply_from,
to: `${name} <${email}>`,
subject: 'Email address verification',
text: `Dear ${given_names},
We have received a request to sign up using your email address.
If this request is valid, please verify your email address by visiting the below link:
-${globals.site_url}/my_account/verify_email/index.html?email=${encodeURIComponent(email)}&link_code=${encodeURIComponent(link_code)}
+${site_url}/my_account/verify_email/index.html?email=${encodeURIComponent(email)}&link_code=${encodeURIComponent(link_code)}
The link is valid for 24 hours.
Thanks,
-${globals.noreply_signature}
+${noreply_signature}
`
}
)
let XDate = require('xdate')
return async env => {
- let globals = await env.site.get_json('/_config/globals.json')
let nodemailer_contact = await env.site.get_nodemailer(
'/_config/nodemailer_contact.json'
)
)
let transaction = await env.site.database.Transaction()
+ let contact_from, contact_to
try {
// initialize env.session_key, set cookie in env.response
session_cookie(env, transaction)
+
+ let globals = await (await transaction.get({})).get('globals')
+ contact_from = await globals.get_json('contact_from')
+ contact_to = await globals.get_json('contact_to')
+
await transaction.commit()
}
catch (error) {
'Enquiry'
await nodemailer_contact.sendMail(
{
- from: globals.contact_from,
- to: globals.contact_to,
+ from: contact_from,
+ to: contact_to,
replyTo: `${name} <${details.email}>`,
- subject: subject,
+ subject,
text: details.message
}
)
let XDate = require('xdate')
return async env => {
- let globals = await env.site.get_json('/_config/globals.json')
let nodemailer_feedback = await env.site.get_nodemailer(
'/_config/nodemailer_feedback.json'
)
)
let transaction = await env.site.database.Transaction()
+ let feedback_from, feedback_to
try {
// initialize env.session_key, set cookie in env.response
await session_cookie(env, transaction)
+
+ let globals = await (await transaction.get({})).get('globals')
+ feedback_from = await globals.get_json('feedback_from')
+ feedback_to = await globals.get_json('feedback_to')
+
await transaction.commit()
}
catch (error) {
await nodemailer_feedback.sendMail(
{
- from: globals.feedback_from,
- to: globals.feedback_to,
+ from: feedback_from,
+ to: feedback_to,
subject: 'Page: ' + page,
text: message
}