From 8372f4a1270f83175fb3a892eca12aba51c7285e Mon Sep 17 00:00:00 2001 From: npmrun Date: Fri, 16 Jun 2023 15:45:40 +0800 Subject: [PATCH] add --- public/js/page/index.js | 1 + route.txt | 2 +- source/plugins/index.ts | 2 +- source/run.ts | 1 - template/htmx/path/index.pug | 16 ++++++++++++++++ template/layout/layout.pug | 12 ------------ template/views/index.pug | 5 +---- 7 files changed, 20 insertions(+), 19 deletions(-) create mode 100644 public/js/page/index.js diff --git a/public/js/page/index.js b/public/js/page/index.js new file mode 100644 index 0000000..050ef83 --- /dev/null +++ b/public/js/page/index.js @@ -0,0 +1 @@ +console.log(2222) \ No newline at end of file diff --git a/route.txt b/route.txt index a21678c..6b5ce96 100644 --- a/route.txt +++ b/route.txt @@ -1,4 +1,4 @@ -/home/topuser/Code/@project/hapi-demo/source/route/views对应路径: +D:\1XYX\pro\hapi-demo\source\route\views对应路径: 不需权限(提供无需验证try): GET /404 不需权限(提供即需验证optional): GET / 不需权限(提供无需验证try): GET /about diff --git a/source/plugins/index.ts b/source/plugins/index.ts index f29468f..d4ca07e 100644 --- a/source/plugins/index.ts +++ b/source/plugins/index.ts @@ -24,7 +24,7 @@ const transport = pino.transport({ level: "trace", options: { destination: path.resolve(logsDir, "./pino.log"), - colorize: true, + colorize: false, translateTime: 'HH:MM:ss.l mmmm dS yyyy "UTC"', mkdir: true, // append: false diff --git a/source/run.ts b/source/run.ts index 6a8f669..35b2296 100644 --- a/source/run.ts +++ b/source/run.ts @@ -164,7 +164,6 @@ const run = async (): Promise => { server.ext('onPreResponse', (request, h) => { const { response } = request - // 如果状态码为403,则调用自定义错误处理程序 if (response instanceof Boom && (response.output.statusCode < 200 || response.output.statusCode > 299)) { return h.view('403.pug', { error: response}) diff --git a/template/htmx/path/index.pug b/template/htmx/path/index.pug index ef57441..a17c247 100644 --- a/template/htmx/path/index.pug +++ b/template/htmx/path/index.pug @@ -9,7 +9,23 @@ block page div style :public style/views/index.css + script + :public js/page/index.js .content!= md + button.js-modal-trigger(data-target='modal-js-example'). + Open JS example modal + #modal-js-example.modal + .modal-background + .modal-card + header.modal-card-head + p.modal-card-title Modal title + button.delete(aria-label='close') + section.modal-card-body + p 是大大撒大撒 + footer.modal-card-foot + button.button.is-success Save changes + button.button Cancel + button.modal-close.is-large(aria-label='close') //- if isLogin //- button(hx-target="#single-page" hx-get="/about?htmx" hx-push-url="/about" hx-trigger="click" hx-swap="innerHTML") Click Me! diff --git a/template/layout/layout.pug b/template/layout/layout.pug index fadaea0..b095f31 100644 --- a/template/layout/layout.pug +++ b/template/layout/layout.pug @@ -25,15 +25,3 @@ html(lang="zh-cn" class=hideHeader?"":"has-navbar-fixed-top") +script("js/common/htmx.min.js") +script("js/common/main.js") block script - #modal-js-example.modal - .modal-background - .modal-card - header.modal-card-head - p.modal-card-title Modal title - button.delete(aria-label='close') - section.modal-card-body - p 是大大撒大撒 - footer.modal-card-foot - button.button.is-success Save changes - button.button Cancel - button.modal-close.is-large(aria-label='close') diff --git a/template/views/index.pug b/template/views/index.pug index cfdd3cb..946cc04 100644 --- a/template/views/index.pug +++ b/template/views/index.pug @@ -1,7 +1,4 @@ extends @/layout/single-page block page - include @hxpath/index.pug - button.js-modal-trigger(data-target='modal-js-example'). - Open JS example modal - \ No newline at end of file + include @hxpath/index.pug \ No newline at end of file