@underpostnet/underpost 2.7.91 → 2.7.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/deploy.js +13 -11
- package/bin/file.js +1 -0
- package/bin/hwt.js +59 -0
- package/bin/index.js +1 -1
- package/conf.js +28 -4
- package/docker-compose.yml +1 -1
- package/package.json +2 -2
- package/src/client/components/core/404.js +20 -0
- package/src/client/components/core/500.js +20 -0
- package/src/client/{ssr/common → components/core}/Alert.js +13 -11
- package/src/client/components/core/Docs.js +1 -1
- package/src/client/components/core/Modal.js +5 -6
- package/src/client/components/core/Translate.js +21 -5
- package/src/client/components/core/VanillaJs.js +2 -1
- package/src/client/components/core/Worker.js +10 -11
- package/src/client/components/default/MenuDefault.js +68 -0
- package/src/client/components/default/RoutesDefault.js +2 -0
- package/src/client/public/default/plantuml/client-conf.svg +1 -1
- package/src/client/public/default/plantuml/client-schema.svg +1 -1
- package/src/client/public/default/plantuml/cron-schema.svg +1 -1
- package/src/client/public/default/plantuml/server-conf.svg +1 -1
- package/src/client/public/default/plantuml/server-schema.svg +1 -1
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -1
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -1
- package/src/client/ssr/Render.js +1 -6
- package/src/client/ssr/{components/body → body}/CacheControl.js +1 -1
- package/src/client/ssr/mailer/DefaultRecoverEmail.js +21 -0
- package/src/client/ssr/mailer/DefaultVerifyEmail.js +17 -0
- package/src/client/ssr/offline/NoNetworkConnection.js +65 -0
- package/src/client/ssr/pages/Test.js +196 -0
- package/src/client/sw/default.sw.js +43 -166
- package/src/mailer/EmailRender.js +2 -4
- package/src/mailer/MailerProvider.js +4 -1
- package/src/server/client-build.js +100 -74
- package/src/server/client-formatted.js +2 -4
- package/src/server/conf.js +40 -13
- package/src/server/proxy.js +0 -2
- package/src/server/runtime.js +38 -10
- package/src/client/ssr/common/SsrCore.js +0 -91
- package/src/client/ssr/common/Translate.js +0 -26
- package/src/client/ssr/common/Worker.js +0 -28
- package/src/client/ssr/components/head/PwaDefault.js +0 -60
- /package/src/client/ssr/{components/body → body}/DefaultSplashScreen.js +0 -0
- /package/src/client/ssr/{components/email → email}/DefaultRecoverEmail.js +0 -0
- /package/src/client/ssr/{components/email → email}/DefaultVerifyEmail.js +0 -0
- /package/src/client/ssr/{components/head → head}/Css.js +0 -0
- /package/src/client/ssr/{components/head → head}/DefaultScripts.js +0 -0
- /package/src/client/ssr/{components/head → head}/Production.js +0 -0
- /package/src/client/ssr/{components/head → head}/Pwa.js +0 -0
- /package/src/client/ssr/{components/head → head}/Seo.js +0 -0
package/bin/deploy.js
CHANGED
|
@@ -29,12 +29,12 @@ import {
|
|
|
29
29
|
} from '../src/server/conf.js';
|
|
30
30
|
import { buildClient } from '../src/server/client-build.js';
|
|
31
31
|
import { range, setPad, timer, uniqueArray } from '../src/client/components/core/CommonJs.js';
|
|
32
|
-
import toJsonSchema from 'to-json-schema';
|
|
33
32
|
import simpleGit from 'simple-git';
|
|
34
33
|
import { MongooseDB } from '../src/db/mongo/MongooseDB.js';
|
|
35
34
|
import { Lampp } from '../src/runtime/lampp/Lampp.js';
|
|
36
35
|
import { DefaultConf } from '../conf.js';
|
|
37
36
|
import { JSONweb } from '../src/server/client-formatted.js';
|
|
37
|
+
import ejs from 'easy-json-schema';
|
|
38
38
|
|
|
39
39
|
const logger = loggerFactory(import.meta);
|
|
40
40
|
|
|
@@ -573,29 +573,33 @@ try {
|
|
|
573
573
|
}
|
|
574
574
|
case 'build-uml':
|
|
575
575
|
{
|
|
576
|
-
const
|
|
577
|
-
const path = process.argv[4];
|
|
578
|
-
const folder = `./public/${host}${path}/docs/plantuml`;
|
|
576
|
+
const folder = process.argv[3] ? process.argv[3] : `./src/client/public/default/plantuml`;
|
|
579
577
|
const confData = Config.default;
|
|
580
578
|
|
|
581
579
|
if (!fs.existsSync(folder)) fs.mkdirSync(folder, { recursive: true });
|
|
582
580
|
|
|
583
581
|
for (const typeConf of Object.keys(confData)) {
|
|
584
|
-
{
|
|
582
|
+
logger.info(`generate ${typeConf} instance`);
|
|
583
|
+
try {
|
|
585
584
|
const svg = await plantuml(`
|
|
586
585
|
@startjson
|
|
587
586
|
${JSON.stringify(confData[typeConf])}
|
|
588
587
|
@endjson
|
|
589
588
|
`);
|
|
590
589
|
fs.writeFileSync(`${folder}/${typeConf}-conf.svg`, svg);
|
|
590
|
+
} catch (error) {
|
|
591
|
+
logger.error(error, error.stack);
|
|
591
592
|
}
|
|
592
|
-
{
|
|
593
|
+
logger.info(`generate ${typeConf} schema`);
|
|
594
|
+
try {
|
|
593
595
|
const svg = await plantuml(`
|
|
594
596
|
@startjson
|
|
595
|
-
${JSON.stringify(
|
|
597
|
+
${JSON.stringify(ejs(confData[typeConf]))}
|
|
596
598
|
@endjson
|
|
597
599
|
`);
|
|
598
600
|
fs.writeFileSync(`${folder}/${typeConf}-schema.svg`, svg);
|
|
601
|
+
} catch (error) {
|
|
602
|
+
logger.error(error, error.stack);
|
|
599
603
|
}
|
|
600
604
|
}
|
|
601
605
|
}
|
|
@@ -733,10 +737,8 @@ try {
|
|
|
733
737
|
);
|
|
734
738
|
|
|
735
739
|
fs.writeFileSync(
|
|
736
|
-
`./src/client/ssr/
|
|
737
|
-
fs
|
|
738
|
-
.readFileSync(`./src/client/ssr/components/body/CacheControl.js`, 'utf8')
|
|
739
|
-
.replaceAll(`v${version}`, `v${newVersion}`),
|
|
740
|
+
`./src/client/ssr/body/CacheControl.js`,
|
|
741
|
+
fs.readFileSync(`./src/client/ssr/body/CacheControl.js`, 'utf8').replaceAll(`v${version}`, `v${newVersion}`),
|
|
740
742
|
'utf8',
|
|
741
743
|
);
|
|
742
744
|
|
package/bin/file.js
CHANGED
package/bin/hwt.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import https from 'https';
|
|
4
|
+
|
|
5
|
+
import dotenv from 'dotenv';
|
|
6
|
+
import { shellCd, shellExec } from '../src/server/process.js';
|
|
7
|
+
import { loggerFactory } from '../src/server/logger.js';
|
|
8
|
+
|
|
9
|
+
const logger = loggerFactory(import.meta);
|
|
10
|
+
|
|
11
|
+
const httpsAgent = new https.Agent({
|
|
12
|
+
rejectUnauthorized: false,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
axios.defaults.httpsAgent = httpsAgent;
|
|
16
|
+
|
|
17
|
+
logger.info('argv', process.argv);
|
|
18
|
+
|
|
19
|
+
const [exe, dir, operator, templateId, publicPath] = process.argv;
|
|
20
|
+
|
|
21
|
+
// engine for 'html-website-templates'
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
switch (operator) {
|
|
25
|
+
case 'set-base':
|
|
26
|
+
{
|
|
27
|
+
switch (parseInt(templateId)) {
|
|
28
|
+
// Horizontal Scroll One Page Template Website
|
|
29
|
+
case 0:
|
|
30
|
+
{
|
|
31
|
+
fs.writeFile(
|
|
32
|
+
`${publicPath}/index.html`,
|
|
33
|
+
fs
|
|
34
|
+
.readFileSync(`${publicPath}/index.html`, 'utf8')
|
|
35
|
+
.replace(`<ul class="menu">`, `<ul class="menu hidden">`)
|
|
36
|
+
.replaceAll(`<section class="slide fade-6 kenBurns">`, `<section class="fade-6 kenBurns hidden">`)
|
|
37
|
+
.replace(`<section class="fade-6 kenBurns hidden">`, `<section class="slide fade-6 kenBurns">`)
|
|
38
|
+
.replaceAll(
|
|
39
|
+
`<nav class="panel bottom forceMobileView">`,
|
|
40
|
+
`<nav class="panel bottom forceMobileView hidden">`,
|
|
41
|
+
),
|
|
42
|
+
|
|
43
|
+
'utf8',
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
break;
|
|
47
|
+
|
|
48
|
+
default:
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
|
|
54
|
+
default:
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
} catch (error) {
|
|
58
|
+
logger.error(error, error.stack);
|
|
59
|
+
}
|
package/bin/index.js
CHANGED
package/conf.js
CHANGED
|
@@ -56,6 +56,9 @@ const DefaultConf = {
|
|
|
56
56
|
'Panel',
|
|
57
57
|
'PanelForm',
|
|
58
58
|
'Scroll',
|
|
59
|
+
'Alert',
|
|
60
|
+
'404',
|
|
61
|
+
'500',
|
|
59
62
|
],
|
|
60
63
|
default: [
|
|
61
64
|
'MenuDefault',
|
|
@@ -124,6 +127,8 @@ const DefaultConf = {
|
|
|
124
127
|
client: 'Default',
|
|
125
128
|
ssr: 'Default',
|
|
126
129
|
},
|
|
130
|
+
{ client: 'Default', ssr: 'Default', path: '/404', title: '404 Not Found' },
|
|
131
|
+
{ client: 'Default', ssr: 'Default', path: '/500', title: '500 Server Error' },
|
|
127
132
|
],
|
|
128
133
|
dists: [
|
|
129
134
|
{
|
|
@@ -176,6 +181,28 @@ const DefaultConf = {
|
|
|
176
181
|
Default: {
|
|
177
182
|
head: ['Seo', 'Pwa', 'Css', 'DefaultScripts', 'Production'],
|
|
178
183
|
body: ['CacheControl', 'DefaultSplashScreen'],
|
|
184
|
+
mailer: {
|
|
185
|
+
userVerifyEmail: 'DefaultVerifyEmail',
|
|
186
|
+
userRecoverEmail: 'DefaultRecoverEmail',
|
|
187
|
+
},
|
|
188
|
+
offline: [
|
|
189
|
+
{
|
|
190
|
+
path: '/offline',
|
|
191
|
+
title: 'No Network Connection',
|
|
192
|
+
client: 'NoNetworkConnection',
|
|
193
|
+
head: [],
|
|
194
|
+
body: [],
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
pages: [
|
|
198
|
+
{
|
|
199
|
+
path: '/test',
|
|
200
|
+
title: 'Test',
|
|
201
|
+
client: 'Test',
|
|
202
|
+
head: [],
|
|
203
|
+
body: [],
|
|
204
|
+
},
|
|
205
|
+
],
|
|
179
206
|
},
|
|
180
207
|
},
|
|
181
208
|
server: {
|
|
@@ -189,6 +216,7 @@ const DefaultConf = {
|
|
|
189
216
|
iconsBuild: true,
|
|
190
217
|
liteBuild: false,
|
|
191
218
|
docsBuild: false,
|
|
219
|
+
offlineBuild: false,
|
|
192
220
|
ws: 'core',
|
|
193
221
|
peer: true,
|
|
194
222
|
proxy: [80, 443],
|
|
@@ -211,10 +239,6 @@ const DefaultConf = {
|
|
|
211
239
|
pass: '',
|
|
212
240
|
},
|
|
213
241
|
},
|
|
214
|
-
templates: {
|
|
215
|
-
userVerifyEmail: 'DefaultVerifyEmail',
|
|
216
|
-
userRecoverEmail: 'DefaultRecoverEmail',
|
|
217
|
-
},
|
|
218
242
|
},
|
|
219
243
|
},
|
|
220
244
|
},
|
package/docker-compose.yml
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"main": "src/index.js",
|
|
4
4
|
"name": "@underpostnet/underpost",
|
|
5
|
-
"version": "2.7.
|
|
5
|
+
"version": "2.7.92",
|
|
6
6
|
"description": "pwa api rest template",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"mocha": "^10.4.0",
|
|
125
125
|
"plantuml": "^0.0.2",
|
|
126
126
|
"swagger-autogen": "^2.23.7",
|
|
127
|
-
"
|
|
127
|
+
"easy-json-schema": "^0.0.2-beta"
|
|
128
128
|
},
|
|
129
129
|
"publishConfig": {
|
|
130
130
|
"provenance": true,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Alert } from './Alert.js';
|
|
2
|
+
import { Modal } from './Modal.js';
|
|
3
|
+
import { s } from './VanillaJs.js';
|
|
4
|
+
|
|
5
|
+
const Page404 = {
|
|
6
|
+
Render: async function (options = { idModal: '' }) {
|
|
7
|
+
setTimeout(() => {
|
|
8
|
+
Modal.Data[options.idModal].onObserverListener['404'] = () => {
|
|
9
|
+
if (s(`.container-404-${options.idModal}`))
|
|
10
|
+
s(`.container-404-${options.idModal}`).style.height = `${
|
|
11
|
+
s(`.${options.idModal}`).offsetHeight - Modal.headerTitleHeight
|
|
12
|
+
}px`;
|
|
13
|
+
};
|
|
14
|
+
Modal.Data[options.idModal].onObserverListener['404']();
|
|
15
|
+
});
|
|
16
|
+
return html`<div class="in container-404-${options.idModal}">${await Alert.e404()}</div>`;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { Page404 };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Alert } from './Alert.js';
|
|
2
|
+
import { Modal } from './Modal.js';
|
|
3
|
+
import { s } from './VanillaJs.js';
|
|
4
|
+
|
|
5
|
+
const Page500 = {
|
|
6
|
+
Render: async function (options = { idModal: '' }) {
|
|
7
|
+
setTimeout(() => {
|
|
8
|
+
Modal.Data[options.idModal].onObserverListener['500'] = () => {
|
|
9
|
+
if (s(`.container-500-${options.idModal}`))
|
|
10
|
+
s(`.container-500-${options.idModal}`).style.height = `${
|
|
11
|
+
s(`.${options.idModal}`).offsetHeight - Modal.headerTitleHeight
|
|
12
|
+
}px`;
|
|
13
|
+
};
|
|
14
|
+
Modal.Data[options.idModal].onObserverListener['500']();
|
|
15
|
+
});
|
|
16
|
+
return html`<div class="in container-500-${options.idModal}">${await Alert.e500()}</div>`;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { Page500 };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { Translate } from './Translate.js';
|
|
2
|
+
|
|
3
|
+
const maintenance = async () => {
|
|
2
4
|
const icon = html`<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 24 24">
|
|
3
5
|
<path
|
|
4
6
|
fill="none"
|
|
@@ -12,11 +14,11 @@ const maintenance = async ({ Translate }) => {
|
|
|
12
14
|
return html` <div class="abs center" style="top: 45%">
|
|
13
15
|
${icon}
|
|
14
16
|
<br />
|
|
15
|
-
<br />${Translate('server-maintenance')}
|
|
17
|
+
<br />${Translate.Render('server-maintenance')}
|
|
16
18
|
</div>`;
|
|
17
19
|
};
|
|
18
20
|
|
|
19
|
-
const noInternet = async (
|
|
21
|
+
const noInternet = async () => {
|
|
20
22
|
const icon = html`<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 20 20">
|
|
21
23
|
<path
|
|
22
24
|
fill="currentColor"
|
|
@@ -26,11 +28,11 @@ const noInternet = async ({ Translate }) => {
|
|
|
26
28
|
return html` <div class="abs center" style="top: 45%">
|
|
27
29
|
${icon}
|
|
28
30
|
<br />
|
|
29
|
-
<br />${Translate('no-internet-connection')}
|
|
31
|
+
<br />${Translate.Render('no-internet-connection')}
|
|
30
32
|
</div>`;
|
|
31
33
|
};
|
|
32
34
|
|
|
33
|
-
const e404 = async (
|
|
35
|
+
const e404 = async () => {
|
|
34
36
|
const icon = html`
|
|
35
37
|
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 24 24">
|
|
36
38
|
<path
|
|
@@ -45,13 +47,13 @@ const e404 = async ({ Translate }) => {
|
|
|
45
47
|
<br />
|
|
46
48
|
<span class="bold">404</span>
|
|
47
49
|
<br />
|
|
48
|
-
<br />${Translate('page-not-found')} <br />
|
|
50
|
+
<br />${Translate.Render('page-not-found')} <br />
|
|
49
51
|
<br />
|
|
50
|
-
<a href="${location.origin}">${Translate('back')}</a>
|
|
52
|
+
<a href="${location.origin}">${Translate.Render('back')}</a>
|
|
51
53
|
</div>`;
|
|
52
54
|
};
|
|
53
55
|
|
|
54
|
-
const e500 = async (
|
|
56
|
+
const e500 = async () => {
|
|
55
57
|
const icon = html`<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 20 20">
|
|
56
58
|
<path
|
|
57
59
|
fill="currentColor"
|
|
@@ -64,12 +66,12 @@ const e500 = async ({ Translate }) => {
|
|
|
64
66
|
<br />
|
|
65
67
|
<span class="bold">500</span>
|
|
66
68
|
<br />
|
|
67
|
-
<br />${Translate('page-broken')} <br />
|
|
69
|
+
<br />${Translate.Render('page-broken')} <br />
|
|
68
70
|
<br />
|
|
69
|
-
<a href="${location.origin}">${Translate('back')}</a>
|
|
71
|
+
<a href="${location.origin}">${Translate.Render('back')}</a>
|
|
70
72
|
</div>`;
|
|
71
73
|
};
|
|
72
74
|
|
|
73
75
|
const Alert = { maintenance, noInternet, e404, e500 };
|
|
74
76
|
|
|
75
|
-
export { Alert
|
|
77
|
+
export { Alert };
|
|
@@ -827,6 +827,7 @@ const Modal = {
|
|
|
827
827
|
heightTopBar: originHeightTopBar,
|
|
828
828
|
heightBottomBar: originHeightBottomBar,
|
|
829
829
|
barMode: options.barMode,
|
|
830
|
+
observer: true,
|
|
830
831
|
});
|
|
831
832
|
const maxWidthInputSearchBox = 450;
|
|
832
833
|
const paddingInputSearchBox = 5;
|
|
@@ -1531,20 +1532,18 @@ const Modal = {
|
|
|
1531
1532
|
Responsive.Event['h-ui-hide-' + idModal] = () => {
|
|
1532
1533
|
setTimeout(() => {
|
|
1533
1534
|
if (!s(`.${idModal}`) || !s(`.main-body-btn-ui-close`)) return;
|
|
1534
|
-
s(
|
|
1535
|
-
s(`.main-body-btn-ui-close`).classList.contains('hide')
|
|
1536
|
-
s(`.btn-restore-${idModal}`).style.display !== 'none'
|
|
1535
|
+
if (s(`.btn-restore-${idModal}`).style.display !== 'none') {
|
|
1536
|
+
s(`.${idModal}`).style.height = s(`.main-body-btn-ui-close`).classList.contains('hide')
|
|
1537
1537
|
? `${window.innerHeight}px`
|
|
1538
1538
|
: `${
|
|
1539
1539
|
window.innerHeight -
|
|
1540
1540
|
(options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) -
|
|
1541
1541
|
(options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
|
|
1542
1542
|
}px`;
|
|
1543
|
-
|
|
1544
|
-
s(`.main-body-btn-ui-close`).classList.contains('hide') &&
|
|
1545
|
-
s(`.btn-restore-${idModal}`).style.display !== 'none'
|
|
1543
|
+
s(`.${idModal}`).style.top = s(`.main-body-btn-ui-close`).classList.contains('hide')
|
|
1546
1544
|
? `0px`
|
|
1547
1545
|
: `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`;
|
|
1546
|
+
}
|
|
1548
1547
|
});
|
|
1549
1548
|
};
|
|
1550
1549
|
Responsive.Event['h-ui-hide-' + idModal]();
|
|
@@ -66,11 +66,7 @@ const Translate = {
|
|
|
66
66
|
|
|
67
67
|
const TranslateCore = {
|
|
68
68
|
Init: async function () {
|
|
69
|
-
s('html').lang =
|
|
70
|
-
? localStorage.getItem('lang')
|
|
71
|
-
: getLang() && getLang().match('es')
|
|
72
|
-
? 'es'
|
|
73
|
-
: 'en';
|
|
69
|
+
s('html').lang = getLang();
|
|
74
70
|
Translate.Data = {
|
|
75
71
|
...Translate.Data,
|
|
76
72
|
isEmpty: {
|
|
@@ -252,6 +248,26 @@ const TranslateCore = {
|
|
|
252
248
|
en: 'Comments',
|
|
253
249
|
es: 'Comentarios',
|
|
254
250
|
},
|
|
251
|
+
['server-maintenance']: {
|
|
252
|
+
en: "The server is under maintenance <br> we'll be back soon.",
|
|
253
|
+
es: 'El servidor está en mantenimiento <br> volveremos pronto.',
|
|
254
|
+
},
|
|
255
|
+
['no-internet-connection']: {
|
|
256
|
+
en: 'No internet connection <br> verify your network',
|
|
257
|
+
es: 'Sin conexión a internet <br> verifica tu red',
|
|
258
|
+
},
|
|
259
|
+
['page-not-found']: {
|
|
260
|
+
en: 'Page not found',
|
|
261
|
+
es: 'Página no encontrada',
|
|
262
|
+
},
|
|
263
|
+
['page-broken']: {
|
|
264
|
+
es: 'Algo salio mal',
|
|
265
|
+
en: 'Something went wrong',
|
|
266
|
+
},
|
|
267
|
+
['back']: {
|
|
268
|
+
en: 'Back to <br> homepage',
|
|
269
|
+
es: 'Volver a <br> la pagina principal',
|
|
270
|
+
},
|
|
255
271
|
},
|
|
256
272
|
};
|
|
257
273
|
Translate.Data['warning-upload-no-selects-file'] = {
|
|
@@ -428,7 +428,8 @@ const isDevInstance = () => location.origin.match('localhost') && location.port;
|
|
|
428
428
|
|
|
429
429
|
const getDataFromInputFile = async (file) => Array.from(new Uint8Array(await file.arrayBuffer()));
|
|
430
430
|
|
|
431
|
-
const getLang = () =>
|
|
431
|
+
const getLang = () =>
|
|
432
|
+
(localStorage.getItem('lang') || navigator.language || navigator.userLanguage || s('html').lang).slice(0, 2);
|
|
432
433
|
|
|
433
434
|
export {
|
|
434
435
|
s,
|
|
@@ -13,6 +13,15 @@ const Worker = {
|
|
|
13
13
|
devMode: () => location.origin.match('localhost') || location.origin.match('127.0.0.1'),
|
|
14
14
|
instance: async function ({ router, render }) {
|
|
15
15
|
logger.warn('Init');
|
|
16
|
+
window.ononline = async () => {
|
|
17
|
+
logger.warn('ononline');
|
|
18
|
+
};
|
|
19
|
+
window.onoffline = async () => {
|
|
20
|
+
logger.warn('onoffline');
|
|
21
|
+
};
|
|
22
|
+
setTimeout(() => {
|
|
23
|
+
if ('onLine' in navigator && navigator.onLine) window.ononline();
|
|
24
|
+
});
|
|
16
25
|
navigator.serviceWorker.addEventListener('controllerchange', () => {
|
|
17
26
|
logger.info('The controller of current browsing context has changed.');
|
|
18
27
|
});
|
|
@@ -48,12 +57,9 @@ const Worker = {
|
|
|
48
57
|
// channel.postMessage({ title: 'Hello from Client broadcast message' });
|
|
49
58
|
// channel.close();
|
|
50
59
|
});
|
|
60
|
+
this.RouterInstance = router();
|
|
51
61
|
const isInstall = await this.status();
|
|
52
62
|
if (!isInstall) await this.install();
|
|
53
|
-
else await this.update();
|
|
54
|
-
await this.updateOfflineSrc();
|
|
55
|
-
// else if (location.hostname === 'localhost') await this.update();
|
|
56
|
-
this.RouterInstance = router();
|
|
57
63
|
await render();
|
|
58
64
|
LoadRouter(this.RouterInstance);
|
|
59
65
|
LoadingAnimation.removeSplashScreen();
|
|
@@ -212,13 +218,6 @@ const Worker = {
|
|
|
212
218
|
}
|
|
213
219
|
});
|
|
214
220
|
},
|
|
215
|
-
updateOfflineSrc: async function () {
|
|
216
|
-
try {
|
|
217
|
-
await fetch(`${getProxyPath()}offline.html`);
|
|
218
|
-
} catch (error) {
|
|
219
|
-
logger.error('error');
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
221
|
// TODO: GPS management
|
|
223
222
|
RenderSetting: async function () {
|
|
224
223
|
setTimeout(() => {
|
|
@@ -17,6 +17,8 @@ import { Badge } from '../core/Badge.js';
|
|
|
17
17
|
import { Docs } from '../core/Docs.js';
|
|
18
18
|
import { Recover } from '../core/Recover.js';
|
|
19
19
|
import { DefaultManagement } from '../../services/default/default.management.js';
|
|
20
|
+
import { Page500 } from '../core/500.js';
|
|
21
|
+
import { Page404 } from '../core/404.js';
|
|
20
22
|
|
|
21
23
|
const MenuDefault = {
|
|
22
24
|
Data: {},
|
|
@@ -136,6 +138,28 @@ const MenuDefault = {
|
|
|
136
138
|
handleContainerClass: 'handle-btn-container',
|
|
137
139
|
tooltipHtml: await Badge.Render(buildBadgeToolTipMenuOption('default-management')),
|
|
138
140
|
})}
|
|
141
|
+
${await BtnIcon.Render({
|
|
142
|
+
class: 'in wfa main-btn-menu main-btn-404 hide',
|
|
143
|
+
label: renderMenuLabel({
|
|
144
|
+
icon: html`<i class="fa-solid fa-triangle-exclamation"></i>`,
|
|
145
|
+
text: html`<span class="menu-label-text">${Translate.Render('404')}</span>`,
|
|
146
|
+
}),
|
|
147
|
+
attrs: `data-id="404"`,
|
|
148
|
+
tabHref: `${getProxyPath()}404`,
|
|
149
|
+
handleContainerClass: 'handle-btn-container',
|
|
150
|
+
tooltipHtml: await Badge.Render(buildBadgeToolTipMenuOption('404')),
|
|
151
|
+
})}
|
|
152
|
+
${await BtnIcon.Render({
|
|
153
|
+
class: 'in wfa main-btn-menu main-btn-500 hide',
|
|
154
|
+
label: renderMenuLabel({
|
|
155
|
+
icon: html`<i class="fa-solid fa-circle-exclamation"></i>`,
|
|
156
|
+
text: html`<span class="menu-label-text">${Translate.Render('500')}</span>`,
|
|
157
|
+
}),
|
|
158
|
+
attrs: `data-id="500"`,
|
|
159
|
+
tabHref: `${getProxyPath()}500`,
|
|
160
|
+
handleContainerClass: 'handle-btn-container',
|
|
161
|
+
tooltipHtml: await Badge.Render(buildBadgeToolTipMenuOption('500')),
|
|
162
|
+
})}
|
|
139
163
|
</div>
|
|
140
164
|
`,
|
|
141
165
|
barConfig: newInstance(barConfig),
|
|
@@ -383,6 +407,50 @@ const MenuDefault = {
|
|
|
383
407
|
heightBottomBar,
|
|
384
408
|
});
|
|
385
409
|
});
|
|
410
|
+
|
|
411
|
+
EventsUI.onClick(`.main-btn-404`, async () => {
|
|
412
|
+
const { barConfig } = await Themes[Css.currentTheme]();
|
|
413
|
+
await Modal.Render({
|
|
414
|
+
id: 'modal-404',
|
|
415
|
+
route: '404',
|
|
416
|
+
barConfig,
|
|
417
|
+
title: renderViewTitle({
|
|
418
|
+
icon: html`<i class="fa-solid fa-triangle-exclamation"></i>`,
|
|
419
|
+
text: Translate.Render('404'),
|
|
420
|
+
}),
|
|
421
|
+
html: async () => await Page404.Render({ idModal: 'modal-404' }),
|
|
422
|
+
handleType: 'bar',
|
|
423
|
+
maximize: true,
|
|
424
|
+
mode: 'view',
|
|
425
|
+
slideMenu: 'modal-menu',
|
|
426
|
+
RouterInstance,
|
|
427
|
+
heightTopBar,
|
|
428
|
+
heightBottomBar,
|
|
429
|
+
observer: true,
|
|
430
|
+
});
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
EventsUI.onClick(`.main-btn-500`, async () => {
|
|
434
|
+
const { barConfig } = await Themes[Css.currentTheme]();
|
|
435
|
+
await Modal.Render({
|
|
436
|
+
id: 'modal-500',
|
|
437
|
+
route: '500',
|
|
438
|
+
barConfig,
|
|
439
|
+
title: renderViewTitle({
|
|
440
|
+
icon: html`<i class="fa-solid fa-circle-exclamation"></i>`,
|
|
441
|
+
text: Translate.Render('500'),
|
|
442
|
+
}),
|
|
443
|
+
html: async () => await Page500.Render({ idModal: 'modal-500' }),
|
|
444
|
+
handleType: 'bar',
|
|
445
|
+
maximize: true,
|
|
446
|
+
mode: 'view',
|
|
447
|
+
slideMenu: 'modal-menu',
|
|
448
|
+
RouterInstance,
|
|
449
|
+
heightTopBar,
|
|
450
|
+
heightBottomBar,
|
|
451
|
+
observer: true,
|
|
452
|
+
});
|
|
453
|
+
});
|
|
386
454
|
},
|
|
387
455
|
};
|
|
388
456
|
|
|
@@ -36,6 +36,8 @@ const RoutesDefault = () => {
|
|
|
36
36
|
render: () => s(`.main-btn-default-management`).click(),
|
|
37
37
|
translateTitle: true,
|
|
38
38
|
},
|
|
39
|
+
'/404': { title: '404 Not Found', render: () => s(`.main-btn-404`).click() },
|
|
40
|
+
'/500': { title: '500 Server Error', render: () => s(`.main-btn-500`).click() },
|
|
39
41
|
};
|
|
40
42
|
};
|
|
41
43
|
|