From eb759a1d30b5d7332290b799236f9540c60dae31 Mon Sep 17 00:00:00 2001 From: underpostnet Date: Wed, 30 Oct 2024 22:26:42 +0000 Subject: [PATCH] Update github repo package --- src/client/components/core/CssCore.js | 33 ++++- src/client/components/core/Docs.js | 20 ++- src/client/components/core/Modal.js | 168 ++++++++++++++++++++++++-- src/server/cron.js | 22 +++- src/server/dns.js | 8 +- 5 files changed, 228 insertions(+), 23 deletions(-) diff --git a/src/client/components/core/CssCore.js b/src/client/components/core/CssCore.js index 247e4ca..f2d548e 100644 --- a/src/client/components/core/CssCore.js +++ b/src/client/components/core/CssCore.js @@ -1,5 +1,5 @@ import { AgGrid } from './AgGrid.js'; -import { boxShadow, scrollBarDarkRender, scrollBarLightRender } from './Css.js'; +import { borderChar, boxShadow, scrollBarDarkRender, scrollBarLightRender } from './Css.js'; import { LoadingAnimation } from './LoadingAnimation.js'; import { append, getProxyPath, s } from './VanillaJs.js'; @@ -135,6 +135,21 @@ const CssCommonCore = async () => { width: 100%; height: auto; } + .down-arrow-submenu { + top: -20px; + text-align: right; + padding-right: 42px; + color: #5f5f5f; + } + .main-body-btn { + width: 50px; + height: 50px; + font-size: 18px; + cursor: pointer; + } + .main-body-btn:hover { + font-size: 21px; + } - ${scrollBarDarkRender()} + ${scrollBarDarkRender()} ${borderChar(1, 'black', ['.main-body-btn-container'])} `, }; @@ -795,6 +816,12 @@ const CssCoreLight = { a:hover { color: #e89f4c; } + .ac { + color: #6d68ff !important; + } + .ahc { + color: #e89f4c !important; + } .content-render { font-size: 16px; font-family: monospace; @@ -810,7 +837,7 @@ const CssCoreLight = { .btn-input-extension:hover { } - ${scrollBarLightRender()} + ${scrollBarLightRender()} ${borderChar(1, 'white', ['.main-body-btn-container'])} `, }; diff --git a/src/client/components/core/Docs.js b/src/client/components/core/Docs.js index 36ecd98..c03a09c 100644 --- a/src/client/components/core/Docs.js +++ b/src/client/components/core/Docs.js @@ -154,16 +154,31 @@ const Docs = { const { idModal } = options; this.Tokens[idModal] = options; setTimeout(() => { + const cleanActive = () => { + s(`.btn-docs-src`).classList.remove('main-btn-menu-active'); + s(`.btn-docs-api`).classList.remove('main-btn-menu-active'); + s(`.btn-docs-coverage`).classList.remove('main-btn-menu-active'); + for (const umlType of umlTypes) { + const umlId = `uml-${umlType}`; + s(`.btn-docs-${umlId}`).classList.remove('main-btn-menu-active'); + } + }; s(`.btn-docs-src`).onclick = async () => { setQueryPath({ path: 'docs', queryPath: 'src' }); + cleanActive(); + s(`.btn-docs-src`).classList.add('main-btn-menu-active'); await this.RenderModal('src', options.modalOptions); }; s(`.btn-docs-api`).onclick = async () => { setQueryPath({ path: 'docs', queryPath: 'api' }); + cleanActive(); + s(`.btn-docs-api`).classList.add('main-btn-menu-active'); await this.RenderModal('api', options.modalOptions); }; s(`.btn-docs-coverage`).onclick = async () => { setQueryPath({ path: 'docs', queryPath: 'coverage' }); + cleanActive(); + s(`.btn-docs-coverage`).classList.add('main-btn-menu-active'); await this.RenderModal('coverage', options.modalOptions); }; @@ -183,6 +198,8 @@ const Docs = { for (const umlType of umlTypes) { const umlId = `uml-${umlType}`; s(`.btn-docs-${umlId}`).onclick = async () => { + cleanActive(); + s(`.btn-docs-${umlId}`).classList.add('main-btn-menu-active'); setQueryPath({ path: 'docs', queryPath: umlId }); await this.RenderModal(umlId, { ...options.modalOptions, handleType: 'bar' }); }; @@ -229,7 +246,8 @@ const Docs = { } htmls('.menu-btn-container-children', html` `); - s(`.menu-btn-container-main`).classList.add('hide'); + if (s(`.menu-btn-container-main`)) s(`.menu-btn-container-main`).classList.add('hide'); + htmls(`.nav-path-display-${'modal-menu'}`, location.pathname); this.Tokens[idModal] = new Sortable(s(`.menu-btn-container-docs`), { animation: 150, diff --git a/src/client/components/core/Modal.js b/src/client/components/core/Modal.js index 2ae43ce..0edeaa5 100644 --- a/src/client/components/core/Modal.js +++ b/src/client/components/core/Modal.js @@ -198,6 +198,11 @@ const Modal = { } }); + setTimeout(() => { + s(`.main-body-btn-container`).style[ + true || (options.mode && options.mode.match('right')) ? 'right' : 'left' + ] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px'; + }); Responsive.Event[`slide-menu-${idModal}`](); }; barConfig.buttons.close.onClick = () => { @@ -213,10 +218,87 @@ const Modal = { } }); // s(`.title-modal-${idModal}`).style.display = 'none'; + setTimeout(() => { + s(`.main-body-btn-container`).style[ + true || (options.mode && options.mode.match('right')) ? 'right' : 'left' + ] = `${0}px`; + }); Responsive.Event[`slide-menu-${idModal}`](); }; transition += `, width 0.3s`; + setTimeout(() => { + append( + 'body', + html` +
+
+
+ + +
+
+
+
+ + +
+
+
+ `, + ); + + s(`.main-body-btn-menu`).onclick = () => {}; + + let _heightTopBar, _heightBottomBar, _topMenu; + s(`.main-body-btn-ui`).onclick = () => { + if (s(`.main-body-btn-ui-open`).classList.contains('hide')) { + s(`.main-body-btn-ui-open`).classList.remove('hide'); + s(`.main-body-btn-ui-close`).classList.add('hide'); + _heightTopBar = newInstance(options.heightTopBar); + _heightBottomBar = newInstance(options.heightBottomBar); + _topMenu = newInstance(s(`.modal-menu`).style.top); + options.heightTopBar = 0; + options.heightBottomBar = 0; + s(`.slide-menu-top-bar`).classList.add('hide'); + s(`.bottom-bar`).classList.add('hide'); + s(`.modal-menu`).style.top = '0px'; + s(`.main-body-btn-container`).style.top = '50px'; + } else { + s(`.main-body-btn-ui-close`).classList.remove('hide'); + s(`.main-body-btn-ui-open`).classList.add('hide'); + options.heightTopBar = _heightTopBar; + options.heightBottomBar = _heightBottomBar; + s(`.modal-menu`).style.top = _topMenu; + s(`.main-body-btn-container`).style.top = `${options.heightTopBar + 50}px`; + s(`.slide-menu-top-bar`).classList.remove('hide'); + s(`.bottom-bar`).classList.remove('hide'); + } + s(`.btn-menu-${'modal-menu'}`).click(); + Object.keys(this.Data).map((_idModal) => { + if (this.Data[_idModal].slideMenu) { + s(`.btn-maximize-${_idModal}`).click(); + } + }); + Responsive.Event[`view-${'main-body'}`](); + if (Responsive.Event[`view-${'bottom-bar'}`]) Responsive.Event[`view-${'bottom-bar'}`](); + }; + }); + const inputSearchBoxId = `top-bar-search-box`; append( 'body', @@ -1053,6 +1135,28 @@ const Modal = { top: 5%; left: 5%; } + .sub-menu-title-container-${idModal}, + .nav-path-container-${idModal} { + top: 0px; + left: 0px; + width: 200px; + height: 50px; + overflow: hidden; + font-size: 20px; + cursor: default; + } + .nav-path-display-${idModal} { + font-size: 11px; + width: 100%; + top: 35px; + left: 37px; + } + .nav-title-display-${idModal} { + font-size: 19px; + width: 100%; + top: 13px; + left: 13px; + } ${renderStyleTag(`style-${idModal}`, `.${idModal}`, options)} ` : ''} ${options && options.html ? (typeof options.html === 'function' ? await options.html() : options.html) : ''} @@ -1179,6 +1291,15 @@ const Modal = { case 'slide-menu': case 'slide-menu-right': case 'slide-menu-left': + const backMenuButtonEvent = async () => { + if (location.pathname !== getProxyPath()) setPath(getProxyPath()); + if (s(`.menu-btn-container-children`)) htmls(`.menu-btn-container-children`, ''); + // htmls(`.nav-title-display-${'modal-menu'}`, html` ${Translate.Render('home')}`); + htmls(`.nav-title-display-${'modal-menu'}`, html``); + htmls(`.nav-path-display-${idModal}`, ''); + s(`.btn-icon-menu-back`).classList.add('hide'); + if (s(`.menu-btn-container-main`)) s(`.menu-btn-container-main`).classList.remove('hide'); + }; s(`.main-btn-home`).onclick = () => { for (const keyModal of Object.keys(this.Data)) { if ( @@ -1187,14 +1308,11 @@ const Modal = { .includes(keyModal) ) s(`.btn-close-${keyModal}`).click(); + backMenuButtonEvent(); } s(`.btn-close-modal-menu`).click(); }; - EventsUI.onClick(`.btn-icon-menu-back`, () => { - htmls(`.menu-btn-container-children`, ''); - s(`.btn-icon-menu-back`).classList.add('hide'); - s(`.menu-btn-container-main`).classList.remove('hide'); - }); + EventsUI.onClick(`.btn-icon-menu-back`, backMenuButtonEvent); EventsUI.onClick(`.btn-icon-menu-mode`, () => { if (s(`.btn-icon-menu-mode-right`).classList.contains('hide')) { s(`.btn-icon-menu-mode-right`).classList.remove('hide'); @@ -1205,6 +1323,12 @@ const Modal = { } if (slideMenuWidth === originSlideMenuWidth) { slideMenuWidth = collapseSlideMenuWidth; + setTimeout(() => { + s(`.main-body-btn-container`).style[ + true || (options.mode && options.mode.match('right')) ? 'right' : 'left' + ] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px'; + }, 1); + if (!s(`.btn-bar-center-icon-close`).classList.contains('hide')) { sa(`.handle-btn-container`).forEach((el) => el.classList.add('hide')); sa(`.menu-label-text`).forEach((el) => el.classList.add('hide')); @@ -1216,8 +1340,16 @@ const Modal = { s(`.btn-icon-menu-back`).classList.add('hide'); } if (options.onCollapseMenu) options.onCollapseMenu(); + s(`.sub-menu-title-container-${'modal-menu'}`).classList.add('hide'); + s(`.nav-path-container-${'modal-menu'}`).classList.add('hide'); } else { slideMenuWidth = originSlideMenuWidth; + setTimeout(() => { + s(`.main-body-btn-container`).style[ + true || (options.mode && options.mode.match('right')) ? 'right' : 'left' + ] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px'; + }, 1); + sa(`.handle-btn-container`).forEach((el) => el.classList.remove('hide')); sa(`.menu-label-text`).forEach((el) => el.classList.remove('hide')); if (!Modal.mobileModal()) { @@ -1228,6 +1360,8 @@ const Modal = { s(`.btn-icon-menu-back`).classList.remove('hide'); if (options.onExtendMenu) options.onExtendMenu(); + s(`.sub-menu-title-container-${'modal-menu'}`).classList.remove('hide'); + s(`.nav-path-container-${'modal-menu'}`).classList.remove('hide'); } // btn-bar-center-icon-menu this.actionBtnCenter(); @@ -1366,13 +1500,23 @@ const Modal = { callBack, id: options.slideMenu, }; - s(`.${idModal}`).style.height = `${ - window.innerHeight - - (options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) - - (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar) - }px`; - s(`.${idModal}`).style.top = `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`; + Responsive.Event['h-ui-hide-' + idModal] = () => { + setTimeout(() => { + s(`.${idModal}`).style.height = s(`.main-body-btn-ui-close`).classList.contains('hide') + ? `${window.innerHeight}px` + : `${ + window.innerHeight - + (options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) - + (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar) + }px`; + s(`.${idModal}`).style.top = s(`.main-body-btn-ui-close`).classList.contains('hide') + ? `0px` + : `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`; + }); + }; + Responsive.Event['h-ui-hide-' + idModal](); } else { + delete Responsive.Event['h-ui-hide-' + idModal]; s(`.${idModal}`).style.width = '100%'; s(`.${idModal}`).style.height = '100%'; s(`.${idModal}`).style.top = `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`; diff --git a/src/server/cron.js b/src/server/cron.js index 2280730..94cf4a4 100644 --- a/src/server/cron.js +++ b/src/server/cron.js @@ -10,7 +10,7 @@ const CronManagement = { // https://github.com/settings/tokens for (const cronKey of Object.keys(this.data)) { if (this.data[cronKey].valid) { - this.data[cronKey].task.start(); + // this.data[cronKey].task.start(); logger.info(`Cron task "${this.data[cronKey].name}" started`); } else { logger.error( @@ -23,11 +23,21 @@ const CronManagement = { const args = { name, expression, valid: cron.validate(expression) }; this.data[name] = { ...args, - task: cron.schedule(expression, callback, { - scheduled: true, - timezone: process.env.TIME_ZONE || 'America/New_York', - name, - }), + task: cron.schedule( + expression, + async () => { + try { + await callback(); + } catch (error) { + logger.error(error, args); + } + }, + { + scheduled: true, + timezone: process.env.TIME_ZONE || 'America/New_York', + name, + }, + ), }; }, }; diff --git a/src/server/dns.js b/src/server/dns.js index 606630f..2ef74e9 100644 --- a/src/server/dns.js +++ b/src/server/dns.js @@ -1,12 +1,18 @@ import axios from 'axios'; import dotenv from 'dotenv'; import fs from 'fs'; -import cron from 'node-cron'; +import https from 'https'; import { ip } from './network.js'; import { loggerFactory } from './logger.js'; import { isIPv4 } from 'is-ip'; +const httpsAgent = new https.Agent({ + rejectUnauthorized: false, +}); + +axios.defaults.httpsAgent = httpsAgent; + dotenv.config(); const logger = loggerFactory(import.meta);