underpost 2.7.7 → 2.7.9
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/.github/workflows/ghpkg.yml +115 -0
- package/.github/workflows/publish.yml +20 -3
- package/.github/workflows/pwa-microservices-template.page.yml +54 -0
- package/.github/workflows/pwa-microservices-template.test.yml +30 -0
- package/.vscode/settings.json +6 -0
- package/CHANGELOG.md +64 -16
- package/bin/cron.js +47 -0
- package/bin/db.js +9 -1
- package/bin/deploy.js +207 -11
- package/bin/file.js +17 -1
- package/bin/index.js +1 -1
- package/bin/util.js +22 -0
- package/conf.js +18 -4
- package/docker-compose.yml +1 -1
- package/package.json +3 -3
- package/src/api/core/core.router.js +9 -9
- package/src/api/core/core.service.js +6 -4
- package/src/api/default/default.service.js +4 -4
- package/src/api/file/file.service.js +3 -3
- package/src/api/user/user.service.js +7 -7
- package/src/client/components/core/Css.js +0 -222
- package/src/client/components/core/CssCore.js +30 -3
- package/src/client/components/core/Docs.js +110 -10
- package/src/client/components/core/Modal.js +224 -22
- package/src/client/components/core/Panel.js +1 -1
- package/src/client/components/core/PanelForm.js +2 -1
- package/src/client/components/core/Responsive.js +15 -0
- package/src/client/components/core/RichText.js +4 -2
- package/src/client/components/core/Translate.js +6 -2
- package/src/client/components/core/WebComponent.js +44 -0
- package/src/client/components/core/Worker.js +12 -4
- 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-conf.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/public/default/site.webmanifest +69 -0
- package/src/client/services/default/default.management.js +118 -120
- package/src/client/ssr/Render.js +224 -3
- package/src/client/ssr/common/Alert.js +75 -0
- package/src/client/ssr/common/SsrCore.js +91 -0
- package/src/client/ssr/common/Translate.js +26 -0
- package/src/client/ssr/common/Worker.js +28 -0
- package/src/client/ssr/{body-components → components/body}/CacheControl.js +1 -1
- package/src/client/ssr/{body-components → components/body}/DefaultSplashScreen.js +15 -4
- package/src/client/ssr/components/head/Pwa.js +146 -0
- package/src/client/ssr/pages/404.js +12 -0
- package/src/client/ssr/pages/500.js +12 -0
- package/src/client/ssr/pages/maintenance.js +14 -0
- package/src/client/ssr/pages/offline.js +21 -0
- package/src/client/sw/default.sw.js +13 -9
- package/src/db/DataBaseProvider.js +12 -1
- package/src/db/mongo/MongooseDB.js +0 -1
- package/src/mailer/EmailRender.js +1 -1
- package/src/server/backup.js +82 -70
- package/src/server/client-build-live.js +6 -0
- package/src/server/client-build.js +76 -73
- package/src/server/client-formatted.js +11 -1
- package/src/server/client-icons.js +1 -1
- package/src/server/conf.js +60 -12
- package/src/server/crypto.js +91 -0
- package/src/server/dns.js +42 -13
- package/src/server/network.js +94 -7
- package/src/server/proxy.js +27 -27
- package/src/server/runtime.js +27 -8
- package/.github/workflows/test.yml +0 -80
- package/src/client/ssr/head-components/Microdata.js +0 -11
- package/src/cron.js +0 -30
- package/src/server/cron.js +0 -35
- /package/src/client/ssr/{email-components → components/email}/DefaultRecoverEmail.js +0 -0
- /package/src/client/ssr/{email-components → components/email}/DefaultVerifyEmail.js +0 -0
- /package/src/client/ssr/{head-components → components/head}/Css.js +0 -0
- /package/src/client/ssr/{head-components → components/head}/DefaultScripts.js +0 -0
- /package/src/client/ssr/{head-components → components/head}/Production.js +0 -0
- /package/src/client/ssr/{head-components → components/head}/PwaDefault.js +0 -0
- /package/src/client/ssr/{head-components → components/head}/Seo.js +0 -0
package/src/client/ssr/Render.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Render = ({ title, ssrPath, buildId, ssrHeadComponents, ssrBodyComponents }) => html`
|
|
1
|
+
Render = ({ title, ssrPath, buildId, ssrHeadComponents, ssrBodyComponents, baseSsrLib }) => html`
|
|
2
2
|
<!DOCTYPE html>
|
|
3
3
|
<html dir="ltr" lang="en">
|
|
4
4
|
<head>
|
|
@@ -9,8 +9,229 @@ Render = ({ title, ssrPath, buildId, ssrHeadComponents, ssrBodyComponents }) =>
|
|
|
9
9
|
${ssrHeadComponents}
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
<style>
|
|
13
|
+
html {
|
|
14
|
+
scroll-behavior: smooth;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
body {
|
|
18
|
+
/* overscroll-behavior: contain; */
|
|
19
|
+
/* box-sizing: border-box; */
|
|
20
|
+
padding: 0px;
|
|
21
|
+
margin: 0px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.fl {
|
|
25
|
+
position: relative;
|
|
26
|
+
display: flow-root;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.abs,
|
|
30
|
+
.in {
|
|
31
|
+
display: block;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.fll {
|
|
35
|
+
float: left;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.flr {
|
|
39
|
+
float: right;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.abs {
|
|
43
|
+
position: absolute;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.in,
|
|
47
|
+
.inl {
|
|
48
|
+
position: relative;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.inl {
|
|
52
|
+
display: inline-table;
|
|
53
|
+
display: -webkit-inline-table;
|
|
54
|
+
display: -moz-inline-table;
|
|
55
|
+
display: -ms-inline-table;
|
|
56
|
+
display: -o-inline-table;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.fix {
|
|
60
|
+
position: fixed;
|
|
61
|
+
display: block;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.stq {
|
|
65
|
+
position: sticky;
|
|
66
|
+
/* require defined at least top, bottom, left o right */
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.wfa {
|
|
70
|
+
width: available;
|
|
71
|
+
width: -webkit-available;
|
|
72
|
+
width: -moz-available;
|
|
73
|
+
width: -ms-available;
|
|
74
|
+
width: -o-available;
|
|
75
|
+
|
|
76
|
+
width: fill-available;
|
|
77
|
+
width: -webkit-fill-available;
|
|
78
|
+
width: -moz-fill-available;
|
|
79
|
+
width: -ms-fill-available;
|
|
80
|
+
width: -o-fill-available;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.wft {
|
|
84
|
+
width: fit-content;
|
|
85
|
+
width: -webkit-fit-content;
|
|
86
|
+
width: -moz-fit-content;
|
|
87
|
+
width: -ms-fit-content;
|
|
88
|
+
width: -o-fit-content;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.wfm {
|
|
92
|
+
width: max-content;
|
|
93
|
+
width: -webkit-max-content;
|
|
94
|
+
width: -moz-max-content;
|
|
95
|
+
width: -ms-max-content;
|
|
96
|
+
width: -o-max-content;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.negative-color {
|
|
100
|
+
filter: invert(1);
|
|
101
|
+
-webkit-filter: invert(1);
|
|
102
|
+
-moz-filter: invert(1);
|
|
103
|
+
-ms-filter: invert(1);
|
|
104
|
+
-o-filter: invert(1);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.no-drag {
|
|
108
|
+
user-drag: none;
|
|
109
|
+
-webkit-user-drag: none;
|
|
110
|
+
-moz-user-drag: none;
|
|
111
|
+
-ms-user-drag: none;
|
|
112
|
+
-o-user-drag: none;
|
|
113
|
+
user-select: none;
|
|
114
|
+
-webkit-user-select: none;
|
|
115
|
+
-moz-user-select: none;
|
|
116
|
+
-ms-user-select: none;
|
|
117
|
+
-o-user-select: none;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.center {
|
|
121
|
+
transform: translate(-50%, -50%);
|
|
122
|
+
top: 50%;
|
|
123
|
+
left: 50%;
|
|
124
|
+
width: 100%;
|
|
125
|
+
text-align: center;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
input {
|
|
129
|
+
outline: none !important;
|
|
130
|
+
border: none;
|
|
131
|
+
padding-block: 0;
|
|
132
|
+
padding-inline: 0;
|
|
133
|
+
}
|
|
134
|
+
input::file-selector-button {
|
|
135
|
+
outline: none !important;
|
|
136
|
+
border: none;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.hide {
|
|
140
|
+
display: none !important;
|
|
141
|
+
}
|
|
142
|
+
/*
|
|
143
|
+
|
|
144
|
+
placeholder
|
|
145
|
+
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
::placeholder {
|
|
149
|
+
color: black;
|
|
150
|
+
opacity: 1;
|
|
151
|
+
/* Firefox */
|
|
152
|
+
background: none;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
:-ms-input-placeholder {
|
|
156
|
+
/* Internet Explorer 10-11 */
|
|
157
|
+
color: black;
|
|
158
|
+
background: none;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
::-ms-input-placeholder {
|
|
162
|
+
/* Microsoft Edge */
|
|
163
|
+
color: black;
|
|
164
|
+
background: none;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/*
|
|
168
|
+
|
|
169
|
+
selection
|
|
170
|
+
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
::-moz-selection {
|
|
174
|
+
/* Code for Firefox */
|
|
175
|
+
color: black;
|
|
176
|
+
background: rgb(208, 208, 208);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
::selection {
|
|
180
|
+
color: black;
|
|
181
|
+
background: rgb(208, 208, 208);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.lowercase {
|
|
185
|
+
text-transform: lowercase;
|
|
186
|
+
}
|
|
187
|
+
.uppercase {
|
|
188
|
+
text-transform: uppercase;
|
|
189
|
+
}
|
|
190
|
+
.capitalize {
|
|
191
|
+
text-transform: capitalize;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.bold {
|
|
195
|
+
font-weight: bold;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.m {
|
|
199
|
+
font-family: monospace;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.gray {
|
|
203
|
+
filter: grayscale(1);
|
|
204
|
+
}
|
|
205
|
+
</style>
|
|
206
|
+
<div class="session">
|
|
207
|
+
<style>
|
|
208
|
+
.session-in-log-out {
|
|
209
|
+
display: block;
|
|
210
|
+
}
|
|
211
|
+
.session-inl-log-out {
|
|
212
|
+
display: inline-table;
|
|
213
|
+
}
|
|
214
|
+
.session-fl-log-out {
|
|
215
|
+
display: flow-root;
|
|
216
|
+
}
|
|
217
|
+
.session-in-log-in {
|
|
218
|
+
display: none;
|
|
219
|
+
}
|
|
220
|
+
.session-inl-log-in {
|
|
221
|
+
display: none;
|
|
222
|
+
}
|
|
223
|
+
.session-fl-log-in {
|
|
224
|
+
display: none;
|
|
225
|
+
}
|
|
226
|
+
</style>
|
|
227
|
+
</div>
|
|
228
|
+
<div class="theme"></div>
|
|
229
|
+
${baseSsrLib
|
|
230
|
+
? html`<script>
|
|
231
|
+
${baseSsrLib};
|
|
232
|
+
</script>`
|
|
233
|
+
: ''}
|
|
234
|
+
${ssrBodyComponents} ${buildId ? html`<script async type="module" src="./${buildId}.js"></script>` : ''}
|
|
14
235
|
</body>
|
|
15
236
|
</html>
|
|
16
237
|
`;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const maintenance = async ({ Translate }) => {
|
|
2
|
+
const icon = html`<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 24 24">
|
|
3
|
+
<path
|
|
4
|
+
fill="none"
|
|
5
|
+
stroke="currentColor"
|
|
6
|
+
stroke-linecap="round"
|
|
7
|
+
stroke-linejoin="round"
|
|
8
|
+
stroke-width="2"
|
|
9
|
+
d="M3 7a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3zm9 13H6a3 3 0 0 1-3-3v-2a3 3 0 0 1 3-3h10.5m-.5 6a2 2 0 1 0 4 0a2 2 0 1 0-4 0m2-3.5V16m0 4v1.5m3.032-5.25l-1.299.75m-3.463 2l-1.3.75m0-3.5l1.3.75m3.463 2l1.3.75M7 8v.01M7 16v.01"
|
|
10
|
+
/>
|
|
11
|
+
</svg>`;
|
|
12
|
+
return html` <div class="abs center" style="top: 45%">
|
|
13
|
+
${icon}
|
|
14
|
+
<br />
|
|
15
|
+
<br />${Translate('server-maintenance')}
|
|
16
|
+
</div>`;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const noInternet = async ({ Translate }) => {
|
|
20
|
+
const icon = html`<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 20 20">
|
|
21
|
+
<path
|
|
22
|
+
fill="currentColor"
|
|
23
|
+
d="M10 18q.128 0 .254-.004a5.5 5.5 0 0 1-.698-1.083c-.536-.207-1.098-.793-1.578-1.821A9.3 9.3 0 0 1 7.42 13.5h1.672q.096-.52.284-1h-2.17A15 15 0 0 1 7 10c0-.883.073-1.725.206-2.5h5.588c.092.541.156 1.115.186 1.713q.48-.138.992-.188a16 16 0 0 0-.165-1.525h2.733c.251.656.406 1.36.448 2.094q.543.276 1.008.66A8 8 0 1 0 10 18m0-15c.657 0 1.407.59 2.022 1.908c.217.466.406 1.002.559 1.592H7.419c.153-.59.342-1.126.56-1.592C8.592 3.59 9.342 3 10 3M7.072 4.485A10.5 10.5 0 0 0 6.389 6.5H3.936a7.02 7.02 0 0 1 3.778-3.118c-.241.33-.456.704-.642 1.103M6.192 7.5A16 16 0 0 0 6 10c0 .87.067 1.712.193 2.5H3.46A7 7 0 0 1 3 10c0-.88.163-1.724.46-2.5zm.197 6c.176.743.407 1.422.683 2.015c.186.399.401.773.642 1.103A7.02 7.02 0 0 1 3.936 13.5zm5.897-10.118A7.02 7.02 0 0 1 16.064 6.5H13.61a10.5 10.5 0 0 0-.683-2.015a6.6 6.6 0 0 0-.642-1.103M19 14.5a4.5 4.5 0 1 1-9 0a4.5 4.5 0 0 1 9 0M14.5 12a.5.5 0 0 0-.5.5v2a.5.5 0 0 0 1 0v-2a.5.5 0 0 0-.5-.5m0 5.125a.625.625 0 1 0 0-1.25a.625.625 0 0 0 0 1.25"
|
|
24
|
+
/>
|
|
25
|
+
</svg>`;
|
|
26
|
+
return html` <div class="abs center" style="top: 45%">
|
|
27
|
+
${icon}
|
|
28
|
+
<br />
|
|
29
|
+
<br />${Translate('no-internet-connection')}
|
|
30
|
+
</div>`;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const e404 = async ({ Translate }) => {
|
|
34
|
+
const icon = html`
|
|
35
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 24 24">
|
|
36
|
+
<path
|
|
37
|
+
fill="currentColor"
|
|
38
|
+
d="M15.097 5.904A6.5 6.5 0 0 0 4 10.504l.001 1h-2v-1a8.5 8.5 0 1 1 15.176 5.258l5.344 5.345l-1.414 1.414l-5.344-5.345A8.48 8.48 0 0 1 10.5 19h-1v-2h1a6.5 6.5 0 0 0 4.596-11.096M1.672 13.257L4.5 16.086l2.829-2.829l1.414 1.415L5.915 17.5l2.828 2.828l-1.414 1.415L4.5 18.914l-2.828 2.829l-1.414-1.415L3.086 17.5L.258 14.672z"
|
|
39
|
+
/>
|
|
40
|
+
</svg>
|
|
41
|
+
`;
|
|
42
|
+
return html` <div class="abs center" style="top: 45%">
|
|
43
|
+
${icon}
|
|
44
|
+
<br />
|
|
45
|
+
<br />
|
|
46
|
+
<span class="bold">404</span>
|
|
47
|
+
<br />
|
|
48
|
+
<br />${Translate('page-not-found')} <br />
|
|
49
|
+
<br />
|
|
50
|
+
<a href="${location.origin}">${Translate('back')}</a>
|
|
51
|
+
</div>`;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const e500 = async ({ Translate }) => {
|
|
55
|
+
const icon = html`<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 20 20">
|
|
56
|
+
<path
|
|
57
|
+
fill="currentColor"
|
|
58
|
+
d="M6 2a2 2 0 0 0-2 2v5.207a5.5 5.5 0 0 1 1-.185V4a1 1 0 0 1 1-1h4v3.5A1.5 1.5 0 0 0 11.5 8H15v8a1 1 0 0 1-1 1h-3.6a5.5 5.5 0 0 1-.657 1H14a2 2 0 0 0 2-2V7.414a1.5 1.5 0 0 0-.44-1.06l-3.914-3.915A1.5 1.5 0 0 0 10.586 2zm8.793 5H11.5a.5.5 0 0 1-.5-.5V3.207zM10 14.5a4.5 4.5 0 1 1-9 0a4.5 4.5 0 0 1 9 0M5.5 12a.5.5 0 0 0-.5.5v2a.5.5 0 0 0 1 0v-2a.5.5 0 0 0-.5-.5m0 5.125a.625.625 0 1 0 0-1.25a.625.625 0 0 0 0 1.25"
|
|
59
|
+
/>
|
|
60
|
+
</svg>`;
|
|
61
|
+
return html` <div class="abs center" style="top: 45%">
|
|
62
|
+
${icon}
|
|
63
|
+
<br />
|
|
64
|
+
<br />
|
|
65
|
+
<span class="bold">500</span>
|
|
66
|
+
<br />
|
|
67
|
+
<br />${Translate('page-broken')} <br />
|
|
68
|
+
<br />
|
|
69
|
+
<a href="${location.origin}">${Translate('back')}</a>
|
|
70
|
+
</div>`;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const Alert = { maintenance, noInternet, e404, e500 };
|
|
74
|
+
|
|
75
|
+
export { Alert, e404 };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const s = (el) => document.querySelector(el);
|
|
2
|
+
|
|
3
|
+
const append = (el, html) => s(el).insertAdjacentHTML('beforeend', html);
|
|
4
|
+
|
|
5
|
+
const htmls = (el, html) => (s(el).innerHTML = html);
|
|
6
|
+
|
|
7
|
+
const s4 = () => (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
8
|
+
|
|
9
|
+
const range = (start, end) => {
|
|
10
|
+
return end < start
|
|
11
|
+
? range(end, start).reverse()
|
|
12
|
+
: Array.apply(0, Array(end - start + 1)).map((element, index) => index + start);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const timer = (ms) => new Promise((res) => setTimeout(res, ms));
|
|
16
|
+
|
|
17
|
+
const newInstance = (obj) => {
|
|
18
|
+
// structuredClone() 2022 ES6 feature
|
|
19
|
+
try {
|
|
20
|
+
return JSON.parse(JSON.stringify(obj));
|
|
21
|
+
} catch (error) {
|
|
22
|
+
return { error: error.message };
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const fullScreenIn = () => {
|
|
27
|
+
const elem = document.documentElement;
|
|
28
|
+
if (elem.requestFullscreen) {
|
|
29
|
+
elem.requestFullscreen();
|
|
30
|
+
} else if (elem.mozRequestFullScreen) {
|
|
31
|
+
/* Firefox */
|
|
32
|
+
elem.mozRequestFullScreen();
|
|
33
|
+
} else if (elem.webkitRequestFullscreen) {
|
|
34
|
+
/* Chrome, Safari & Opera */
|
|
35
|
+
elem.webkitRequestFullscreen();
|
|
36
|
+
} else if (elem.msRequestFullscreen) {
|
|
37
|
+
/* IE/Edge */
|
|
38
|
+
elem = window.top.document.body; //To break out of frame in IE
|
|
39
|
+
elem.msRequestFullscreen();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const borderChar = (px, color, selectors) => {
|
|
44
|
+
if (selectors) {
|
|
45
|
+
return selectors
|
|
46
|
+
.map(
|
|
47
|
+
(selector) => html`
|
|
48
|
+
<style>
|
|
49
|
+
${selector} {
|
|
50
|
+
text-shadow: ${px}px -${px}px ${px}px ${color}, -${px}px ${px}px ${px}px ${color},
|
|
51
|
+
-${px}px -${px}px ${px}px ${color}, ${px}px ${px}px ${px}px ${color};
|
|
52
|
+
}
|
|
53
|
+
</style>
|
|
54
|
+
`,
|
|
55
|
+
)
|
|
56
|
+
.join('');
|
|
57
|
+
}
|
|
58
|
+
return html`
|
|
59
|
+
text-shadow: ${px}px -${px}px ${px}px ${color}, -${px}px ${px}px ${px}px ${color}, -${px}px -${px}px ${px}px
|
|
60
|
+
${color}, ${px}px ${px}px ${px}px ${color};
|
|
61
|
+
`;
|
|
62
|
+
};
|
|
63
|
+
const getLang = () =>
|
|
64
|
+
localStorage.getItem('lang') ? localStorage.getItem('lang') : navigator.language || navigator.userLanguage;
|
|
65
|
+
|
|
66
|
+
const loggerFactory = (meta) => {
|
|
67
|
+
meta = meta.url.split('/').pop();
|
|
68
|
+
const types = ['error', 'warn', 'info', 'debug'];
|
|
69
|
+
const logger = {
|
|
70
|
+
log: function (type, args) {
|
|
71
|
+
if (location.hostname !== 'localhost' && console.log() !== null) {
|
|
72
|
+
console.log = () => null;
|
|
73
|
+
console.error = () => null;
|
|
74
|
+
console.info = () => null;
|
|
75
|
+
console.warn = () => null;
|
|
76
|
+
}
|
|
77
|
+
return location.hostname === 'localhost'
|
|
78
|
+
? console[type](`[${meta}] ${new Date().toISOString()} ${type}:`, ...args)
|
|
79
|
+
: null;
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
types.map(
|
|
83
|
+
(type) =>
|
|
84
|
+
(logger[type] = function (...args) {
|
|
85
|
+
return this.log(type, args);
|
|
86
|
+
}),
|
|
87
|
+
);
|
|
88
|
+
return logger;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export { getLang, s, append, s4, range, timer, htmls, newInstance, fullScreenIn, borderChar, loggerFactory };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const TranslateCore = {
|
|
2
|
+
['server-maintenance']: {
|
|
3
|
+
en: "The server is under maintenance <br> we'll be back soon.",
|
|
4
|
+
es: 'El servidor está en mantenimiento <br> volveremos pronto.',
|
|
5
|
+
},
|
|
6
|
+
['no-internet-connection']: {
|
|
7
|
+
en: 'No internet connection <br> verify your network',
|
|
8
|
+
es: 'Sin conexión a internet <br> verifica tu red',
|
|
9
|
+
},
|
|
10
|
+
['page-not-found']: {
|
|
11
|
+
en: 'Page not found',
|
|
12
|
+
es: 'Página no encontrada',
|
|
13
|
+
},
|
|
14
|
+
['page-broken']: {
|
|
15
|
+
es: 'Algo salio mal',
|
|
16
|
+
en: 'Something went wrong',
|
|
17
|
+
},
|
|
18
|
+
['back']: {
|
|
19
|
+
en: 'Back to <br> homepage',
|
|
20
|
+
es: 'Volver a <br> la pagina principal',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const Translate = (key) => TranslateCore[key][getLang().match('es') ? 'es' : 'en'];
|
|
25
|
+
|
|
26
|
+
export { Translate };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const Worker = {
|
|
2
|
+
instance: async function (options = { render: async () => {} }) {
|
|
3
|
+
window.serviceWorkerReady = true;
|
|
4
|
+
append(
|
|
5
|
+
'body',
|
|
6
|
+
html`
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
background-color: #dcdcdc;
|
|
10
|
+
color: #303030;
|
|
11
|
+
font-family: arial;
|
|
12
|
+
font-size: 16px;
|
|
13
|
+
}
|
|
14
|
+
.page-render {
|
|
15
|
+
min-height: 100vh;
|
|
16
|
+
}
|
|
17
|
+
a {
|
|
18
|
+
color: #000000;
|
|
19
|
+
}
|
|
20
|
+
</style>
|
|
21
|
+
<div class="in page-render"></div>
|
|
22
|
+
`,
|
|
23
|
+
);
|
|
24
|
+
await options.render();
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { Worker };
|
|
@@ -109,6 +109,6 @@ SrrComponent = ({ ttiLoadTimeLimit }) => {
|
|
|
109
109
|
const CacheControl = ${CacheControl};
|
|
110
110
|
CacheControl({ ttiLoadTimeLimit: ${ttiLoadTimeLimit ? ttiLoadTimeLimit : 1000 * 70 * 1} });
|
|
111
111
|
</script>
|
|
112
|
-
<div class="clean-cache-container">v2.7.
|
|
112
|
+
<div class="clean-cache-container">v2.7.9</div>
|
|
113
113
|
`;
|
|
114
114
|
};
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
SrrComponent = ({ base64BackgroundImage }) => html`
|
|
1
|
+
SrrComponent = ({ base64BackgroundImage, metadata }) => html`
|
|
2
|
+
${base64BackgroundImage
|
|
3
|
+
? html`<style>
|
|
4
|
+
.ssr-background-image {
|
|
5
|
+
background-image: url('${base64BackgroundImage}');
|
|
6
|
+
}
|
|
7
|
+
</style>`
|
|
8
|
+
: metadata?.themeColor
|
|
9
|
+
? html`<style>
|
|
10
|
+
.ssr-background-image {
|
|
11
|
+
background: ${metadata.themeColor};
|
|
12
|
+
}
|
|
13
|
+
</style>`
|
|
14
|
+
: ''}
|
|
15
|
+
|
|
2
16
|
<style>
|
|
3
|
-
.ssr-background-image {
|
|
4
|
-
background-image: url('${base64BackgroundImage}');
|
|
5
|
-
}
|
|
6
17
|
.ssr-top-bar {
|
|
7
18
|
background: #ffffff;
|
|
8
19
|
height: 100px;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
SrrComponent = ({
|
|
2
|
+
title,
|
|
3
|
+
author,
|
|
4
|
+
keywords,
|
|
5
|
+
description,
|
|
6
|
+
themeColor,
|
|
7
|
+
canonicalURL,
|
|
8
|
+
ssrPath,
|
|
9
|
+
thumbnail,
|
|
10
|
+
pwaAssetsPath,
|
|
11
|
+
}) => html`
|
|
12
|
+
<link rel="manifest" href="${ssrPath}site.webmanifest" />
|
|
13
|
+
<link
|
|
14
|
+
rel="icon"
|
|
15
|
+
type="image/png"
|
|
16
|
+
sizes="16x16"
|
|
17
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}favicon-16x16.png"
|
|
18
|
+
/>
|
|
19
|
+
<link
|
|
20
|
+
rel="icon"
|
|
21
|
+
type="image/png"
|
|
22
|
+
sizes="32x32"
|
|
23
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}favicon-32x32.png"
|
|
24
|
+
/>
|
|
25
|
+
<!-- <link rel="icon" type="image/png" sizes="194x194" href="${ssrPath}${pwaAssetsPath !== undefined
|
|
26
|
+
? pwaAssetsPath
|
|
27
|
+
: 'assets/splash/'}favicon-194x194.png" /> -->
|
|
28
|
+
<!-- chrome -->
|
|
29
|
+
<link
|
|
30
|
+
rel="icon"
|
|
31
|
+
type="image/png"
|
|
32
|
+
sizes="36x36"
|
|
33
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-36x36.png"
|
|
34
|
+
/>
|
|
35
|
+
<link
|
|
36
|
+
rel="icon"
|
|
37
|
+
type="image/png"
|
|
38
|
+
sizes="48x48"
|
|
39
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-48x48.png"
|
|
40
|
+
/>
|
|
41
|
+
<link
|
|
42
|
+
rel="icon"
|
|
43
|
+
type="image/png"
|
|
44
|
+
sizes="72x72"
|
|
45
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-72x72.png"
|
|
46
|
+
/>
|
|
47
|
+
<link
|
|
48
|
+
rel="icon"
|
|
49
|
+
type="image/png"
|
|
50
|
+
sizes="96x96"
|
|
51
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-96x96.png"
|
|
52
|
+
/>
|
|
53
|
+
<link
|
|
54
|
+
rel="icon"
|
|
55
|
+
type="image/png"
|
|
56
|
+
sizes="144x144"
|
|
57
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-144x144.png"
|
|
58
|
+
/>
|
|
59
|
+
<link
|
|
60
|
+
rel="icon"
|
|
61
|
+
type="image/png"
|
|
62
|
+
sizes="256x256"
|
|
63
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-256x256.png"
|
|
64
|
+
/>
|
|
65
|
+
<link
|
|
66
|
+
rel="icon"
|
|
67
|
+
type="image/png"
|
|
68
|
+
sizes="384x384"
|
|
69
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-384x384.png"
|
|
70
|
+
/>
|
|
71
|
+
<link
|
|
72
|
+
rel="icon"
|
|
73
|
+
type="image/png"
|
|
74
|
+
sizes="512x512"
|
|
75
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-512x512.png"
|
|
76
|
+
/>
|
|
77
|
+
<!-- apple -->
|
|
78
|
+
<link
|
|
79
|
+
rel="apple-touch-icon"
|
|
80
|
+
sizes="180x180"
|
|
81
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}apple-touch-icon.png"
|
|
82
|
+
/>
|
|
83
|
+
<link
|
|
84
|
+
rel="mask-icon"
|
|
85
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}safari-pinned-tab.svg"
|
|
86
|
+
color="${themeColor}"
|
|
87
|
+
/>
|
|
88
|
+
<meta name="apple-mobile-web-app-title" content="${title}" />
|
|
89
|
+
<link
|
|
90
|
+
rel="apple-touch-icon"
|
|
91
|
+
type="image/png"
|
|
92
|
+
sizes="36x36"
|
|
93
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-36x36.png"
|
|
94
|
+
/>
|
|
95
|
+
<link
|
|
96
|
+
rel="apple-touch-icon"
|
|
97
|
+
type="image/png"
|
|
98
|
+
sizes="48x48"
|
|
99
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-48x48.png"
|
|
100
|
+
/>
|
|
101
|
+
<link
|
|
102
|
+
rel="apple-touch-icon"
|
|
103
|
+
type="image/png"
|
|
104
|
+
sizes="72x72"
|
|
105
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-72x72.png"
|
|
106
|
+
/>
|
|
107
|
+
<link
|
|
108
|
+
rel="apple-touch-icon"
|
|
109
|
+
type="image/png"
|
|
110
|
+
sizes="96x96"
|
|
111
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-96x96.png"
|
|
112
|
+
/>
|
|
113
|
+
<link
|
|
114
|
+
rel="apple-touch-icon"
|
|
115
|
+
type="image/png"
|
|
116
|
+
sizes="144x144"
|
|
117
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-144x144.png"
|
|
118
|
+
/>
|
|
119
|
+
<link
|
|
120
|
+
rel="apple-touch-icon"
|
|
121
|
+
type="image/png"
|
|
122
|
+
sizes="256x256"
|
|
123
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-256x256.png"
|
|
124
|
+
/>
|
|
125
|
+
<link
|
|
126
|
+
rel="apple-touch-icon"
|
|
127
|
+
type="image/png"
|
|
128
|
+
sizes="384x384"
|
|
129
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-384x384.png"
|
|
130
|
+
/>
|
|
131
|
+
<link
|
|
132
|
+
rel="apple-touch-icon"
|
|
133
|
+
type="image/png"
|
|
134
|
+
sizes="512x512"
|
|
135
|
+
href="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}android-chrome-512x512.png"
|
|
136
|
+
/>
|
|
137
|
+
<!-- microsoft -->
|
|
138
|
+
<meta name="msapplication-config" content="${ssrPath}browserconfig.xml" />
|
|
139
|
+
<meta name="application-name" content="${title}" />
|
|
140
|
+
<meta name="msapplication-TileColor" content="${themeColor}" />
|
|
141
|
+
<meta
|
|
142
|
+
name="msapplication-TileImage"
|
|
143
|
+
content="${ssrPath}${pwaAssetsPath !== undefined ? pwaAssetsPath : 'assets/splash/'}mstile-144x144.png"
|
|
144
|
+
/>
|
|
145
|
+
<meta name="theme-color" content="${themeColor}" />
|
|
146
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { e404 } from '../common/Alert.js';
|
|
2
|
+
import { append } from '../common/SsrCore.js';
|
|
3
|
+
import { Translate } from '../common/Translate.js';
|
|
4
|
+
import { Worker } from '../common/Worker.js';
|
|
5
|
+
/*imports*/
|
|
6
|
+
|
|
7
|
+
window.onload = () =>
|
|
8
|
+
Worker.instance({
|
|
9
|
+
render: async () => {
|
|
10
|
+
append('.page-render', await e404({ Translate }));
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { e500 } from '../common/Alert.js';
|
|
2
|
+
import { append } from '../common/SsrCore.js';
|
|
3
|
+
import { Translate } from '../common/Translate.js';
|
|
4
|
+
import { Worker } from '../common/Worker.js';
|
|
5
|
+
/*imports*/
|
|
6
|
+
|
|
7
|
+
window.onload = () =>
|
|
8
|
+
Worker.instance({
|
|
9
|
+
render: async () => {
|
|
10
|
+
append('.page-render', await e500({ Translate }));
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { htmls, loggerFactory } from '../common/SsrCore.js';
|
|
2
|
+
import { Alert } from '../common/Alert.js';
|
|
3
|
+
import { Translate } from '../common/Translate.js';
|
|
4
|
+
import { Worker } from '../common/Worker.js';
|
|
5
|
+
/*imports*/
|
|
6
|
+
|
|
7
|
+
const logger = loggerFactory({ url: location.toString() });
|
|
8
|
+
|
|
9
|
+
window.onload = () =>
|
|
10
|
+
Worker.instance({
|
|
11
|
+
render: async () => {
|
|
12
|
+
htmls(`.page-render`, html`${await Alert.maintenance({ Translate })}`);
|
|
13
|
+
},
|
|
14
|
+
});
|