underpost 2.8.885 → 2.81.0
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.production +3 -0
- package/.github/workflows/ghpkg.ci.yml +1 -1
- package/.github/workflows/npmpkg.ci.yml +1 -1
- package/.github/workflows/publish.ci.yml +5 -5
- package/.github/workflows/pwa-microservices-template-page.cd.yml +1 -1
- package/.github/workflows/pwa-microservices-template-test.ci.yml +1 -1
- package/.vscode/zed.keymap.json +17 -0
- package/.vscode/zed.settings.json +20 -0
- package/CHANGELOG.md +145 -1
- package/Dockerfile +20 -3
- package/README.md +6 -6
- package/bin/build.js +18 -9
- package/bin/deploy.js +130 -195
- package/bin/zed.js +20 -0
- package/cli.md +13 -7
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +50 -50
- package/manifests/deployment/dd-test-development/proxy.yaml +4 -4
- package/manifests/lxd/underpost-setup.sh +5 -5
- package/package.json +3 -4
- package/{manifests/maas → scripts}/ssh-cluster-info.sh +1 -1
- package/scripts/ssl.sh +164 -0
- package/src/cli/baremetal.js +8 -8
- package/src/cli/cloud-init.js +1 -1
- package/src/cli/cluster.js +15 -4
- package/src/cli/cron.js +1 -1
- package/src/cli/db.js +2 -1
- package/src/cli/deploy.js +65 -14
- package/src/cli/fs.js +2 -2
- package/src/cli/image.js +19 -2
- package/src/cli/index.js +11 -4
- package/src/cli/monitor.js +34 -1
- package/src/cli/repository.js +42 -1
- package/src/cli/run.js +396 -86
- package/src/cli/script.js +32 -0
- package/src/cli/secrets.js +34 -0
- package/src/cli/test.js +42 -1
- package/src/client/components/core/Css.js +0 -8
- package/src/client/components/core/windowGetDimensions.js +229 -162
- package/src/index.js +2 -2
- package/src/mailer/MailerProvider.js +1 -0
- package/src/runtime/express/Dockerfile +41 -0
- package/src/runtime/express/Express.js +12 -4
- package/src/runtime/lampp/Dockerfile +1 -1
- package/src/server/backup.js +20 -0
- package/src/server/client-build-live.js +12 -10
- package/src/server/client-build.js +136 -91
- package/src/server/client-dev-server.js +16 -2
- package/src/server/client-icons.js +19 -0
- package/src/server/conf.js +495 -69
- package/src/server/dns.js +169 -46
- package/src/server/downloader.js +65 -24
- package/src/server/object-layer.js +260 -162
- package/src/server/peer.js +2 -8
- package/src/server/proxy.js +93 -76
- package/src/server/runtime.js +15 -16
- package/src/server/ssr.js +4 -4
- package/src/server/tls.js +251 -0
- package/src/server/valkey.js +11 -10
- package/src/ws/IoInterface.js +2 -1
- package/src/ws/IoServer.js +2 -1
- package/src/ws/core/core.ws.connection.js +1 -1
- package/src/ws/core/core.ws.emit.js +1 -1
- package/src/ws/core/core.ws.server.js +1 -1
- package/manifests/maas/lxd-preseed.yaml +0 -32
- package/src/server/ssl.js +0 -108
- /package/{manifests/maas → scripts}/device-scan.sh +0 -0
- /package/{manifests/maas → scripts}/gpu-diag.sh +0 -0
- /package/{manifests/maas → scripts}/maas-setup.sh +0 -0
- /package/{manifests/maas → scripts}/nat-iptables.sh +0 -0
- /package/{manifests/maas → scripts}/nvim.sh +0 -0
- /package/{manifests/maas → scripts}/snap-clean.sh +0 -0
package/src/ws/IoServer.js
CHANGED
|
@@ -15,7 +15,7 @@ import http from 'http';
|
|
|
15
15
|
const logger = loggerFactory(import.meta);
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* @class
|
|
18
|
+
* @class IoServerClass
|
|
19
19
|
* @alias IoServerClass
|
|
20
20
|
* @memberof SocketIoServer
|
|
21
21
|
* @classdesc Provides a static factory method to create and configure a Socket.IO server,
|
|
@@ -37,6 +37,7 @@ class IoServerClass {
|
|
|
37
37
|
* @returns {object} return.meta - The module's import meta object (`import.meta`).
|
|
38
38
|
*/
|
|
39
39
|
static create(httpServer, options = {}, ConnectionHandler = () => {}) {
|
|
40
|
+
logger.info('origins', options.origins);
|
|
40
41
|
const wsOptions = {
|
|
41
42
|
cors: {
|
|
42
43
|
origins: options.origins,
|
|
@@ -13,7 +13,7 @@ import { Socket } from 'socket.io'; // Added for JSDoc type hinting
|
|
|
13
13
|
const logger = loggerFactory(import.meta);
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* @class
|
|
16
|
+
* @class CoreWsConnectionManager
|
|
17
17
|
* @alias CoreWsConnectionManager
|
|
18
18
|
* @memberof CoreWsConnection
|
|
19
19
|
* @classdesc Manages the lifecycle of a new WebSocket connection, setting up listeners for
|
|
@@ -10,7 +10,7 @@ import { Socket } from 'socket.io';
|
|
|
10
10
|
const logger = loggerFactory(import.meta);
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* @class
|
|
13
|
+
* @class CoreWsEmitter
|
|
14
14
|
* @alias CoreWsEmitter
|
|
15
15
|
* @memberof CoreWsEmitter
|
|
16
16
|
* @classdesc Provides a static utility method for safely emitting messages over a WebSocket connection.
|
|
@@ -16,7 +16,7 @@ import http from 'http'; // Added for JSDoc type hinting
|
|
|
16
16
|
// https://socket.io/docs/v3/
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* @class
|
|
19
|
+
* @class CoreWsServerClass
|
|
20
20
|
* @alias CoreWsServerClass
|
|
21
21
|
* @memberof CoreWsServer
|
|
22
22
|
* @classdesc Manages the creation and initialization of the main WebSocket server,
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
config:
|
|
2
|
-
core.https_address: "[::]:8443"
|
|
3
|
-
# core.trust_password: password
|
|
4
|
-
networks:
|
|
5
|
-
- config:
|
|
6
|
-
ipv4.address: 10.10.10.1/24
|
|
7
|
-
ipv6.address: none
|
|
8
|
-
description: ""
|
|
9
|
-
name: lxdbr0
|
|
10
|
-
type: ""
|
|
11
|
-
project: default
|
|
12
|
-
storage_pools:
|
|
13
|
-
- config:
|
|
14
|
-
size: 500GB
|
|
15
|
-
description: ""
|
|
16
|
-
name: default
|
|
17
|
-
driver: zfs
|
|
18
|
-
profiles:
|
|
19
|
-
- config: {}
|
|
20
|
-
description: ""
|
|
21
|
-
devices:
|
|
22
|
-
eth0:
|
|
23
|
-
name: eth0
|
|
24
|
-
network: lxdbr0
|
|
25
|
-
type: nic
|
|
26
|
-
root:
|
|
27
|
-
path: /
|
|
28
|
-
pool: default
|
|
29
|
-
type: disk
|
|
30
|
-
name: default
|
|
31
|
-
projects: []
|
|
32
|
-
cluster: null
|
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
|