Use (Transaction|LazyValue).get_json() instead of logjson.logjson_to_json() and ...
authorNick Downing <nick@ndcode.org>
Sun, 23 Jan 2022 01:31:05 +0000 (12:31 +1100)
committerNick Downing <nick@ndcode.org>
Sun, 23 Jan 2022 02:21:59 +0000 (13:21 +1100)
28 files changed:
_lib/session_cookie.jst
api/account/change_details/get.json.jst
api/account/change_details/get_draft.json.jst
api/account/change_details/set.json.jst
api/account/change_details/set_draft.json.jst
api/account/change_password.json.jst
api/account/password_reset.json.jst
api/account/sign_in.json.jst
api/account/sign_out.json.jst
api/account/sign_up/create_account.json.jst
api/account/sign_up/get_draft.json.jst
api/account/sign_up/send_email_verification_link.json.jst
api/account/sign_up/set_draft.json.jst
api/account/sign_up/verify_email.json.jst
api/account/verify_password.json.jst
api/contact/get_draft.json.jst
api/contact/send_enquiry.json.jst
api/contact/set_draft.json.jst
api/feedback.json.jst
api/globals/get.json.jst
api/globals/set.json.jst
api/verification_image.png.jst
contact/index.html.jst
my_account/index.html.jst
my_account/send_verification_email/index.html.jst
my_account/sign_up/index.html.jst
my_account/verify_email/index.html.jst
my_account/verify_password/index.html.jst

index 7f14413..861e702 100644 (file)
@@ -1,4 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
 let cookie = require('cookie')
 let crypto = require('crypto')
 let XDate = require('xdate')
@@ -42,8 +41,6 @@ return async (env, transaction) => {
     `session_key=${env.session_key}; expires=${expires.toUTCString()}; path=/;`
   )
 
-  env.signed_in_as = await logjson.logjson_to_json(
-    await session.get('signed_in_as', null)
-  )
+  env.signed_in_as = await session.get_json('signed_in_as', null)
   return session
 }
index efc4107..cf450a8 100644 (file)
@@ -1,4 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -24,15 +23,9 @@ return async env => {
           ).get('accounts', {})
         ).get(env.signed_in_as)
         let details = {
-          given_names: await logjson.logjson_to_json(
-            await account.get('given_names')
-          ),
-          family_name: await logjson.logjson_to_json(
-            await account.get('family_name')
-          ),
-          contact_me: await logjson.logjson_to_json(
-            await account.get('contact_me')
-          )
+          given_names: await account.get_json('given_names'),
+          family_name: await account.get_json('family_name'),
+          contact_me: await account.get_json('contact_me')
         }
 
         await transaction.commit()
index cc632ec..b3058b3 100644 (file)
@@ -1,4 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -19,19 +18,13 @@ return async env => {
         let change_details_draft = await session.get('change_details_draft')
         let details =
           change_details_draft !== undefined &&
-            XDate.now() < await logjson.logjson_to_json(
-              await change_details_draft.get('expires')
-            ) ? {
-              given_names: await logjson.logjson_to_json(
-                await change_details_draft.get('given_names')
-              ),
-              family_name: await logjson.logjson_to_json(
-                await change_details_draft.get('family_name')
-              ),
-              contact_me: await logjson.logjson_to_json(
-                await change_details_draft.get('contact_me')
-              )
-            } : null
+            XDate.now() < await change_details_draft.get_json('expires') ?
+            {
+              given_names: await change_details_draft.get_json('given_names'),
+              family_name: await change_details_draft.get_json('family_name'),
+              contact_me: await change_details_draft.get_json('contact_me')
+            } :
+            null
 
         await transaction.commit()
         return details
index 5e61e5e..755f4c4 100644 (file)
@@ -1,4 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -35,18 +34,9 @@ return async env => {
             await transaction.get({})
           ).get('accounts', {})
         ).get(env.signed_in_as)
-        account.set(
-          'given_names',
-          transaction.json_to_logjson(details.given_names)
-        )
-        account.set(
-          'family_name',
-          transaction.json_to_logjson(details.family_name)
-        )
-        account.set(
-          'contact_me',
-          transaction.json_to_logjson(details.contact_me)
-        )
+        account.set_json('given_names', details.given_names)
+        account.set_json('family_name', details.family_name)
+        account.set_json('contact_me', details.contact_me)
 
         await transaction.commit()
       }
index cf7ee6f..69f1f5b 100644 (file)
@@ -28,14 +28,12 @@ return async env => {
           expires.addDays(1)
           session.set(
             'change_details_draft',
-            transaction.json_to_logjson(
-              {
-                given_names: details.given_names,
-                family_name: details.family_name,
-                contact_me: details.contact_me,
-                expires: expires.getTime()
-              }
-            )
+            {
+              given_names: details.given_names,
+              family_name: details.family_name,
+              contact_me: details.contact_me,
+              expires: expires.getTime()
+            }
           )
         }
         else
index ce95e13..fbf7486 100644 (file)
@@ -1,5 +1,4 @@
 let crypto = require('crypto')
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -35,22 +34,14 @@ return async env => {
           ).get('accounts', {})
         ).get(env.signed_in_as)
 
-        if (
-          old_password !== await logjson.logjson_to_json(
-            await account.get('password')
-          )
-        )
+        if (old_password !== await account.get_json('password'))
           throw new Problem(
             'Incorrect password',
             `Provided old password did not match the expected value.`,
             426
           )
 
-        await account.set(
-          'password',
-          transaction.json_to_logjson(new_password)
-        )
-
+        account.set_json('password', new_password)
         await transaction.commit()
       }
       catch (error) {
index cb11270..908bf75 100644 (file)
@@ -1,5 +1,4 @@
 let crypto = require('crypto')
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -46,23 +45,13 @@ return async env => {
         let link_code = crypto.randomBytes(16).toString('hex')
         let expires = new XDate()
         expires.addDays(1)
-        account.set(
+        account.set_json(
           'verify_password',
-          transaction.json_to_logjson(
-            {
-              password,
-              link_code,
-              expires: expires.getTime()
-            }
-          )
+          {password, link_code, expires: expires.getTime()}
         )
 
-        let given_names = await logjson.logjson_to_json(
-          await account.get('given_names', '')
-        )
-        let family_name = await logjson.logjson_to_json(
-          await account.get('family_name', '')
-        )
+        let given_names = await account.get_json('given_names', '')
+        let family_name = await account.get_json('family_name', '')
         let name =
           family_name.length ? `${given_names} ${family_name}` : given_names
 
index b963f97..ecd0f4e 100644 (file)
@@ -1,5 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
-
 return async env => {
   let globals = await env.site.get_json('/_config/globals.json')
   let nodemailer_noreply = await env.site.get_nodemailer(
@@ -36,9 +34,7 @@ return async env => {
         ).get(email)
         if (
           account === undefined ||
-            password !== await logjson.logjson_to_json(
-              await account.get('password')
-            )
+            password !== await account.get_json('password')
         )
           throw new Problem(
             'Unauthorized',
@@ -46,19 +42,14 @@ return async env => {
             401
           )
 
-        if (
-          !await logjson.logjson_to_json(
-            await account.get('email_verified')
-          )
-        )
+        if (!await account.get_json('email_verified'))
           throw new Problem(
             'Email not yet verified',
             'Please verify your email address via email link before trying to sign in.',
             425
           )
 
-        session.set('signed_in_as', transaction.json_to_logjson(email))
-
+        session.set_json('signed_in_as', email)
         await transaction.commit()
       }
       catch (error) {
index 3ddf3c8..f5fda46 100644 (file)
@@ -1,5 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
-
 return async env => {
   let globals = await env.site.get_json('/_config/globals.json')
   let nodemailer_noreply = await env.site.get_nodemailer(
index db66bb9..613b1bd 100644 (file)
@@ -1,4 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -39,9 +38,7 @@ return async env => {
         let captcha = await session.get('captcha')
         if (
           captcha === undefined ||
-            XDate.now() >= await logjson.logjson_to_json(
-              await captcha.get('expires')
-            )
+            XDate.now() >= await captcha.get_json('expires')
         )
           throw new Problem(
             'No verification image in session',
@@ -49,9 +46,7 @@ return async env => {
             418
           )
         
-        let captcha_text = await logjson.logjson_to_json(
-          await captcha.get('text')
-        )
+        let captcha_text = await captcha.get_json('text')
         if (verification_code !== captcha_text) {
           console.log(`verification code mismatch, \"${verification_code}\" should be \"${captcha_text}\"`)
 
@@ -72,8 +67,8 @@ return async env => {
             `The email "${details.email}" already has an account registered.`,
             420
           )
-        accounts.set(details.email, transaction.json_to_logjson(details))
 
+        accounts.set_json(details.email, details)
         await transaction.commit()
       }
       catch (error) {
index b07ab2b..bd55bb3 100644 (file)
@@ -1,4 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -19,22 +18,14 @@ return async env => {
         let sign_up_draft = await session.get('sign_up_draft')
         let details =
           sign_up_draft !== undefined &&
-            XDate.now() < await logjson.logjson_to_json(
-              await sign_up_draft.get('expires')
-            ) ? {
-              email: await logjson.logjson_to_json(
-                await sign_up_draft.get('email')
-              ),
-              given_names: await logjson.logjson_to_json(
-                await sign_up_draft.get('given_names')
-              ),
-              family_name: await logjson.logjson_to_json(
-                await sign_up_draft.get('family_name')
-              ),
-              contact_me: await logjson.logjson_to_json(
-                await sign_up_draft.get('contact_me')
-              )
-            } : null
+            XDate.now() < await sign_up_draft.get_json('expires') ?
+            {
+              email: await sign_up_draft.get_json('email'),
+              given_names: await sign_up_draft.get_json('given_names'),
+              family_name: await sign_up_draft.get_json('family_name'),
+              contact_me: await sign_up_draft.get_json('contact_me')
+            } :
+            null
 
         await transaction.commit()
         return details
index ee1b7b4..f4cb176 100644 (file)
@@ -1,5 +1,4 @@
 let crypto = require('crypto')
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -42,11 +41,7 @@ return async env => {
             421
           )
 
-        if (
-          await logjson.logjson_to_json(
-            await account.get('email_verified')
-          )
-        )
+        if (await account.get_json('email_verified'))
           throw new Problem(
             'Email already verified',
             `Your email "${email}" is already verified. You can now sign in.`
@@ -56,17 +51,13 @@ return async env => {
         let link_code = crypto.randomBytes(16).toString('hex')
         let expires = new XDate()
         expires.addDays(1)
-        account.set(
+        account.set_json(
           'verify_email',
-          transaction.json_to_logjson({link_code, expires: expires.getTime()})
+          {link_code, expires: expires.getTime()}
         )
 
-        let given_names = await logjson.logjson_to_json(
-          await account.get('given_names', '')
-        )
-        let family_name = await logjson.logjson_to_json(
-          await account.get('family_name', '')
-        )
+        let given_names = await account.get_json('given_names', '')
+        let family_name = await account.get_json('family_name', '')
         let name =
           family_name.length ? `${given_names} ${family_name}` : given_names
 
index 0e3c105..c4b2e80 100644 (file)
@@ -27,17 +27,15 @@ return async env => {
         if (details) {
           let expires = new XDate()
           expires.addDays(1)
-          session.set(
+          session.set_json(
             'sign_up_draft',
-            transaction.json_to_logjson(
-              {
-                email: details.email,
-                given_names: details.given_names,
-                family_name: details.family_name,
-                contact_me: details.contact_me,
-                expires: expires.getTime()
-              }
-            )
+            {
+              email: details.email,
+              given_names: details.given_names,
+              family_name: details.family_name,
+              contact_me: details.contact_me,
+              expires: expires.getTime()
+            }
           )
         }
         else
index 1fe908c..fe7d701 100644 (file)
@@ -1,5 +1,4 @@
 let crypto = require('crypto')
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -39,11 +38,7 @@ return async env => {
             421
           )
 
-        if (
-          await logjson.logjson_to_json(
-            await account.get('email_verified')
-          )
-        )
+        if (await account.get_json('email_verified'))
           throw new Problem(
             'Email already verified',
             `Your email "${email}" is already verified. You can now sign in.`
@@ -53,20 +48,14 @@ return async env => {
         let verify_email = await account.get('verify_email')
         if (
           verify_email === undefined ||
-            XDate.now() >= await logjson.logjson_to_json(
-              await verify_email.get('expires')
-            )
+            XDate.now() >= await verify_email.get_json('expires')
         )
           throw new Problem(
             'Link code missing',
             `Email verification link code for account "${email}" does not exist or has expired.`,
             423
           )
-        if (
-          link_code !== await logjson.logjson_to_json(
-            await verify_email.get('link_code')
-          )
-        )
+        if (link_code !== await verify_email.get_json('link_code'))
           throw new Problem(
             'Link code mismatch',
             `Provided email verification link code "${link_code}" does not match expected value.`,
index 0d5359d..1b65966 100644 (file)
@@ -1,5 +1,4 @@
 let crypto = require('crypto')
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -42,20 +41,14 @@ return async env => {
         let verify_password = await account.get('verify_password')
         if (
           verify_password === undefined ||
-            XDate.now() >= await logjson.logjson_to_json(
-              await verify_password.get('expires')
-            )
+            XDate.now() >= await verify_password.get_json('expires')
         )
           throw new Problem(
             'Link code missing',
             `Password reset link code for account "${email}" does not exist or has expired.`,
             423
           )
-        if (
-          link_code !== await logjson.logjson_to_json(
-            await verify_password.get('link_code')
-          )
-        )
+        if (link_code !== await verify_password.get_json('link_code'))
           throw new Problem(
             'Link code mismatch',
             `Provided password reset link code "${link_code}" does not match expected value.`,
index 138c55a..95ddffc 100644 (file)
@@ -1,4 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -19,25 +18,15 @@ return async env => {
         let contact_draft = await session.get('contact_draft')
         let details =
           contact_draft !== undefined &&
-            XDate.now() < await logjson.logjson_to_json(
-              await contact_draft.get('expires')
-            ) ? {
-              given_names: await logjson.logjson_to_json(
-                await contact_draft.get('given_names')
-              ),
-              family_name: await logjson.logjson_to_json(
-                await contact_draft.get('family_name')
-              ),
-              company: await logjson.logjson_to_json(
-                await contact_draft.get('company')
-              ),
-              email: await logjson.logjson_to_json(
-                await contact_draft.get('email')
-              ),
-              message: await logjson.logjson_to_json(
-                await contact_draft.get('message')
-              )
-            } : null
+            XDate.now() < await contact_draft.get_json('expires') ?
+            {
+              given_names: await contact_draft.get_json('given_names'),
+              family_name: await contact_draft.get_json('family_name'),
+              company: await contact_draft.get_json('company'),
+              email: await contact_draft.get_json('email'),
+              message: await contact_draft.get_json('message')
+            } :
+            null
 
         await transaction.commit()
         return details
index b26531f..d6b9d80 100644 (file)
@@ -1,5 +1,4 @@
 let crypto = require('crypto')
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
index e6facb7..672c2fb 100644 (file)
@@ -28,18 +28,16 @@ return async env => {
         if (details) {
           let expires = new XDate()
           expires.addDays(1)
-          session.set(
+          session.set_json(
             'contact_draft',
-            transaction.json_to_logjson(
-              {
-                given_names: details.given_names,
-                family_name: details.family_name,
-                company: details.company,
-                email: details.email,
-                message: details.message,
-                expires: expires.getTime()
-              }
-            )
+            {
+              given_names: details.given_names,
+              family_name: details.family_name,
+              company: details.company,
+              email: details.email,
+              message: details.message,
+              expires: expires.getTime()
+            }
           )
         }
         else
index 30761c6..400c284 100644 (file)
@@ -1,4 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
index 22069a0..fb68ddb 100644 (file)
@@ -1,4 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -22,16 +21,11 @@ return async env => {
         let account = await (
           await root.get('accounts', {})
         ).get(env.signed_in_as)
-        if (
-          !await logjson.logjson_to_json(
-            await account.get('administrator')
-          )
-        )
+        if (!await account.get_json('administrator'))
           throw new Problem('Unauthorized', 'Not administrator.', 401)
 
-        globals = await logjson.logjson_to_json(
-          await root.get('globals', {})
-        )
+        globals = await root.get_json('globals', {})
+
         await transaction.commit()
         return globals
       }
index 5f986aa..d8fc5be 100644 (file)
@@ -1,4 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -35,14 +34,10 @@ return async env => {
         let account = await (
           await root.get('accounts', {})
         ).get(env.signed_in_as)
-        if (
-          !await logjson.logjson_to_json(
-            await account.get('administrator')
-          )
-        )
+        if (!await account.get_json('administrator'))
           throw new Problem('Unauthorized', 'Not administrator.', 401)
 
-        root.set('globals', transaction.json_to_logjson(globals))
+        root.set_json('globals', globals)
         await transaction.commit()
       }
       catch (error) {
index 7d0bfea..caa0ce5 100644 (file)
@@ -15,14 +15,9 @@ return async env => {
   // store captcha text in the session for validation when form submitted
   let expires = new XDate()
   expires.addHours(1)
-  session.set(
+  session.set_json(
     'captcha',
-    transaction.json_to_logjson(
-      {
-        text: captcha.text(),
-        expires: expires.getTime()
-      }
-    )
+    {text: captcha.text(), expires: expires.getTime()}
   )
 
   await transaction.commit()
index fda3325..8a39212 100644 (file)
@@ -1,4 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -17,28 +16,16 @@ return async env => {
     let contact_draft = await session.get('contact_draft')
     draft_details =
       contact_draft !== undefined &&
-        XDate.now() < await logjson.logjson_to_json(
-          await contact_draft.get('expires')
-        ) ? {
-          email: await logjson.logjson_to_json(
-            await contact_draft.get('email')
-          ),
-          given_names: await logjson.logjson_to_json(
-            await contact_draft.get('given_names')
-          ),
-          family_name: await logjson.logjson_to_json(
-            await contact_draft.get('family_name')
-          ),
-          company: await logjson.logjson_to_json(
-            await contact_draft.get('company')
-          ),
-          email: await logjson.logjson_to_json(
-            await contact_draft.get('email')
-          ),
-          message: await logjson.logjson_to_json(
-            await contact_draft.get('message')
-          )
-        } : null
+        XDate.now() < await contact_draft.get_json('expires') ?
+        {
+          email: await contact_draft.get_json('email'),
+          given_names: await contact_draft.get_json('given_names'),
+          family_name: await contact_draft.get_json('family_name'),
+          company: await contact_draft.get_json('company'),
+          email: await contact_draft.get_json('email'),
+          message: await contact_draft.get_json('message')
+        } :
+        null
 
     await transaction.commit()
   }
index 841790f..30dc0dc 100644 (file)
@@ -1,4 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -24,33 +23,21 @@ return async env => {
         ).get('accounts')
       ).get(env.signed_in_as)
       details = {
-        given_names: await logjson.logjson_to_json(
-          await account.get('given_names')
-        ),
-        family_name: await logjson.logjson_to_json(
-          await account.get('family_name')
-        ),
-        contact_me: await logjson.logjson_to_json(
-          await account.get('contact_me')
-        )
+        given_names: await account.get_json('given_names'),
+        family_name: await account.get_json('family_name'),
+        contact_me: await account.get_json('contact_me')
       }
 
       let change_details_draft = await session.get('change_details_draft')
       draft_details =
         change_details_draft !== undefined &&
-          XDate.now() < await logjson.logjson_to_json(
-            await change_details_draft.get('expires')
-          ) ? {
-            given_names: await logjson.logjson_to_json(
-              await change_details_draft.get('given_names')
-            ),
-            family_name: await logjson.logjson_to_json(
-              await change_details_draft.get('family_name')
-            ),
-            contact_me: await logjson.logjson_to_json(
-              await change_details_draft.get('contact_me')
-            )
-          } : null
+          XDate.now() < await change_details_draft.get_json('expires') ?
+          {
+            given_names: await change_details_draft.get_json('given_names'),
+            family_name: await change_details_draft.get_json('family_name'),
+            contact_me: await change_details_draft.get_json('contact_me')
+          } :
+          null
     }
     await transaction.commit()
   }
@@ -252,11 +239,13 @@ return async env => {
           let draft_timeout_handler = async () => {
             draft_timeout_running = false
             await api_account_change_details_set_draft(
-              step_1_dirty ? {
-                given_names: document.getElementById('given-names').value.slice(0, 256),
-                family_name: document.getElementById('family-name').value.slice(0, 256),
-                contact_me: document.getElementById('contact-me').checked ? true : false
-              } : null
+              step_1_dirty ?
+                {
+                  given_names: document.getElementById('given-names').value.slice(0, 256),
+                  family_name: document.getElementById('family-name').value.slice(0, 256),
+                  contact_me: document.getElementById('contact-me').checked ? true : false
+                } :
+                null
             )
             //console.log('draft', await api_account_change_details_get_draft())
           }
index e7adb1a..10fb539 100644 (file)
@@ -1,5 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
-
 return async env => {
   let breadcrumbs = await _require('/_lib/breadcrumbs.jst')
   let icon_cross = await env.site.get_min_svg('/_svg/icon_cross.svg')
index e033251..21862dc 100644 (file)
@@ -1,4 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -17,22 +16,14 @@ return async env => {
     let sign_up_draft = await session.get('sign_up_draft')
     draft_details =
       sign_up_draft !== undefined &&
-        XDate.now() < await logjson.logjson_to_json(
-          await sign_up_draft.get('expires')
-        ) ? {
-          email: await logjson.logjson_to_json(
-            await sign_up_draft.get('email')
-          ),
-          given_names: await logjson.logjson_to_json(
-            await sign_up_draft.get('given_names')
-          ),
-          family_name: await logjson.logjson_to_json(
-            await sign_up_draft.get('family_name')
-          ),
-          contact_me: await logjson.logjson_to_json(
-            await sign_up_draft.get('contact_me')
-          )
-        } : null
+        XDate.now() < await sign_up_draft.get_json('expires') ?
+        {
+          email: await sign_up_draft.get_json('email'),
+          given_names: await sign_up_draft.get_json('given_names'),
+          family_name: await sign_up_draft.get_json('family_name'),
+          contact_me: await sign_up_draft.get_json('contact_me')
+        } :
+        null
 
     await transaction.commit()
   }
index f0a953f..8f9fef0 100644 (file)
@@ -1,5 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
-
 return async env => {
   let breadcrumbs = await _require('/_lib/breadcrumbs.jst')
   let icon_cross = await env.site.get_min_svg('/_svg/icon_cross.svg')
@@ -15,8 +13,8 @@ return async env => {
      Object.prototype.hasOwnProperty.call(
       env.parsed_url.query,
       'link_code'
-     )
-   )
+    )
+  )
     details.link_code =
       decodeURIComponent(env.parsed_url.query.link_code)
   console.log('details', JSON.stringify(details))
index ca1c436..4c3fe7b 100644 (file)
@@ -1,5 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
-
 return async env => {
   let breadcrumbs = await _require('/_lib/breadcrumbs.jst')
   let icon_cross = await env.site.get_min_svg('/_svg/icon_cross.svg')
@@ -15,8 +13,8 @@ return async env => {
      Object.prototype.hasOwnProperty.call(
       env.parsed_url.query,
       'link_code'
-     )
-   )
+    )
+  )
     details.link_code =
       decodeURIComponent(env.parsed_url.query.link_code)
   console.log('details', JSON.stringify(details))