underpost 2.7.6 → 2.7.7
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/publish.yml +14 -0
- package/CHANGELOG.md +16 -32
- package/bin/deploy.js +2 -6
- package/bin/index.js +1 -1
- package/docker-compose.yml +1 -1
- package/package.json +1 -1
- package/src/client/components/core/Css.js +5 -1
- package/src/client/components/core/Docs.js +1 -1
- package/src/client/components/core/LoadingAnimation.js +6 -7
- package/src/client/components/core/Translate.js +5 -0
- package/src/client/components/core/VanillaJs.js +3 -0
- package/src/client/ssr/body-components/CacheControl.js +1 -1
- package/src/cron.js +7 -2
- package/src/db/mongo/MongooseDB.js +0 -12
- package/src/server/backup.js +29 -22
- package/src/server/client-build-live.js +22 -2
- package/src/server/client-build.js +52 -0
- package/src/server/conf.js +2 -10
- package/src/server/cron.js +35 -0
- package/src/server/dns.js +3 -12
|
@@ -34,6 +34,20 @@ jobs:
|
|
|
34
34
|
name: Publish to npm
|
|
35
35
|
run: npm publish --provenance --access public
|
|
36
36
|
|
|
37
|
+
# Publish to npm
|
|
38
|
+
- uses: actions/setup-node@v4
|
|
39
|
+
with:
|
|
40
|
+
node-version: '22.x'
|
|
41
|
+
registry-url: 'https://registry.npmjs.org'
|
|
42
|
+
# Defaults to the user or organization that owns the workflow file
|
|
43
|
+
scope: '@underpostnet'
|
|
44
|
+
- env:
|
|
45
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
46
|
+
name: Publish to npm
|
|
47
|
+
run: |
|
|
48
|
+
node ./bin/deploy rename-package @underpostnet/underpost
|
|
49
|
+
npm publish --provenance --access public
|
|
50
|
+
|
|
37
51
|
# Publish to GitHub Packages
|
|
38
52
|
- name: Setup node to publish to GitHub Packages
|
|
39
53
|
uses: actions/setup-node@v4
|
package/CHANGELOG.md
CHANGED
|
@@ -4,50 +4,34 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
-
#### [v2.7.2](https://github.com/underpostnet/
|
|
7
|
+
#### [v2.7.2](https://github.com/underpostnet/pwa-microservices-template/compare/v2.7.1...v2.7.2)
|
|
8
8
|
|
|
9
9
|
> 8 October 2024
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
11
|
+
- update src v2.7.2 [`12f3b14`](https://github.com/underpostnet/pwa-microservices-template/commit/12f3b14af0170f3a9e1ae1d341a586a2852f6056)
|
|
12
|
+
- add npm publish workflow [`843623a`](https://github.com/underpostnet/pwa-microservices-template/commit/843623a582bb00bf16ef167b420f325540fc5327)
|
|
13
|
+
- publish yml update [`dc5593b`](https://github.com/underpostnet/pwa-microservices-template/commit/dc5593bb4f480d24b81cf24045c24626542bfee9)
|
|
14
14
|
|
|
15
|
-
#### [v2.7.1](https://github.com/underpostnet/
|
|
15
|
+
#### [v2.7.1](https://github.com/underpostnet/pwa-microservices-template/compare/v2.6.3...v2.7.1)
|
|
16
16
|
|
|
17
17
|
> 19 September 2024
|
|
18
18
|
|
|
19
|
-
-
|
|
20
|
-
- update [`
|
|
21
|
-
-
|
|
19
|
+
- add backup, dns and prompt-optimizer base [`507669e`](https://github.com/underpostnet/pwa-microservices-template/commit/507669e2f1c9b4145643cbac583762eb91b1d18d)
|
|
20
|
+
- update version 2.6.8 [`3d765bf`](https://github.com/underpostnet/pwa-microservices-template/commit/3d765bfa6f06866ce46260d2e4af4432c91f072f)
|
|
21
|
+
- update version batch 2.6.4 [`fd4fed5`](https://github.com/underpostnet/pwa-microservices-template/commit/fd4fed55f2bbac1a9d4760e804ed6b7f4cde1272)
|
|
22
22
|
|
|
23
|
-
#### [v2.6.3](https://github.com/underpostnet/
|
|
23
|
+
#### [v2.6.3](https://github.com/underpostnet/pwa-microservices-template/compare/v2.6.2...v2.6.3)
|
|
24
24
|
|
|
25
25
|
> 14 September 2024
|
|
26
26
|
|
|
27
|
-
- update version 2.6.3 [`
|
|
28
|
-
- update
|
|
29
|
-
- update [`
|
|
27
|
+
- update version 2.6.3 [`c8f6f8e`](https://github.com/underpostnet/pwa-microservices-template/commit/c8f6f8ec31470eff977163c5b31be37a05ff96ba)
|
|
28
|
+
- update [`7214fbb`](https://github.com/underpostnet/pwa-microservices-template/commit/7214fbb608f7f59c6bf8e189093fd9c7e9a5a80a)
|
|
29
|
+
- update [`b99c869`](https://github.com/underpostnet/pwa-microservices-template/commit/b99c8697e96a5141b15f0d28386ba29871746825)
|
|
30
30
|
|
|
31
|
-
####
|
|
31
|
+
#### v2.6.2
|
|
32
32
|
|
|
33
33
|
> 13 September 2024
|
|
34
34
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
- update [`
|
|
38
|
-
|
|
39
|
-
#### [v2.5.1](https://github.com/underpostnet/engine/compare/v2.0.0...v2.5.1)
|
|
40
|
-
|
|
41
|
-
> 27 August 2024
|
|
42
|
-
|
|
43
|
-
- css refactor [`49b1904`](https://github.com/underpostnet/engine/commit/49b1904e83162f9066fbf843ced37d4e87db5581)
|
|
44
|
-
- refactor [`dad4f95`](https://github.com/underpostnet/engine/commit/dad4f9567629b737254702ce8be6b243e68fb01e)
|
|
45
|
-
- add sitemap builder [`53d05a6`](https://github.com/underpostnet/engine/commit/53d05a62d03ea327df3d37181a4b5c272d417289)
|
|
46
|
-
|
|
47
|
-
#### v2.0.0
|
|
48
|
-
|
|
49
|
-
> 30 March 2024
|
|
50
|
-
|
|
51
|
-
- seed-city assets [`6d9decb`](https://github.com/underpostnet/engine/commit/6d9decbae96b828aa001777f96dd75aab3fc71d1)
|
|
52
|
-
- update [`1069fc5`](https://github.com/underpostnet/engine/commit/1069fc5268aa5ef7c101695393de59edfc14daf8)
|
|
53
|
-
- update [`41ae7d4`](https://github.com/underpostnet/engine/commit/41ae7d4c969cce0608171c820e05ebab42610a7f)
|
|
35
|
+
- add Base project [`4124a60`](https://github.com/underpostnet/pwa-microservices-template/commit/4124a601a8226587bb09db942a8e33b1486828ea)
|
|
36
|
+
- set 0.0.1 env template version [`e38a062`](https://github.com/underpostnet/pwa-microservices-template/commit/e38a06281599a2138d3564ae4ed70f61dad55f88)
|
|
37
|
+
- update dependabot security [`b6f221a`](https://github.com/underpostnet/pwa-microservices-template/commit/b6f221aecae1e00723c15f726ac1bff60199b10b)
|
package/bin/deploy.js
CHANGED
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
cloneSrcComponents,
|
|
21
21
|
getDeployGroupId,
|
|
22
22
|
deployRun,
|
|
23
|
-
updateSrc,
|
|
24
23
|
getDataDeploy,
|
|
25
24
|
buildReplicaId,
|
|
26
25
|
Cmd,
|
|
@@ -150,7 +149,6 @@ try {
|
|
|
150
149
|
deployGroupId,
|
|
151
150
|
});
|
|
152
151
|
if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
|
|
153
|
-
updateSrc();
|
|
154
152
|
await deployRun(dataDeploy);
|
|
155
153
|
} else {
|
|
156
154
|
loadConf(process.argv[3]);
|
|
@@ -295,7 +293,6 @@ try {
|
|
|
295
293
|
case 'run-macro':
|
|
296
294
|
{
|
|
297
295
|
if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
|
|
298
|
-
updateSrc();
|
|
299
296
|
const dataDeploy = getDataDeploy({ deployGroupId: process.argv[3], buildSingleReplica: true });
|
|
300
297
|
await deployRun(dataDeploy, true);
|
|
301
298
|
}
|
|
@@ -304,7 +301,6 @@ try {
|
|
|
304
301
|
case 'run-macro-build':
|
|
305
302
|
{
|
|
306
303
|
if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
|
|
307
|
-
updateSrc();
|
|
308
304
|
const dataDeploy = getDataDeploy({ deployGroupId: process.argv[3], buildSingleReplica: true });
|
|
309
305
|
for (const deploy of dataDeploy) {
|
|
310
306
|
shellExec(Cmd.conf(deploy.deployId));
|
|
@@ -570,8 +566,8 @@ try {
|
|
|
570
566
|
'utf8',
|
|
571
567
|
);
|
|
572
568
|
|
|
573
|
-
|
|
574
|
-
|
|
569
|
+
shellExec(`node bin/deploy update-package`);
|
|
570
|
+
shellExec(`auto-changelog`);
|
|
575
571
|
}
|
|
576
572
|
break;
|
|
577
573
|
|
package/bin/index.js
CHANGED
package/docker-compose.yml
CHANGED
package/package.json
CHANGED
|
@@ -607,7 +607,11 @@ const typeWriter = async function ({ id, html, seconds, endHideBlink, container
|
|
|
607
607
|
return new Promise((resolve) => {
|
|
608
608
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timing-function
|
|
609
609
|
// https://www.w3schools.com/cssref/css3_pr_animation-fill-mode.php
|
|
610
|
-
const typingAnimationTransitionStyle = [
|
|
610
|
+
const typingAnimationTransitionStyle = [
|
|
611
|
+
`1s linear`,
|
|
612
|
+
`${seconds}s steps(${html.split(' ').length * 6}, end)`,
|
|
613
|
+
`1s forwards`,
|
|
614
|
+
];
|
|
611
615
|
const render = html`
|
|
612
616
|
<style class="style-${id}">
|
|
613
617
|
.tw-${id}-typed-out {
|
|
@@ -136,13 +136,14 @@ const LoadingAnimation = {
|
|
|
136
136
|
htmls('.ssr-loading-bar', html`<div class="ssr-loading-bar-block ssr-blink-bar"></div>`);
|
|
137
137
|
},
|
|
138
138
|
},
|
|
139
|
-
removeSplashScreen: function () {
|
|
139
|
+
removeSplashScreen: function (backgroundContainer) {
|
|
140
140
|
if (s(`.clean-cache-container`)) s(`.clean-cache-container`).style.display = 'none';
|
|
141
|
-
if (
|
|
141
|
+
if (!backgroundContainer) backgroundContainer = '.ssr-background';
|
|
142
|
+
if (s(backgroundContainer))
|
|
142
143
|
setTimeout(() => {
|
|
143
|
-
s(
|
|
144
|
+
s(backgroundContainer).style.opacity = 0;
|
|
144
145
|
setTimeout(async () => {
|
|
145
|
-
s(
|
|
146
|
+
s(backgroundContainer).style.display = 'none';
|
|
146
147
|
}, 300);
|
|
147
148
|
});
|
|
148
149
|
},
|
|
@@ -168,9 +169,7 @@ const LoadingAnimation = {
|
|
|
168
169
|
if (nameSrcLoad)
|
|
169
170
|
htmls(
|
|
170
171
|
`.ssr-loading-info`,
|
|
171
|
-
html`<span style="color: white">
|
|
172
|
-
<br />
|
|
173
|
-
...${nameSrcLoad.slice(-30).replaceAll('file', 'storage')}`,
|
|
172
|
+
html`<span style="color: white">Loading </span> ...${nameSrcLoad.slice(-30).replaceAll('file', 'storage')}`,
|
|
174
173
|
);
|
|
175
174
|
}
|
|
176
175
|
}
|
|
@@ -431,6 +431,11 @@ const TranslateCore = {
|
|
|
431
431
|
en: 'Are you sure you want to delete all data?',
|
|
432
432
|
es: 'Estas seguro de eliminar todos los datos?',
|
|
433
433
|
};
|
|
434
|
+
Translate.Data['charge-complete'] = {
|
|
435
|
+
en: 'Charge complete',
|
|
436
|
+
es: 'Carga completada',
|
|
437
|
+
};
|
|
438
|
+
Translate.Data['play'] = { es: 'Jugar', en: 'Play' };
|
|
434
439
|
},
|
|
435
440
|
};
|
|
436
441
|
|
|
@@ -428,6 +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 = () => navigator.language || navigator.userLanguage;
|
|
432
|
+
|
|
431
433
|
export {
|
|
432
434
|
s,
|
|
433
435
|
htmls,
|
|
@@ -457,4 +459,5 @@ export {
|
|
|
457
459
|
isActiveElement,
|
|
458
460
|
isDevInstance,
|
|
459
461
|
getDataFromInputFile,
|
|
462
|
+
getLang,
|
|
460
463
|
};
|
|
@@ -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.7</div>
|
|
113
113
|
`;
|
|
114
114
|
};
|
package/src/cron.js
CHANGED
|
@@ -9,6 +9,7 @@ import { Dns } from './server/dns.js';
|
|
|
9
9
|
import { ProcessController } from './server/process.js';
|
|
10
10
|
import { Config } from './server/conf.js';
|
|
11
11
|
import { BackUpManagement } from './server/backup.js';
|
|
12
|
+
import { CronManagement } from './server/cron.js';
|
|
12
13
|
|
|
13
14
|
dotenv.config();
|
|
14
15
|
|
|
@@ -18,8 +19,12 @@ const logger = loggerFactory(import.meta);
|
|
|
18
19
|
|
|
19
20
|
await logger.setUpInfo();
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
// every minutes
|
|
23
|
+
CronManagement.add('ip', '* * * * *', await Dns.InitIpDaemon());
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
// every day at 1 am
|
|
26
|
+
CronManagement.add('backup', '0 1 * * *', await BackUpManagement.Init());
|
|
27
|
+
|
|
28
|
+
await CronManagement.init();
|
|
24
29
|
|
|
25
30
|
ProcessController.init(logger);
|
|
@@ -114,18 +114,6 @@ const MongooseDB = {
|
|
|
114
114
|
};
|
|
115
115
|
|
|
116
116
|
checkStatus();
|
|
117
|
-
break;
|
|
118
|
-
// every 30 minute
|
|
119
|
-
cron.schedule(
|
|
120
|
-
'0 */30 * * * *',
|
|
121
|
-
async () => {
|
|
122
|
-
checkStatus();
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
scheduled: true,
|
|
126
|
-
timezone: process.env.TIME_ZONE || 'America/New_York',
|
|
127
|
-
},
|
|
128
|
-
);
|
|
129
117
|
}
|
|
130
118
|
break;
|
|
131
119
|
default:
|
package/src/server/backup.js
CHANGED
|
@@ -2,25 +2,17 @@ import fs from 'fs-extra';
|
|
|
2
2
|
import { loggerFactory } from './logger.js';
|
|
3
3
|
import { shellCd, shellExec } from './process.js';
|
|
4
4
|
import { getCronBackUpFolder, getDataDeploy } from './conf.js';
|
|
5
|
-
import
|
|
5
|
+
import dotenv from 'dotenv';
|
|
6
|
+
|
|
7
|
+
dotenv.config();
|
|
6
8
|
|
|
7
9
|
const logger = loggerFactory(import.meta);
|
|
8
10
|
|
|
9
11
|
const BackUpManagement = {
|
|
12
|
+
repoUrl: `https://${process.env.GITHUB_BACKUP_TOKEN}@github.com/${process.env.GITHUB_BACKUP_USERNAME}/${process.env.GITHUB_BACKUP_REPO}.git`,
|
|
10
13
|
Init: async function () {
|
|
11
|
-
await
|
|
12
|
-
|
|
13
|
-
// Schedule the sending process to run every day at 1 am
|
|
14
|
-
cron.schedule(
|
|
15
|
-
'0 1 * * *',
|
|
16
|
-
async () => {
|
|
17
|
-
await BackUpManagement.Callback();
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
scheduled: true,
|
|
21
|
-
timezone: process.env.TIME_ZONE || 'America/New_York',
|
|
22
|
-
},
|
|
23
|
-
);
|
|
14
|
+
await this.Callback();
|
|
15
|
+
return this.Callback;
|
|
24
16
|
},
|
|
25
17
|
Callback: async function () {
|
|
26
18
|
const privateCronConfPath = `./engine-private/conf/${process.argv[2]}/conf.cron.json`;
|
|
@@ -54,7 +46,7 @@ const BackUpManagement = {
|
|
|
54
46
|
for (const host of Object.keys(confServer))
|
|
55
47
|
for (const path of Object.keys(confServer[host])) {
|
|
56
48
|
// retention policy
|
|
57
|
-
let { db, backupFrequency, maxBackupRetention, singleReplica } = confServer[host][path];
|
|
49
|
+
let { db, backupFrequency, maxBackupRetention, singleReplica, wp, git, directory } = confServer[host][path];
|
|
58
50
|
|
|
59
51
|
if (!db || singleReplica) continue;
|
|
60
52
|
|
|
@@ -75,26 +67,41 @@ const BackUpManagement = {
|
|
|
75
67
|
case 'daily':
|
|
76
68
|
|
|
77
69
|
default:
|
|
78
|
-
if (currentBackupsDirs[0] && currentDate - currentBackupsDirs[0]
|
|
70
|
+
// if (currentBackupsDirs[0] && currentDate - currentBackupsDirs[0] < 1000 * 60 * 60 * 24) continue;
|
|
79
71
|
break;
|
|
80
72
|
}
|
|
81
73
|
|
|
82
|
-
for (const retentionPath of currentBackupsDirs.filter((t, i) => i >= maxBackupRetention
|
|
74
|
+
for (const retentionPath of currentBackupsDirs.filter((t, i) => i >= maxBackupRetention - 1)) {
|
|
83
75
|
const removePathRetention = `${backUpPath}/${retentionPath}`;
|
|
76
|
+
logger.info('Remove backup folder', removePathRetention);
|
|
84
77
|
fs.removeSync(removePathRetention);
|
|
85
78
|
}
|
|
86
79
|
|
|
87
80
|
fs.mkdirSync(`${backUpPath}/${currentDate}`, { recursive: true });
|
|
88
81
|
|
|
89
82
|
shellExec(`node bin/db ${host}${path} export ${deployId} ${backUpPath}/${currentDate}`);
|
|
83
|
+
|
|
84
|
+
if (wp) {
|
|
85
|
+
const repoUrl = `https://${process.env.GITHUB_BACKUP_TOKEN}@github.com/${
|
|
86
|
+
process.env.GITHUB_BACKUP_USERNAME
|
|
87
|
+
}/${git.split('/').pop()}.git`;
|
|
88
|
+
|
|
89
|
+
shellExec(
|
|
90
|
+
`cd ${directory}` +
|
|
91
|
+
` && git pull ${repoUrl}` +
|
|
92
|
+
` && git add . && git commit -m "backup ${new Date().toLocaleDateString()}"` +
|
|
93
|
+
` && git push ${repoUrl}`,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
90
96
|
}
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
shellExec(
|
|
100
|
+
`cd ./engine-private/cron-backups` +
|
|
101
|
+
` && git pull ${BackUpManagement.repoUrl}` +
|
|
102
|
+
` && git add . && git commit -m "backup ${new Date().toLocaleDateString()}"` +
|
|
103
|
+
` && git push ${BackUpManagement.repoUrl}`,
|
|
104
|
+
);
|
|
98
105
|
},
|
|
99
106
|
};
|
|
100
107
|
|
|
@@ -20,8 +20,26 @@ const clientLiveBuild = async () => {
|
|
|
20
20
|
(fs.existsSync(`./engine-private/conf/${deployId}`) || fs.existsSync(`./engine-private/replica/${deployId}`))
|
|
21
21
|
) {
|
|
22
22
|
loadConf(deployId);
|
|
23
|
-
const confClient = JSON.parse(
|
|
24
|
-
|
|
23
|
+
const confClient = JSON.parse(
|
|
24
|
+
fs.readFileSync(
|
|
25
|
+
fs.existsSync(`./engine-private/replica/${deployId}`)
|
|
26
|
+
? `./engine-private/replica/${deployId}/conf.client.json`
|
|
27
|
+
: fs.existsSync(`./engine-private/conf/${deployId}/conf.client.json`)
|
|
28
|
+
? `./engine-private/conf/${deployId}/conf.client.json`
|
|
29
|
+
: `./conf/conf.client.json`,
|
|
30
|
+
'utf8',
|
|
31
|
+
),
|
|
32
|
+
);
|
|
33
|
+
const confServer = JSON.parse(
|
|
34
|
+
fs.readFileSync(
|
|
35
|
+
fs.existsSync(`./engine-private/replica/${deployId}`)
|
|
36
|
+
? `./engine-private/replica/${deployId}/conf.server.json`
|
|
37
|
+
: fs.existsSync(`./engine-private/conf/${deployId}/conf.server.json`)
|
|
38
|
+
? `./engine-private/conf/${deployId}/conf.server.json`
|
|
39
|
+
: `./conf/conf.server.json`,
|
|
40
|
+
'utf8',
|
|
41
|
+
),
|
|
42
|
+
);
|
|
25
43
|
host = process.argv[3];
|
|
26
44
|
path = process.argv[4];
|
|
27
45
|
clientId = confServer[host][path].client;
|
|
@@ -41,6 +59,8 @@ const clientLiveBuild = async () => {
|
|
|
41
59
|
const updates = JSON.parse(fs.readFileSync(`./tmp/client.build.json`, 'utf8'));
|
|
42
60
|
const liveClientBuildPaths = [];
|
|
43
61
|
for (let srcPath of updates) {
|
|
62
|
+
srcPath = srcPath.replaceAll('/', `\\`); // linux case
|
|
63
|
+
|
|
44
64
|
const srcBuildPath = `./src${srcPath.split('src')[1].replace(/\\/g, '/')}`;
|
|
45
65
|
if (
|
|
46
66
|
srcPath.split('src')[1].startsWith(`\\client\\components`) ||
|
|
@@ -461,6 +461,58 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [] }
|
|
|
461
461
|
}
|
|
462
462
|
break;
|
|
463
463
|
|
|
464
|
+
case 'CyberiaSplashScreenLore': {
|
|
465
|
+
ssrBodyComponents += SrrComponent({
|
|
466
|
+
ssrPath,
|
|
467
|
+
host,
|
|
468
|
+
path,
|
|
469
|
+
ttiLoadTimeLimit,
|
|
470
|
+
storage: {
|
|
471
|
+
// 'space-background': fs.readFileSync('./src/client/public/cyberia/space-background', 'utf8'),
|
|
472
|
+
lore0: `data:image/jpeg;base64,${fs
|
|
473
|
+
.readFileSync('./src/client/public/cyberia/assets/lore/lore0.jpeg')
|
|
474
|
+
.toString('base64')}`,
|
|
475
|
+
lore1: `data:image/jpeg;base64,${fs
|
|
476
|
+
.readFileSync('./src/client/public/cyberia/assets/lore/lore1.jpeg')
|
|
477
|
+
.toString('base64')}`,
|
|
478
|
+
lore2: `data:image/jpeg;base64,${fs
|
|
479
|
+
.readFileSync('./src/client/public/cyberia/assets/lore/lore2.jpeg')
|
|
480
|
+
.toString('base64')}`,
|
|
481
|
+
lore3: `data:image/jpeg;base64,${fs
|
|
482
|
+
.readFileSync('./src/client/public/cyberia/assets/lore/lore3.jpeg')
|
|
483
|
+
.toString('base64')}`,
|
|
484
|
+
lore4: `data:image/jpeg;base64,${fs
|
|
485
|
+
.readFileSync('./src/client/public/cyberia/assets/lore/lore4.jpeg')
|
|
486
|
+
.toString('base64')}`,
|
|
487
|
+
lore5: `data:image/jpeg;base64,${fs
|
|
488
|
+
.readFileSync('./src/client/public/cyberia/assets/lore/lore5.jpeg')
|
|
489
|
+
.toString('base64')}`,
|
|
490
|
+
lore6: `data:image/jpeg;base64,${fs
|
|
491
|
+
.readFileSync('./src/client/public/cyberia/assets/lore/lore6.jpeg')
|
|
492
|
+
.toString('base64')}`,
|
|
493
|
+
lore7: `data:image/jpeg;base64,${fs
|
|
494
|
+
.readFileSync('./src/client/public/cyberia/assets/lore/lore7.jpeg')
|
|
495
|
+
.toString('base64')}`,
|
|
496
|
+
lore8: `data:image/jpeg;base64,${fs
|
|
497
|
+
.readFileSync('./src/client/public/cyberia/assets/lore/lore8.jpeg')
|
|
498
|
+
.toString('base64')}`,
|
|
499
|
+
['arrow-left']: `data:image/png;base64,${fs
|
|
500
|
+
.readFileSync('./src/client/public/cyberia/assets/ui-icons/arrow-left.png')
|
|
501
|
+
.toString('base64')}`,
|
|
502
|
+
['arrow-right']: `data:image/png;base64,${fs
|
|
503
|
+
.readFileSync('./src/client/public/cyberia/assets/ui-icons/arrow-right.png')
|
|
504
|
+
.toString('base64')}`,
|
|
505
|
+
['fullscreen']: `data:image/png;base64,${fs
|
|
506
|
+
.readFileSync('./src/client/public/cyberia/assets/ui-icons/fullscreen.png')
|
|
507
|
+
.toString('base64')}`,
|
|
508
|
+
['cyberia-logo']: `data:image/png;base64,${fs
|
|
509
|
+
.readFileSync('./src/client/public/cyberia/assets/util/cyberia-retro-banner.png')
|
|
510
|
+
.toString('base64')}`,
|
|
511
|
+
},
|
|
512
|
+
});
|
|
513
|
+
break;
|
|
514
|
+
}
|
|
515
|
+
|
|
464
516
|
default:
|
|
465
517
|
ssrBodyComponents += SrrComponent({ ssrPath, host, path, ttiLoadTimeLimit });
|
|
466
518
|
break;
|
package/src/server/conf.js
CHANGED
|
@@ -619,6 +619,8 @@ const deployTest = async (dataDeploy) => {
|
|
|
619
619
|
let fail = false;
|
|
620
620
|
for (const host of Object.keys(serverConf))
|
|
621
621
|
for (const path of Object.keys(serverConf[host])) {
|
|
622
|
+
const { singleReplica } = serverConf[host][path];
|
|
623
|
+
if (singleReplica) continue;
|
|
622
624
|
const urlTest = `https://${host}${path}`;
|
|
623
625
|
try {
|
|
624
626
|
const result = await axios.get(urlTest);
|
|
@@ -702,15 +704,6 @@ const deployRun = async (dataDeploy, reset) => {
|
|
|
702
704
|
} else logger.info(`Deploy process successfully`);
|
|
703
705
|
};
|
|
704
706
|
|
|
705
|
-
const updateSrc = () => {
|
|
706
|
-
const silent = true;
|
|
707
|
-
shellExec(`git pull origin master`, { silent });
|
|
708
|
-
shellCd(`engine-private`);
|
|
709
|
-
shellExec(`git pull origin master`, { silent });
|
|
710
|
-
shellCd(`..`);
|
|
711
|
-
// shellExec(`npm install && npm install --only=dev`);
|
|
712
|
-
};
|
|
713
|
-
|
|
714
707
|
const restoreMacroDb = async (deployGroupId = '') => {
|
|
715
708
|
const dataDeploy = await getDataDeploy({ deployGroupId, buildSingleReplica: false });
|
|
716
709
|
for (const deployGroup of dataDeploy) {
|
|
@@ -881,7 +874,6 @@ export {
|
|
|
881
874
|
getDeployGroupId,
|
|
882
875
|
execDeploy,
|
|
883
876
|
deployRun,
|
|
884
|
-
updateSrc,
|
|
885
877
|
getCronBackUpFolder,
|
|
886
878
|
getRestoreCronCmd,
|
|
887
879
|
mergeBackUp,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import cron from 'node-cron';
|
|
2
|
+
import { loggerFactory } from './logger.js';
|
|
3
|
+
|
|
4
|
+
const logger = loggerFactory(import.meta);
|
|
5
|
+
|
|
6
|
+
const CronManagement = {
|
|
7
|
+
data: {},
|
|
8
|
+
init: function () {
|
|
9
|
+
// verify tokens
|
|
10
|
+
// https://github.com/settings/tokens
|
|
11
|
+
for (const cronKey of Object.keys(this.data)) {
|
|
12
|
+
if (this.data[cronKey].valid) {
|
|
13
|
+
this.data[cronKey].task.start();
|
|
14
|
+
logger.info(`Cron task "${this.data[cronKey].name}" started`);
|
|
15
|
+
} else {
|
|
16
|
+
logger.error(
|
|
17
|
+
`Invalid cron expression "${this.data[cronKey].expression}" for task "${this.data[cronKey].name}"`,
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
add: function (name = 'task', expression = '* * * * *', callback = async () => null) {
|
|
23
|
+
const args = { name, expression, valid: cron.validate(expression) };
|
|
24
|
+
this.data[name] = {
|
|
25
|
+
...args,
|
|
26
|
+
task: cron.schedule(expression, callback, {
|
|
27
|
+
scheduled: false,
|
|
28
|
+
timezone: process.env.TIME_ZONE || 'America/New_York',
|
|
29
|
+
name,
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { CronManagement };
|
package/src/server/dns.js
CHANGED
|
@@ -14,6 +14,7 @@ const logger = loggerFactory(import.meta);
|
|
|
14
14
|
const Dns = {
|
|
15
15
|
ip: null,
|
|
16
16
|
ipDaemon: null,
|
|
17
|
+
callback: () => null,
|
|
17
18
|
InitIpDaemon: async function () {
|
|
18
19
|
// WAN | NAT-VPS | LAN
|
|
19
20
|
// enabled DMZ Host to proxy IP 80-443 (79-444) sometimes router block first port
|
|
@@ -58,18 +59,8 @@ const Dns = {
|
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
cron.schedule(
|
|
64
|
-
'* * * * *',
|
|
65
|
-
async () => {
|
|
66
|
-
await callback();
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
scheduled: true,
|
|
70
|
-
timezone: process.env.TIME_ZONE || 'America/New_York',
|
|
71
|
-
},
|
|
72
|
-
);
|
|
62
|
+
this.callback = callback;
|
|
63
|
+
return callback;
|
|
73
64
|
},
|
|
74
65
|
services: {
|
|
75
66
|
updateIp: {
|