@underpostnet/underpost 2.7.91 → 2.7.93
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 +29 -5
- package/docker-compose.yml +1 -1
- package/package.json +2 -2
- package/src/client/Default.index.js +2 -1
- 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 +8 -6
- package/src/client/components/core/Scroll.js +65 -1
- package/src/client/components/core/Translate.js +21 -5
- package/src/client/components/core/VanillaJs.js +4 -1
- package/src/client/components/core/Worker.js +10 -11
- package/src/client/components/default/MenuDefault.js +69 -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/body/404.js +73 -0
- package/src/client/ssr/body/500.js +72 -0
- 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 +67 -0
- package/src/client/ssr/pages/Test.js +198 -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
|
{
|
|
@@ -175,7 +180,29 @@ const DefaultConf = {
|
|
|
175
180
|
ssr: {
|
|
176
181
|
Default: {
|
|
177
182
|
head: ['Seo', 'Pwa', 'Css', 'DefaultScripts', 'Production'],
|
|
178
|
-
body: ['CacheControl', 'DefaultSplashScreen'],
|
|
183
|
+
body: ['CacheControl', 'DefaultSplashScreen', '404', '500'],
|
|
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.93",
|
|
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,
|
|
@@ -9,13 +9,13 @@ import { SignUpDefault } from './components/default/SignUpDefault.js';
|
|
|
9
9
|
import { MenuDefault } from './components/default/MenuDefault.js';
|
|
10
10
|
import { RouterDefault } from './components/default/RoutesDefault.js';
|
|
11
11
|
import { TranslateDefault } from './components/default/TranslateDefault.js';
|
|
12
|
-
import { getProxyPath } from './components/core/VanillaJs.js';
|
|
13
12
|
import { Worker } from './components/core/Worker.js';
|
|
14
13
|
import { Keyboard } from './components/core/Keyboard.js';
|
|
15
14
|
import { DefaultParams } from './components/default/CommonDefault.js';
|
|
16
15
|
import { SocketIo } from './components/core/SocketIo.js';
|
|
17
16
|
import { SocketIoDefault } from './components/default/SocketIoDefault.js';
|
|
18
17
|
import { ElementsDefault } from './components/default/ElementsDefault.js';
|
|
18
|
+
import { Scroll } from './components/core/Scroll.js';
|
|
19
19
|
|
|
20
20
|
const htmlMainBody = async () => {
|
|
21
21
|
return html`<span style="color: black; padding: 5px">Hello World!!</span>`;
|
|
@@ -35,6 +35,7 @@ window.onload = () =>
|
|
|
35
35
|
await LogInDefault();
|
|
36
36
|
await LogOutDefault();
|
|
37
37
|
await SignUpDefault();
|
|
38
|
+
await Scroll.pullTopRefresh();
|
|
38
39
|
await Keyboard.Init({ callBackTime: DefaultParams.EVENT_CALLBACK_TIME });
|
|
39
40
|
},
|
|
40
41
|
});
|
|
@@ -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;
|
|
@@ -1339,6 +1340,9 @@ const Modal = {
|
|
|
1339
1340
|
backMenuButtonEvent();
|
|
1340
1341
|
}
|
|
1341
1342
|
s(`.btn-close-modal-menu`).click();
|
|
1343
|
+
if (window.location.pathname !== (getProxyPath() === '/' ? getProxyPath() : `${getProxyPath()}/`))
|
|
1344
|
+
setPath(getProxyPath());
|
|
1345
|
+
setDocTitle({ ...options.RouterInstance, route: '' });
|
|
1342
1346
|
};
|
|
1343
1347
|
EventsUI.onClick(`.btn-icon-menu-back`, backMenuButtonEvent);
|
|
1344
1348
|
EventsUI.onClick(`.btn-icon-menu-mode`, () => {
|
|
@@ -1531,20 +1535,18 @@ const Modal = {
|
|
|
1531
1535
|
Responsive.Event['h-ui-hide-' + idModal] = () => {
|
|
1532
1536
|
setTimeout(() => {
|
|
1533
1537
|
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'
|
|
1538
|
+
if (s(`.btn-restore-${idModal}`).style.display !== 'none') {
|
|
1539
|
+
s(`.${idModal}`).style.height = s(`.main-body-btn-ui-close`).classList.contains('hide')
|
|
1537
1540
|
? `${window.innerHeight}px`
|
|
1538
1541
|
: `${
|
|
1539
1542
|
window.innerHeight -
|
|
1540
1543
|
(options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) -
|
|
1541
1544
|
(options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
|
|
1542
1545
|
}px`;
|
|
1543
|
-
|
|
1544
|
-
s(`.main-body-btn-ui-close`).classList.contains('hide') &&
|
|
1545
|
-
s(`.btn-restore-${idModal}`).style.display !== 'none'
|
|
1546
|
+
s(`.${idModal}`).style.top = s(`.main-body-btn-ui-close`).classList.contains('hide')
|
|
1546
1547
|
? `0px`
|
|
1547
1548
|
: `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`;
|
|
1549
|
+
}
|
|
1548
1550
|
});
|
|
1549
1551
|
};
|
|
1550
1552
|
Responsive.Event['h-ui-hide-' + idModal]();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { borderChar } from './Css.js';
|
|
2
|
+
import { append, s } from './VanillaJs.js';
|
|
2
3
|
|
|
3
4
|
const Scroll = {
|
|
4
5
|
data: {},
|
|
@@ -29,6 +30,69 @@ const Scroll = {
|
|
|
29
30
|
behavior: options.behavior || 'smooth',
|
|
30
31
|
});
|
|
31
32
|
},
|
|
33
|
+
pullTopRefresh: function () {
|
|
34
|
+
append(
|
|
35
|
+
'body',
|
|
36
|
+
html` <style>
|
|
37
|
+
.pull-refresh-icon-container {
|
|
38
|
+
height: 60px;
|
|
39
|
+
width: 100%;
|
|
40
|
+
z-index: 10;
|
|
41
|
+
transition: 0.3s;
|
|
42
|
+
left: 0px;
|
|
43
|
+
}
|
|
44
|
+
.pull-refresh-icon {
|
|
45
|
+
width: 60px;
|
|
46
|
+
height: 60px;
|
|
47
|
+
margin: auto;
|
|
48
|
+
color: white;
|
|
49
|
+
font-size: 30px;
|
|
50
|
+
}
|
|
51
|
+
</style>
|
|
52
|
+
${borderChar(2, 'black', [' .pull-refresh-icon-container'])}
|
|
53
|
+
<div style="top: -60px" class="abs pull-refresh-icon-container">
|
|
54
|
+
<div class="in pull-refresh-icon">
|
|
55
|
+
<div class="abs center"><i class="fa-solid fa-arrows-rotate"></i></div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>`,
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
let touchstartY = 0;
|
|
61
|
+
let reload = false;
|
|
62
|
+
const minHeightDragReload = 3;
|
|
63
|
+
const maxHeightDragReload = 20;
|
|
64
|
+
|
|
65
|
+
document.addEventListener('touchstart', (e) => {
|
|
66
|
+
touchstartY = e.touches[0].clientY;
|
|
67
|
+
// console.warn('touchstart', touchstartY);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
document.addEventListener('touchmove', (e) => {
|
|
71
|
+
const touchY = e.touches[0].clientY;
|
|
72
|
+
const touchDiff = touchY - touchstartY;
|
|
73
|
+
|
|
74
|
+
// console.warn('touchDiff', touchDiff, maxHeightDragReload);
|
|
75
|
+
|
|
76
|
+
if (touchDiff > maxHeightDragReload)
|
|
77
|
+
s(`.pull-refresh-icon-container`).style.top = 60 + maxHeightDragReload + 'px';
|
|
78
|
+
else s(`.pull-refresh-icon-container`).style.top = 60 + touchDiff + 'px';
|
|
79
|
+
|
|
80
|
+
if (touchDiff > minHeightDragReload && window.scrollY === 0) {
|
|
81
|
+
reload = true;
|
|
82
|
+
} else {
|
|
83
|
+
reload = false;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
document.addEventListener('touchend', (e) => {
|
|
87
|
+
// console.warn('touchend');
|
|
88
|
+
s(`.pull-refresh-icon-container`).style.top = '-60px';
|
|
89
|
+
if (reload) {
|
|
90
|
+
location.reload();
|
|
91
|
+
// console.warn('reload');
|
|
92
|
+
}
|
|
93
|
+
reload = false;
|
|
94
|
+
});
|
|
95
|
+
},
|
|
32
96
|
};
|
|
33
97
|
|
|
34
98
|
export { Scroll };
|
|
@@ -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,10 @@ 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)
|
|
433
|
+
.slice(0, 2)
|
|
434
|
+
.toLowerCase();
|
|
432
435
|
|
|
433
436
|
export {
|
|
434
437
|
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(() => {
|