underpost 2.7.5 → 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/.env.development +0 -2
- package/.env.production +0 -2
- package/.env.test +0 -2
- package/.github/workflows/publish.yml +17 -3
- package/CHANGELOG.md +20 -74
- package/Dockerfile +1 -1
- package/README.md +1 -1
- package/bin/deploy.js +45 -4
- package/bin/index.js +1 -1
- package/docker-compose.yml +1 -1
- package/package.json +3 -8
- package/src/api/file/file.service.js +4 -0
- package/src/client/components/core/CommonJs.js +7 -0
- package/src/client/components/core/Css.js +5 -1
- package/src/client/components/core/Docs.js +9 -7
- 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/index.js +1 -0
- 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/client-icons.js +4 -2
- package/src/server/conf.js +31 -10
- package/src/server/cron.js +35 -0
- package/src/server/dns.js +3 -12
- package/startup.js +1 -1
- package/setup.sh +0 -25
package/.env.development
CHANGED
package/.env.production
CHANGED
package/.env.test
CHANGED
|
@@ -14,7 +14,7 @@ jobs:
|
|
|
14
14
|
- uses: actions/checkout@v4
|
|
15
15
|
- uses: actions/setup-node@v4
|
|
16
16
|
with:
|
|
17
|
-
node-version: '
|
|
17
|
+
node-version: '22.x'
|
|
18
18
|
registry-url: 'https://registry.npmjs.org'
|
|
19
19
|
|
|
20
20
|
- name: Install Dependencies
|
|
@@ -25,7 +25,7 @@ jobs:
|
|
|
25
25
|
# Publish to npm
|
|
26
26
|
- uses: actions/setup-node@v4
|
|
27
27
|
with:
|
|
28
|
-
node-version: '
|
|
28
|
+
node-version: '22.x'
|
|
29
29
|
registry-url: 'https://registry.npmjs.org'
|
|
30
30
|
# Defaults to the user or organization that owns the workflow file
|
|
31
31
|
# scope: '@underpostnet'
|
|
@@ -34,11 +34,25 @@ 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
|
|
40
54
|
with:
|
|
41
|
-
node-version:
|
|
55
|
+
node-version: 22.x
|
|
42
56
|
registry-url: 'https://npm.pkg.github.com'
|
|
43
57
|
# Defaults to the user or organization that owns the workflow file
|
|
44
58
|
scope: '@underpostnet'
|
package/CHANGELOG.md
CHANGED
|
@@ -4,88 +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
|
+
#### [v2.7.2](https://github.com/underpostnet/pwa-microservices-template/compare/v2.7.1...v2.7.2)
|
|
8
8
|
|
|
9
|
-
>
|
|
10
|
-
|
|
11
|
-
- update version 2.6.3 [`85c585d`](https://github.com/underpostnet/engine/commit/85c585d1cce30de4389772605cf56e774e2b7d3c)
|
|
12
|
-
- update refactor docs and coverage [`b455016`](https://github.com/underpostnet/engine/commit/b455016f5f2b2bdc142aacb4dfd66ab890125662)
|
|
13
|
-
- update [`b8f01f2`](https://github.com/underpostnet/engine/commit/b8f01f258999c9ebc1173b0616f0f7b8f7171048)
|
|
14
|
-
|
|
15
|
-
#### [v2.6.2](https://github.com/underpostnet/engine/compare/v2.5.6...v2.6.2)
|
|
16
|
-
|
|
17
|
-
> 13 September 2024
|
|
18
|
-
|
|
19
|
-
- update version 2.6.2 [`0895afb`](https://github.com/underpostnet/engine/commit/0895afbde42dd5a573507ccfcb07c328648b4eb0)
|
|
20
|
-
- update [`344d303`](https://github.com/underpostnet/engine/commit/344d303702ebce22dff50d8c0f8d8d870a2860ee)
|
|
21
|
-
|
|
22
|
-
#### [v2.5.6](https://github.com/underpostnet/engine/compare/v2.5.2...v2.5.6)
|
|
23
|
-
|
|
24
|
-
> 13 September 2024
|
|
25
|
-
|
|
26
|
-
- update version 2.5.6 [`ca57b87`](https://github.com/underpostnet/engine/commit/ca57b87c56a544e7b7e53baa5a6e15415e16b99b)
|
|
27
|
-
- update [`eec4943`](https://github.com/underpostnet/engine/commit/eec49433f50b4dfa7b7bbff48891a60f5be25545)
|
|
28
|
-
- update [`5f0a6ac`](https://github.com/underpostnet/engine/commit/5f0a6aca1ae971bc42f654cf3f2bf7ace7fe613d)
|
|
29
|
-
|
|
30
|
-
#### [v2.5.2](https://github.com/underpostnet/engine/compare/v2.5.1...v2.5.2)
|
|
31
|
-
|
|
32
|
-
> 12 September 2024
|
|
33
|
-
|
|
34
|
-
- update dependebot security [`1289b96`](https://github.com/underpostnet/engine/commit/1289b9627dc59bf08e66edbef1bf7bf08e53984c)
|
|
35
|
-
- update [`ec11af8`](https://github.com/underpostnet/engine/commit/ec11af86e884ca3eeaeaa12695edddaa8b46492d)
|
|
36
|
-
- remove toast-ui [`40c207f`](https://github.com/underpostnet/engine/commit/40c207f13f3e6d7ab71fc4cc203ce6ff02101bb5)
|
|
9
|
+
> 8 October 2024
|
|
37
10
|
|
|
38
|
-
|
|
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)
|
|
39
14
|
|
|
40
|
-
|
|
15
|
+
#### [v2.7.1](https://github.com/underpostnet/pwa-microservices-template/compare/v2.6.3...v2.7.1)
|
|
41
16
|
|
|
42
|
-
|
|
43
|
-
- bucket to document [`747cb0b`](https://github.com/underpostnet/engine/commit/747cb0bf5198e4b97df186e642413fa49ed9383f)
|
|
44
|
-
- add user control table managements [`2cfb710`](https://github.com/underpostnet/engine/commit/2cfb7103a591b941897ff3834ad5874565cba6b4)
|
|
17
|
+
> 19 September 2024
|
|
45
18
|
|
|
46
|
-
|
|
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)
|
|
47
22
|
|
|
48
|
-
|
|
23
|
+
#### [v2.6.3](https://github.com/underpostnet/pwa-microservices-template/compare/v2.6.2...v2.6.3)
|
|
49
24
|
|
|
50
|
-
|
|
51
|
-
- refactor [`dad4f95`](https://github.com/underpostnet/engine/commit/dad4f9567629b737254702ce8be6b243e68fb01e)
|
|
52
|
-
- add sitemap builder [`53d05a6`](https://github.com/underpostnet/engine/commit/53d05a62d03ea327df3d37181a4b5c272d417289)
|
|
53
|
-
|
|
54
|
-
### [v2.0.0](https://github.com/underpostnet/engine/compare/v1.0.4...v2.0.0)
|
|
55
|
-
|
|
56
|
-
> 30 March 2024
|
|
57
|
-
|
|
58
|
-
- seed-city assets [`6d9decb`](https://github.com/underpostnet/engine/commit/6d9decbae96b828aa001777f96dd75aab3fc71d1)
|
|
59
|
-
- update [`1069fc5`](https://github.com/underpostnet/engine/commit/1069fc5268aa5ef7c101695393de59edfc14daf8)
|
|
60
|
-
- update [`41ae7d4`](https://github.com/underpostnet/engine/commit/41ae7d4c969cce0608171c820e05ebab42610a7f)
|
|
61
|
-
|
|
62
|
-
#### [v1.0.4](https://github.com/underpostnet/engine/compare/v1.0.3...v1.0.4)
|
|
63
|
-
|
|
64
|
-
> 14 January 2023
|
|
65
|
-
|
|
66
|
-
- update [`8109700`](https://github.com/underpostnet/engine/commit/81097008baa95ac50efb760b228dc4abae63c379)
|
|
67
|
-
- update [`b6bb47f`](https://github.com/underpostnet/engine/commit/b6bb47f95bd56c0062066ecae5f03813cf1ed6f8)
|
|
68
|
-
- update [`15c0ca9`](https://github.com/underpostnet/engine/commit/15c0ca9f9a8203bec53a9677d5a8edcd04a7f1df)
|
|
69
|
-
|
|
70
|
-
#### [v1.0.3](https://github.com/underpostnet/engine/compare/v1.0.2...v1.0.3)
|
|
71
|
-
|
|
72
|
-
> 21 December 2022
|
|
73
|
-
|
|
74
|
-
- update [`69418ba`](https://github.com/underpostnet/engine/commit/69418ba34831983e07aa458d1ea4a742c7b66096)
|
|
75
|
-
- update [`003412f`](https://github.com/underpostnet/engine/commit/003412fadf3efe6b819f037e99855192f13ccd7e)
|
|
76
|
-
|
|
77
|
-
#### [v1.0.2](https://github.com/underpostnet/engine/compare/v1.0.1...v1.0.2)
|
|
78
|
-
|
|
79
|
-
> 21 December 2022
|
|
25
|
+
> 14 September 2024
|
|
80
26
|
|
|
81
|
-
- update [`
|
|
82
|
-
- update [`
|
|
83
|
-
- 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)
|
|
84
30
|
|
|
85
|
-
####
|
|
31
|
+
#### v2.6.2
|
|
86
32
|
|
|
87
|
-
>
|
|
33
|
+
> 13 September 2024
|
|
88
34
|
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
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/Dockerfile
CHANGED
|
@@ -37,7 +37,7 @@ RUN apt-get install -yq --no-install-recommends \
|
|
|
37
37
|
gnupg
|
|
38
38
|
|
|
39
39
|
# install nodejs https://github.com/nodesource/distributions/blob/master/README.md#deb
|
|
40
|
-
RUN curl -fsSL https://deb.nodesource.com/
|
|
40
|
+
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
|
|
41
41
|
apt-get install -y nodejs \
|
|
42
42
|
build-essential && \
|
|
43
43
|
node --version && \
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ template
|
|
|
16
16
|
|
|
17
17
|
<div align="center">
|
|
18
18
|
|
|
19
|
-
<a target="_top" href='https://www.npmjs.com/package/npm/v/10.2.3' ><img alt='npm' src='https://img.shields.io/badge/npm v10.2.3-100000?style=flat&logo=npm&logoColor=white&labelColor=CB3837&color=727273'/></a> <a target="_top" href='https://nodejs.org/download/release/
|
|
19
|
+
<a target="_top" href='https://www.npmjs.com/package/npm/v/10.2.3' ><img alt='npm' src='https://img.shields.io/badge/npm v10.2.3-100000?style=flat&logo=npm&logoColor=white&labelColor=CB3837&color=727273'/></a> <a target="_top" href='https://nodejs.org/download/release/v22.9.0/' ><img alt='nodedotjs' src='https://img.shields.io/badge/node v22.9.0-100000?style=flat&logo=nodedotjs&logoColor=white&labelColor=5FA04E&color=727273'/></a> <a target="_top" href='https://pgp.mongodb.com/' ><img alt='mongodb' src='https://img.shields.io/badge/mongodb_server v7.0-100000?style=flat&logo=mongodb&logoColor=white&labelColor=47A248&color=727273'/></a>
|
|
20
20
|
|
|
21
21
|
</div>
|
|
22
22
|
|
package/bin/deploy.js
CHANGED
|
@@ -20,11 +20,11 @@ import {
|
|
|
20
20
|
cloneSrcComponents,
|
|
21
21
|
getDeployGroupId,
|
|
22
22
|
deployRun,
|
|
23
|
-
updateSrc,
|
|
24
23
|
getDataDeploy,
|
|
25
24
|
buildReplicaId,
|
|
26
25
|
Cmd,
|
|
27
26
|
restoreMacroDb,
|
|
27
|
+
fixDependencies,
|
|
28
28
|
} from '../src/server/conf.js';
|
|
29
29
|
import { buildClient } from '../src/server/client-build.js';
|
|
30
30
|
import { range, setPad, timer, uniqueArray } from '../src/client/components/core/CommonJs.js';
|
|
@@ -149,7 +149,6 @@ try {
|
|
|
149
149
|
deployGroupId,
|
|
150
150
|
});
|
|
151
151
|
if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
|
|
152
|
-
updateSrc();
|
|
153
152
|
await deployRun(dataDeploy);
|
|
154
153
|
} else {
|
|
155
154
|
loadConf(process.argv[3]);
|
|
@@ -294,7 +293,6 @@ try {
|
|
|
294
293
|
case 'run-macro':
|
|
295
294
|
{
|
|
296
295
|
if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
|
|
297
|
-
updateSrc();
|
|
298
296
|
const dataDeploy = getDataDeploy({ deployGroupId: process.argv[3], buildSingleReplica: true });
|
|
299
297
|
await deployRun(dataDeploy, true);
|
|
300
298
|
}
|
|
@@ -303,7 +301,6 @@ try {
|
|
|
303
301
|
case 'run-macro-build':
|
|
304
302
|
{
|
|
305
303
|
if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
|
|
306
|
-
updateSrc();
|
|
307
304
|
const dataDeploy = getDataDeploy({ deployGroupId: process.argv[3], buildSingleReplica: true });
|
|
308
305
|
for (const deploy of dataDeploy) {
|
|
309
306
|
shellExec(Cmd.conf(deploy.deployId));
|
|
@@ -568,6 +565,9 @@ try {
|
|
|
568
565
|
fs.readFileSync(`./bin/index.js`, 'utf8').replaceAll(`${version}`, `${newVersion}`),
|
|
569
566
|
'utf8',
|
|
570
567
|
);
|
|
568
|
+
|
|
569
|
+
shellExec(`node bin/deploy update-package`);
|
|
570
|
+
shellExec(`auto-changelog`);
|
|
571
571
|
}
|
|
572
572
|
break;
|
|
573
573
|
|
|
@@ -612,6 +612,47 @@ ${uniqueArray(logs.all.map((log) => `- ${log.author_name} ([${log.author_email}]
|
|
|
612
612
|
|
|
613
613
|
case 'lampp': {
|
|
614
614
|
await Lampp.install();
|
|
615
|
+
break;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
case 'heb': {
|
|
619
|
+
// https://besu.hyperledger.org/
|
|
620
|
+
// https://github.com/hyperledger/besu/archive/refs/tags/24.9.1.tar.gz
|
|
621
|
+
|
|
622
|
+
switch (process.platform) {
|
|
623
|
+
case 'linux':
|
|
624
|
+
{
|
|
625
|
+
shellCd(`..`);
|
|
626
|
+
|
|
627
|
+
// Download the Linux binary
|
|
628
|
+
shellExec(`wget https://github.com/hyperledger/besu/releases/download/24.9.1/besu-24.9.1.tar.gz`);
|
|
629
|
+
|
|
630
|
+
// Unzip the file:
|
|
631
|
+
shellExec(`tar -xvzf besu-24.9.1.tar.gz`);
|
|
632
|
+
|
|
633
|
+
shellCd(`besu-24.9.1`);
|
|
634
|
+
|
|
635
|
+
shellExec(`bin/besu --help`);
|
|
636
|
+
|
|
637
|
+
// Set env path
|
|
638
|
+
// export PATH=$PATH:/dd/besu-24.9.1/bin
|
|
639
|
+
|
|
640
|
+
// Open src
|
|
641
|
+
// shellExec(`sudo code /dd/besu-24.9.1 --user-data-dir="/root/.vscode-root" --no-sandbox`);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
break;
|
|
645
|
+
|
|
646
|
+
default:
|
|
647
|
+
break;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
break;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
case 'fix-deps': {
|
|
654
|
+
await fixDependencies();
|
|
655
|
+
break;
|
|
615
656
|
}
|
|
616
657
|
|
|
617
658
|
default:
|
package/bin/index.js
CHANGED
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": "underpost",
|
|
5
|
-
"version": "2.7.
|
|
5
|
+
"version": "2.7.7",
|
|
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",
|
|
@@ -39,10 +39,7 @@
|
|
|
39
39
|
"url": "git+https://github.com/underpostnet/pwa-microservices-template.git"
|
|
40
40
|
},
|
|
41
41
|
"keywords": [
|
|
42
|
-
"
|
|
43
|
-
"template",
|
|
44
|
-
"microservices",
|
|
45
|
-
"api",
|
|
42
|
+
"engine",
|
|
46
43
|
"server",
|
|
47
44
|
"proxy",
|
|
48
45
|
"client"
|
|
@@ -57,7 +54,6 @@
|
|
|
57
54
|
"@fortawesome/fontawesome-free": "^6.4.2",
|
|
58
55
|
"@loadingio/css-spinner": "^2.0.2",
|
|
59
56
|
"@neodrag/vanilla": "^2.0.3",
|
|
60
|
-
"@pinata/sdk": "^2.1.0",
|
|
61
57
|
"@xenova/transformers": "^2.17.2",
|
|
62
58
|
"adm-zip": "^0.5.10",
|
|
63
59
|
"ag-grid-community": "31.0.0",
|
|
@@ -114,12 +110,11 @@
|
|
|
114
110
|
"simple-git": "^3.26.0",
|
|
115
111
|
"simple-icons": "^13.9.0",
|
|
116
112
|
"sitemap": "^7.1.1",
|
|
117
|
-
"socket.io": "^4.
|
|
113
|
+
"socket.io": "^4.8.0",
|
|
118
114
|
"sortablejs": "^1.15.0",
|
|
119
115
|
"split-file": "^2.3.0",
|
|
120
116
|
"swagger-ui-express": "^5.0.0",
|
|
121
117
|
"systeminformation": "^5.21.17",
|
|
122
|
-
"text-to-image": "^5.2.0",
|
|
123
118
|
"uglify-js": "^3.17.4",
|
|
124
119
|
"validator": "^13.11.0",
|
|
125
120
|
"winston": "^3.11.0"
|
|
@@ -681,6 +681,12 @@ function rgbToHex(rgb) {
|
|
|
681
681
|
|
|
682
682
|
const getCapVariableName = (value = 'default') => cap(value.replaceAll('-', ' ')).replaceAll(' ', '');
|
|
683
683
|
|
|
684
|
+
const hexToNumber = (hex = 0xdc) => Number(hex) || parseFloat(hex, 16);
|
|
685
|
+
|
|
686
|
+
// 0x = Hexadecimal
|
|
687
|
+
// 0b = Binary
|
|
688
|
+
// 0o = Octal
|
|
689
|
+
|
|
684
690
|
export {
|
|
685
691
|
s4,
|
|
686
692
|
range,
|
|
@@ -732,4 +738,5 @@ export {
|
|
|
732
738
|
componentFromStr,
|
|
733
739
|
rgbToHex,
|
|
734
740
|
getCapVariableName,
|
|
741
|
+
hexToNumber,
|
|
735
742
|
};
|
|
@@ -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 {
|
|
@@ -63,7 +63,7 @@ const Docs = {
|
|
|
63
63
|
icon: html`<i class="fa-brands fa-osi"></i>`,
|
|
64
64
|
text: 'Source Docs',
|
|
65
65
|
url: function () {
|
|
66
|
-
return `${getProxyPath()}docs/engine/2.7.
|
|
66
|
+
return `${getProxyPath()}docs/engine/2.7.7`;
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
69
|
{
|
|
@@ -82,9 +82,10 @@ const Docs = {
|
|
|
82
82
|
return `${getProxyPath()}docs/coverage`;
|
|
83
83
|
},
|
|
84
84
|
themeEvent: () => {
|
|
85
|
-
s(`.doc-icon-coverage`)
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
if (s(`.doc-icon-coverage`))
|
|
86
|
+
s(`.doc-icon-coverage`).src = `https://cdn.simpleicons.org/coveralls/${rgbToHex(
|
|
87
|
+
window.getComputedStyle(s('html')).color,
|
|
88
|
+
)}`;
|
|
88
89
|
},
|
|
89
90
|
},
|
|
90
91
|
{
|
|
@@ -95,9 +96,10 @@ const Docs = {
|
|
|
95
96
|
return `https://coveralls.io/github/underpostnet/engine`;
|
|
96
97
|
},
|
|
97
98
|
themeEvent: () => {
|
|
98
|
-
s(`.doc-icon-coverage-link`)
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
if (s(`.doc-icon-coverage-link`))
|
|
100
|
+
s(`.doc-icon-coverage-link`).src = `https://cdn.simpleicons.org/coveralls/${rgbToHex(
|
|
101
|
+
window.getComputedStyle(s('html')).color,
|
|
102
|
+
)}`;
|
|
101
103
|
},
|
|
102
104
|
},
|
|
103
105
|
].concat(
|
|
@@ -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)}`,
|
|
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/index.js
CHANGED
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;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { favicons } from 'favicons';
|
|
2
|
-
|
|
2
|
+
// TODO: search alternatives
|
|
3
|
+
// import textToImage from 'text-to-image';
|
|
3
4
|
import { loggerFactory } from './logger.js';
|
|
4
5
|
import fs from 'fs-extra';
|
|
5
6
|
import { png3x } from 'font-awesome-assets';
|
|
@@ -52,7 +53,7 @@ const defaultBaseTextImgOptionsSizes = {
|
|
|
52
53
|
|
|
53
54
|
const buildTextImg = async (text = 'APP', options, size = '1200x1200') => {
|
|
54
55
|
options = { ...defaultBaseTextImgOptions, ...defaultBaseTextImgOptionsSizes[size], ...options };
|
|
55
|
-
await textToImage.generate(text, options);
|
|
56
|
+
// await textToImage.generate(text, options);
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
const getBufferPngText = async ({ text, textColor, bgColor, size, debugFilename }) => {
|
|
@@ -62,6 +63,7 @@ const getBufferPngText = async ({ text, textColor, bgColor, size, debugFilename
|
|
|
62
63
|
if (!size) size = '100x300';
|
|
63
64
|
if (!debugFilename) debugFilename = `./${s4()}${s4()}${s4()}.png`;
|
|
64
65
|
await buildTextImg(text, { textColor, bgColor, size, debugFilename }, size);
|
|
66
|
+
if (!fs.existsSync(debugFilename)) return Buffer.alloc(0); // Return empty buffer if file not found
|
|
65
67
|
const bufferImage = fs.readFileSync(debugFilename);
|
|
66
68
|
fs.removeSync(debugFilename);
|
|
67
69
|
return bufferImage;
|
package/src/server/conf.js
CHANGED
|
@@ -12,6 +12,16 @@ import { DefaultConf } from '../../conf.js';
|
|
|
12
12
|
import ncp from 'copy-paste';
|
|
13
13
|
import read from 'read';
|
|
14
14
|
import splitFile from 'split-file';
|
|
15
|
+
import axios from 'axios';
|
|
16
|
+
import https from 'https';
|
|
17
|
+
|
|
18
|
+
// axios.defaults.baseURL = BASE_URL;
|
|
19
|
+
|
|
20
|
+
const httpsAgent = new https.Agent({
|
|
21
|
+
rejectUnauthorized: false,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
axios.defaults.httpsAgent = httpsAgent;
|
|
15
25
|
|
|
16
26
|
colors.enable();
|
|
17
27
|
dotenv.config();
|
|
@@ -585,6 +595,7 @@ const validateTemplatePath = (absolutePath = '') => {
|
|
|
585
595
|
) {
|
|
586
596
|
return false;
|
|
587
597
|
}
|
|
598
|
+
if (absolutePath.match('hardhat/')) return false;
|
|
588
599
|
if (
|
|
589
600
|
absolutePath.match('/client') &&
|
|
590
601
|
absolutePath.match('.index.js') &&
|
|
@@ -608,6 +619,8 @@ const deployTest = async (dataDeploy) => {
|
|
|
608
619
|
let fail = false;
|
|
609
620
|
for (const host of Object.keys(serverConf))
|
|
610
621
|
for (const path of Object.keys(serverConf[host])) {
|
|
622
|
+
const { singleReplica } = serverConf[host][path];
|
|
623
|
+
if (singleReplica) continue;
|
|
611
624
|
const urlTest = `https://${host}${path}`;
|
|
612
625
|
try {
|
|
613
626
|
const result = await axios.get(urlTest);
|
|
@@ -691,15 +704,6 @@ const deployRun = async (dataDeploy, reset) => {
|
|
|
691
704
|
} else logger.info(`Deploy process successfully`);
|
|
692
705
|
};
|
|
693
706
|
|
|
694
|
-
const updateSrc = () => {
|
|
695
|
-
const silent = true;
|
|
696
|
-
shellExec(`git pull origin master`, { silent });
|
|
697
|
-
shellCd(`engine-private`);
|
|
698
|
-
shellExec(`git pull origin master`, { silent });
|
|
699
|
-
shellCd(`..`);
|
|
700
|
-
// shellExec(`npm install && npm install --only=dev`);
|
|
701
|
-
};
|
|
702
|
-
|
|
703
707
|
const restoreMacroDb = async (deployGroupId = '') => {
|
|
704
708
|
const dataDeploy = await getDataDeploy({ deployGroupId, buildSingleReplica: false });
|
|
705
709
|
for (const deployGroup of dataDeploy) {
|
|
@@ -829,6 +833,23 @@ const Cmd = {
|
|
|
829
833
|
syncPorts: (deployGroupId) => `node bin/deploy sync-env-port ${deployGroupId}`,
|
|
830
834
|
};
|
|
831
835
|
|
|
836
|
+
const fixDependencies = async () => {
|
|
837
|
+
// sed -i "$line_number s,.*,$new_text," "$file"
|
|
838
|
+
// sed -i "$line_number c \\$new_text" "$file"
|
|
839
|
+
const dep = fs.readFileSync(`./node_modules/peer/dist/module.mjs`, 'utf8');
|
|
840
|
+
const errorLine = `import {WebSocketServer as $hSjDC$WebSocketServer} from "ws";`;
|
|
841
|
+
|
|
842
|
+
fs.writeFileSync(
|
|
843
|
+
`./node_modules/peer/dist/module.mjs`,
|
|
844
|
+
dep.replaceAll(
|
|
845
|
+
errorLine,
|
|
846
|
+
`import WebSocketServer from "ws";
|
|
847
|
+
let $hSjDC$WebSocketServer = WebSocketServer.Server;`,
|
|
848
|
+
),
|
|
849
|
+
'utf8',
|
|
850
|
+
);
|
|
851
|
+
};
|
|
852
|
+
|
|
832
853
|
export {
|
|
833
854
|
Cmd,
|
|
834
855
|
Config,
|
|
@@ -853,8 +874,8 @@ export {
|
|
|
853
874
|
getDeployGroupId,
|
|
854
875
|
execDeploy,
|
|
855
876
|
deployRun,
|
|
856
|
-
updateSrc,
|
|
857
877
|
getCronBackUpFolder,
|
|
858
878
|
getRestoreCronCmd,
|
|
859
879
|
mergeBackUp,
|
|
880
|
+
fixDependencies,
|
|
860
881
|
};
|
|
@@ -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: {
|
package/startup.js
CHANGED
package/setup.sh
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
sudo apt update
|
|
2
|
-
sudo apt upgrade
|
|
3
|
-
|
|
4
|
-
# Install the MongoDB 4.4 GPG key:
|
|
5
|
-
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
|
|
6
|
-
|
|
7
|
-
# Add the source location for the MongoDB packages:
|
|
8
|
-
# echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
|
|
9
|
-
echo "deb [ arch=arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
|
|
10
|
-
|
|
11
|
-
# Download the package details for the MongoDB packages:
|
|
12
|
-
sudo apt-get update
|
|
13
|
-
|
|
14
|
-
# Install MongoDB:
|
|
15
|
-
sudo apt-get install -y mongodb-org
|
|
16
|
-
# sudo apt-get install mongodb
|
|
17
|
-
|
|
18
|
-
# Ensure mongod config is picked up:
|
|
19
|
-
sudo systemctl daemon-reload
|
|
20
|
-
|
|
21
|
-
# Tell systemd to run mongod on reboot:
|
|
22
|
-
sudo systemctl enable mongod
|
|
23
|
-
|
|
24
|
-
# Start up mongod!
|
|
25
|
-
sudo systemctl start mongod
|