1 let XDate = require('xdate')
4 let post_request = await _require('/_lib/post_request.jst')
5 let get_session = await _require('/_lib/get_session.jst')
6 let Problem = await _require('/_lib/Problem.jst')
13 // coerce and/or validate
15 site_url: globals.site_url.slice(0, 1024),
16 site_title: globals.site_title.slice(0, 1024),
17 contact_from: globals.contact_from.slice(0, 1024),
18 contact_to: globals.contact_to.slice(0, 1024),
19 feedback_from: globals.feedback_from.slice(0, 1024),
20 feedback_to: globals.feedback_to.slice(0, 1024),
21 noreply_from: globals.noreply_from.slice(0, 1024),
22 noreply_signature: globals.noreply_signature.slice(0, 1024),
23 copyright: globals.copyright.slice(0, 1024)
26 let transaction = await env.site.database.Transaction()
28 let account = await get_account(
31 await get_session(env, transaction)
33 if (account === undefined)
34 throw new Problem('Unauthorized', 'Please sign in first.', 401)
35 if (!await account.get_json('administrator'))
36 throw new Problem('Unauthorized', 'Not administrator.', 401)
38 ;(await transaction.get({})).set_json('globals', globals)
39 await transaction.commit()
42 transaction.rollback()