underpost 2.8.884 → 2.8.886

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.
Files changed (82) hide show
  1. package/.env.production +3 -0
  2. package/.github/workflows/ghpkg.ci.yml +1 -1
  3. package/.github/workflows/npmpkg.ci.yml +1 -1
  4. package/.github/workflows/publish.ci.yml +5 -5
  5. package/.github/workflows/pwa-microservices-template-page.cd.yml +1 -1
  6. package/.github/workflows/pwa-microservices-template-test.ci.yml +1 -1
  7. package/CHANGELOG.md +145 -1
  8. package/Dockerfile +1 -1
  9. package/README.md +5 -121
  10. package/bin/build.js +18 -9
  11. package/bin/deploy.js +102 -197
  12. package/bin/file.js +4 -6
  13. package/cli.md +16 -12
  14. package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
  15. package/manifests/deployment/dd-test-development/deployment.yaml +54 -54
  16. package/manifests/deployment/dd-test-development/proxy.yaml +4 -4
  17. package/manifests/lxd/underpost-setup.sh +5 -5
  18. package/package.json +3 -3
  19. package/scripts/ssl.sh +164 -0
  20. package/src/cli/baremetal.js +7 -7
  21. package/src/cli/cloud-init.js +1 -1
  22. package/src/cli/cluster.js +31 -3
  23. package/src/cli/cron.js +9 -1
  24. package/src/cli/db.js +64 -2
  25. package/src/cli/deploy.js +189 -4
  26. package/src/cli/env.js +43 -0
  27. package/src/cli/fs.js +96 -2
  28. package/src/cli/image.js +15 -0
  29. package/src/cli/index.js +17 -4
  30. package/src/cli/monitor.js +33 -2
  31. package/src/cli/repository.js +95 -2
  32. package/src/cli/run.js +315 -51
  33. package/src/cli/script.js +32 -0
  34. package/src/cli/secrets.js +34 -0
  35. package/src/cli/test.js +42 -1
  36. package/src/client/components/core/Css.js +16 -8
  37. package/src/client/components/core/Docs.js +5 -13
  38. package/src/client/components/core/Modal.js +48 -29
  39. package/src/client/components/core/Router.js +6 -3
  40. package/src/client/components/core/Worker.js +205 -118
  41. package/src/client/components/core/windowGetDimensions.js +229 -162
  42. package/src/client/components/default/MenuDefault.js +1 -0
  43. package/src/client.dev.js +6 -3
  44. package/src/db/DataBaseProvider.js +65 -12
  45. package/src/db/mariadb/MariaDB.js +39 -6
  46. package/src/db/mongo/MongooseDB.js +51 -133
  47. package/src/index.js +2 -2
  48. package/src/mailer/EmailRender.js +58 -9
  49. package/src/mailer/MailerProvider.js +99 -25
  50. package/src/runtime/express/Express.js +32 -38
  51. package/src/runtime/lampp/Dockerfile +1 -1
  52. package/src/server/auth.js +9 -28
  53. package/src/server/backup.js +20 -0
  54. package/src/server/client-build-live.js +23 -12
  55. package/src/server/client-build.js +136 -91
  56. package/src/server/client-dev-server.js +35 -8
  57. package/src/server/client-icons.js +19 -0
  58. package/src/server/conf.js +543 -80
  59. package/src/server/dns.js +184 -42
  60. package/src/server/downloader.js +65 -24
  61. package/src/server/object-layer.js +260 -162
  62. package/src/server/peer.js +3 -9
  63. package/src/server/proxy.js +93 -76
  64. package/src/server/runtime.js +15 -21
  65. package/src/server/ssr.js +4 -4
  66. package/src/server/start.js +39 -0
  67. package/src/server/tls.js +251 -0
  68. package/src/server/valkey.js +11 -10
  69. package/src/ws/IoInterface.js +133 -39
  70. package/src/ws/IoServer.js +80 -31
  71. package/src/ws/core/core.ws.connection.js +50 -16
  72. package/src/ws/core/core.ws.emit.js +47 -8
  73. package/src/ws/core/core.ws.server.js +62 -10
  74. package/manifests/maas/lxd-preseed.yaml +0 -32
  75. package/src/server/ssl.js +0 -108
  76. /package/{manifests/maas → scripts}/device-scan.sh +0 -0
  77. /package/{manifests/maas → scripts}/gpu-diag.sh +0 -0
  78. /package/{manifests/maas → scripts}/maas-setup.sh +0 -0
  79. /package/{manifests/maas → scripts}/nat-iptables.sh +0 -0
  80. /package/{manifests/maas → scripts}/nvim.sh +0 -0
  81. /package/{manifests/maas → scripts}/snap-clean.sh +0 -0
  82. /package/{manifests/maas → scripts}/ssh-cluster-info.sh +0 -0
package/src/server/ssl.js DELETED
@@ -1,108 +0,0 @@
1
- import fs from 'fs-extra';
2
- import dotenv from 'dotenv';
3
- import https from 'https';
4
- import { loggerFactory } from './logger.js';
5
- import { range } from '../client/components/core/CommonJs.js';
6
-
7
- dotenv.config();
8
-
9
- const logger = loggerFactory(import.meta);
10
-
11
- const buildSSL = async (host) => {
12
- const sslPath = process.env.CERTBOT_LIVE_PATH;
13
- host = host.replaceAll(`\\`, '/');
14
- const [hostSSL, path] = host.split('/');
15
- if (path || !fs.existsSync(sslPath)) return;
16
- const files = await fs.readdir(sslPath);
17
-
18
- for (const folderHost of files)
19
- if (folderHost.match(host.split('/')[0]) && host.split('.')[0] === folderHost.split('.')[0]) {
20
- for (const i of [''].concat(range(1, 10))) {
21
- const privateKeyPath = `${sslPath}/${folderHost}/privkey${i}.pem`;
22
- const certificatePath = `${sslPath}/${folderHost}/cert${i}.pem`;
23
- const caPath = `${sslPath}/${folderHost}/chain${i}.pem`;
24
- const caFullPath = `${sslPath}/${folderHost}/fullchain${i}.pem`;
25
-
26
- if (
27
- fs.existsSync(privateKeyPath) &&
28
- fs.existsSync(certificatePath) &&
29
- fs.existsSync(caPath) &&
30
- fs.existsSync(caFullPath)
31
- ) {
32
- const privateKey = fs.readFileSync(privateKeyPath, 'utf8');
33
- const certificate = fs.readFileSync(certificatePath, 'utf8');
34
- const ca = fs.readFileSync(caPath, 'utf8');
35
- const caFull = fs.readFileSync(caFullPath, 'utf8');
36
-
37
- logger.info(`SSL files update`, {
38
- privateKey,
39
- certificate,
40
- ca,
41
- caFull,
42
- });
43
-
44
- if (!fs.existsSync(`./engine-private/ssl/${host}`))
45
- fs.mkdirSync(`./engine-private/ssl/${host}`, { recursive: true });
46
-
47
- fs.writeFileSync(`./engine-private/ssl/${host}/key.key`, privateKey, 'utf8');
48
- fs.writeFileSync(`./engine-private/ssl/${host}/crt.crt`, certificate, 'utf8');
49
- fs.writeFileSync(`./engine-private/ssl/${host}/ca_bundle.crt`, caFull, 'utf8');
50
-
51
- fs.writeFileSync(`./engine-private/ssl/${host}/_ca_bundle.crt`, ca, 'utf8');
52
- fs.writeFileSync(`./engine-private/ssl/${host}/_ca_full_bundle.crt`, caFull, 'utf8');
53
-
54
- return true;
55
- }
56
- }
57
- }
58
- return false;
59
- };
60
-
61
- const validateSecureContext = (host) => {
62
- return (
63
- fs.existsSync(`./engine-private/ssl/${host}/key.key`) &&
64
- fs.existsSync(`./engine-private/ssl/${host}/crt.crt`) &&
65
- fs.existsSync(`./engine-private/ssl/${host}/ca_bundle.crt`)
66
- );
67
- };
68
-
69
- const buildSecureContext = (host) => {
70
- return {
71
- key: fs.readFileSync(`./engine-private/ssl/${host}/key.key`, 'utf8'),
72
- cert: fs.readFileSync(`./engine-private/ssl/${host}/ca_bundle.crt`, 'utf8'),
73
- ca: fs.readFileSync(`./engine-private/ssl/${host}/ca_bundle.crt`, 'utf8'),
74
- };
75
- };
76
-
77
- const createSslServer = async (app, hosts) => {
78
- let ServerSSL;
79
- for (const host of Object.keys(hosts)) {
80
- // const { redirect } = hosts[host];
81
- const [hostSSL, path = ''] = host.split('/');
82
- await buildSSL(host);
83
- const validSSL = validateSecureContext(hostSSL);
84
- if (validSSL) {
85
- if (!ServerSSL) ServerSSL = https.createServer(buildSecureContext(hostSSL), app);
86
- else ServerSSL.addContext(hostSSL, buildSecureContext(hostSSL));
87
- } else logger.error('Invalid SSL context', { host, ...hosts[host] });
88
- }
89
- return { ServerSSL };
90
- };
91
-
92
- const sslRedirectMiddleware = (req, res, port, proxyRouter) => {
93
- const sslRedirectUrl = `https://${req.headers.host}${req.url}`;
94
- if (
95
- process.env.NODE_ENV === 'production' &&
96
- port !== 443 &&
97
- !req.secure &&
98
- !req.url.startsWith(`/.well-known/acme-challenge`) &&
99
- proxyRouter[443] &&
100
- Object.keys(proxyRouter[443]).find((host) => {
101
- const [hostSSL, path = ''] = host.split('/');
102
- return sslRedirectUrl.match(hostSSL) && validateSecureContext(hostSSL);
103
- })
104
- )
105
- return res.status(302).redirect(sslRedirectUrl);
106
- };
107
-
108
- export { buildSSL, buildSecureContext, validateSecureContext, createSslServer, sslRedirectMiddleware };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes