xynginc 1.0.82 → 1.0.85
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/README.md +52 -20
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -6
- package/dist/{downloadBinary.js → mods/downloadBinary.js} +10 -13
- package/dist/{ensureBinary.js → mods/ensureBinary.js} +5 -5
- package/dist/{requirements.d.ts → mods/requirements.d.ts} +1 -1
- package/dist/{validateConfig.d.ts → mods/validateConfig.d.ts} +1 -1
- package/dist/mods/validateConfig.js +53 -0
- package/dist/startPlugin.d.ts +2 -1
- package/dist/startPlugin.js +13 -4
- package/package.json +13 -10
- package/xypriss.config.jsonc +7 -0
- package/xypriss.plugin.xsig +4 -4
- package/dist/validateConfig.js +0 -33
- /package/dist/{constant.d.ts → mods/constant.d.ts} +0 -0
- /package/dist/{constant.js → mods/constant.js} +0 -0
- /package/dist/{downloadBinary.d.ts → mods/downloadBinary.d.ts} +0 -0
- /package/dist/{ensureBinary.d.ts → mods/ensureBinary.d.ts} +0 -0
- /package/dist/{execAsync.d.ts → mods/execAsync.d.ts} +0 -0
- /package/dist/{execAsync.js → mods/execAsync.js} +0 -0
- /package/dist/{logger.d.ts → mods/logger.d.ts} +0 -0
- /package/dist/{logger.js → mods/logger.js} +0 -0
- /package/dist/{requirements.js → mods/requirements.js} +0 -0
package/README.md
CHANGED
|
@@ -4,13 +4,19 @@ This project uses code developed by NEHONIX (www.nehonix.com) under the NEHONIX
|
|
|
4
4
|
|
|
5
5
|
XyPriss Nginx Controller - Simplifie la gestion de Nginx et SSL.
|
|
6
6
|
|
|
7
|
-
[](https://www.npmjs.com/package/xynginc)
|
|
8
8
|
[](https://dll.nehonix.com/licenses/NOSL)
|
|
9
9
|
|
|
10
10
|
## Overview
|
|
11
11
|
|
|
12
12
|
XyNginC (XyPriss Nginx Controller) automates Nginx reverse proxy configuration, SSL certificate management, and provides optimized, production-ready configs for security, performance, and best practices. It eliminates manual Nginx editing, simplifying XyPriss deployment to just a few lines of TypeScript. Check out the [demo project on GitHub](https://github.com/iDevo-ll/XYNC-Demo).
|
|
13
13
|
|
|
14
|
+
> [!IMPORTANT]
|
|
15
|
+
> XyNginC is a plugin **exclusively designed for XyPriss projects**. It is not intended for use outside the XyPriss ecosystem, in development environments, or on non-Linux systems. For the best integration experience, **XFPM** (XyPriss Fast Package Manager) is required — see [Installation](#installation).
|
|
16
|
+
|
|
17
|
+
> [!CAUTION]
|
|
18
|
+
> XyNginC only runs on **Linux production servers** (VPS or Dedicated). Supported architectures: **x64**, **arm64**, and **ia32**. Windows and macOS are not supported.
|
|
19
|
+
|
|
14
20
|
## Key Features
|
|
15
21
|
|
|
16
22
|
- **Automated Reverse Proxy**: Maps domains to local ports seamlessly.
|
|
@@ -26,7 +32,28 @@ XyNginC (XyPriss Nginx Controller) automates Nginx reverse proxy configuration,
|
|
|
26
32
|
For detailed installation instructions, please refer to the [Installation Guide](docs/INSTALLATION.md).
|
|
27
33
|
For building from source (custom architectures), see the [Build Guide](docs/BUILD_FROM_SOURCE.md).
|
|
28
34
|
|
|
29
|
-
XyNginC is designed for
|
|
35
|
+
XyNginC is exclusively designed for **XyPriss projects running in production on Linux**. We strongly recommend using Ubuntu on a Virtual Private Server (VPS) for the best security and stability.
|
|
36
|
+
|
|
37
|
+
### Prerequisites
|
|
38
|
+
|
|
39
|
+
Before installing XyNginC, you need **XFPM** — the official package manager for the XyPriss ecosystem.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
curl -fsSL https://raw.githubusercontent.com/Nehonix-Team/XFPM/master/scripts/install.sh | sudo bash
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
xfpm --version
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Install XyNginC
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
xfpm install xynginc
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> [!NOTE]
|
|
56
|
+
> The installation requires `sudo` privileges to place the binary in `/usr/local/bin` and configure system permissions.
|
|
30
57
|
|
|
31
58
|
## Quick Start
|
|
32
59
|
|
|
@@ -92,7 +119,7 @@ XNCP({
|
|
|
92
119
|
Manage domains programmatically at runtime:
|
|
93
120
|
|
|
94
121
|
```typescript
|
|
95
|
-
app.start(
|
|
122
|
+
app.start(async () => {
|
|
96
123
|
// Add a new domain
|
|
97
124
|
await app.xynginc.addDomain(
|
|
98
125
|
"new.example.com",
|
|
@@ -181,7 +208,7 @@ await server.xynginc.status(): Promise<string>
|
|
|
181
208
|
|
|
182
209
|
## CLI Usage
|
|
183
210
|
|
|
184
|
-
The `xynginc` command-line interface allows for direct management without the
|
|
211
|
+
The `xynginc` command-line interface allows for direct management without the XyPriss application context.
|
|
185
212
|
|
|
186
213
|
```bash
|
|
187
214
|
# Check prerequisites
|
|
@@ -230,9 +257,9 @@ sudo xynginc status
|
|
|
230
257
|
|
|
231
258
|
The system operates through a three-tier architecture:
|
|
232
259
|
|
|
233
|
-
1.
|
|
234
|
-
2.
|
|
235
|
-
3.
|
|
260
|
+
1. **XyPriss Application**: The XyPriss application running the server.
|
|
261
|
+
2. **XyNginC Plugin**: A TypeScript wrapper that interfaces with the application and executes the underlying Go binary.
|
|
262
|
+
3. **XyNginC Go Binary**: A high-performance Go-based CLI tool that performs system-level operations (Nginx configuration, Certbot execution). It dynamically fetches the latest config templates from GitHub (`Nehonix-Team/xynginc`) to guarantee up-to-date and optimized Nginx setups.
|
|
236
263
|
|
|
237
264
|
## Security Considerations
|
|
238
265
|
|
|
@@ -243,7 +270,8 @@ XyNginC requires elevated privileges to perform the following actions:
|
|
|
243
270
|
- Executing `certbot` for SSL certificate generation
|
|
244
271
|
- Reloading the Nginx service
|
|
245
272
|
|
|
246
|
-
|
|
273
|
+
> [!WARNING]
|
|
274
|
+
> XyNginC requires elevated privileges to manage Nginx and firewall rules. Always review the commands being executed and restrict sudo access to only what is necessary.
|
|
247
275
|
|
|
248
276
|
- **Sudoers**: We recommend configuring `sudoers` to allow specific commands for the user.
|
|
249
277
|
- **Sudo Password**: If your application runs in the background (e.g. using PM2), you can use the `sudoPassword` option or the `SUDO_PASSWORD` environment variable.
|
|
@@ -257,8 +285,8 @@ XyNginC requires elevated privileges to perform the following actions:
|
|
|
257
285
|
If the binary fails to download automatically:
|
|
258
286
|
|
|
259
287
|
```bash
|
|
260
|
-
# Manually trigger
|
|
261
|
-
|
|
288
|
+
# Manually trigger with XFPM
|
|
289
|
+
xfpm run postinstall
|
|
262
290
|
|
|
263
291
|
# Or specify the path manually in options
|
|
264
292
|
XNCP({
|
|
@@ -280,21 +308,25 @@ sudo node server.js
|
|
|
280
308
|
|
|
281
309
|
If SSL generation fails:
|
|
282
310
|
|
|
283
|
-
1.
|
|
284
|
-
2.
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
311
|
+
1. Verify DNS propagation: `dig api.example.com`
|
|
312
|
+
2. Ensure firewall allows traffic on ports 80 and 443:
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
sudo ufw allow 80
|
|
316
|
+
sudo ufw allow 443
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
> [!NOTE]
|
|
320
|
+
> Certbot requires ports 80 and 443 to be publicly accessible for domain validation. Make sure your cloud provider's security groups also allow this traffic, not just UFW.
|
|
289
321
|
|
|
290
322
|
## Contributing
|
|
291
323
|
|
|
292
324
|
Contributions are welcome. Please follow the standard pull request process.
|
|
293
325
|
|
|
294
|
-
1.
|
|
295
|
-
2.
|
|
296
|
-
3.
|
|
297
|
-
4.
|
|
326
|
+
1. Clone the repository
|
|
327
|
+
2. Install dependencies
|
|
328
|
+
3. Build the Go CLI and TypeScript package (`xfpm run build:all`)
|
|
329
|
+
4. Run tests
|
|
298
330
|
|
|
299
331
|
## License
|
|
300
332
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { Plugin } from "xypriss";
|
|
1
2
|
import { XyNginCConfig, XyNginCDomainConfig, XyNginCPluginOptions } from "./types";
|
|
3
|
+
export type PlC = Parameters<typeof Plugin.create>[0];
|
|
4
|
+
export type PluginServer = Parameters<NonNullable<PlC["onServerStart"]>>[0];
|
|
2
5
|
/**
|
|
3
6
|
* XyNginC Plugin for XyPriss.
|
|
4
7
|
* Automates Nginx and SSL management for your server.
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Licensed under NEHONIX Open Source License (NOSL) v1.0
|
|
5
5
|
*/
|
|
6
6
|
import { Plugin } from "xypriss";
|
|
7
|
-
import { Logger } from "./logger";
|
|
8
|
-
import { validateConfig } from "./validateConfig";
|
|
7
|
+
import { Logger } from "./mods/logger";
|
|
8
|
+
import { validateConfig } from "./mods/validateConfig";
|
|
9
9
|
import { startXNCPlugin } from "./startPlugin";
|
|
10
10
|
/**
|
|
11
11
|
* XyNginC Plugin for XyPriss.
|
|
@@ -16,11 +16,11 @@ import { startXNCPlugin } from "./startPlugin";
|
|
|
16
16
|
*/
|
|
17
17
|
export default function XNCP(options) {
|
|
18
18
|
const { domains, autoReload = true, autoFixFirewall = false, binaryPath, autoDownload = true, version = "latest", installRequirements = true, sudoPassword, } = options;
|
|
19
|
-
const
|
|
19
|
+
const pkg = Plugin.manifest(__sys__);
|
|
20
20
|
return Plugin.create({
|
|
21
|
-
name:
|
|
22
|
-
version:
|
|
23
|
-
description:
|
|
21
|
+
name: pkg.name,
|
|
22
|
+
version: pkg.version,
|
|
23
|
+
description: pkg.description,
|
|
24
24
|
onRegister: async (_server) => {
|
|
25
25
|
Logger.info("[XyNginC] Registering plugin...");
|
|
26
26
|
validateConfig({ domains, autoReload, autoFixFirewall });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Logger } from "./logger";
|
|
2
2
|
import * as https from "https";
|
|
3
|
-
import * as fs from "fs";
|
|
4
|
-
import * as path from "path";
|
|
5
|
-
import * as os from "os";
|
|
6
3
|
import { BINARY_NAME, BINARY_DIR, GITHUB_REPO } from "./constant";
|
|
4
|
+
import { __strl__ } from "strulink";
|
|
5
|
+
const fs = __sys__.fs;
|
|
6
|
+
const path = __sys__.path;
|
|
7
7
|
/**
|
|
8
8
|
* Downloads the xynginc binary from GitHub releases.
|
|
9
9
|
*
|
|
@@ -11,8 +11,8 @@ import { BINARY_NAME, BINARY_DIR, GITHUB_REPO } from "./constant";
|
|
|
11
11
|
* @returns The path to the downloaded binary.
|
|
12
12
|
*/
|
|
13
13
|
export async function downloadBinary(version) {
|
|
14
|
-
const platform = os.platform();
|
|
15
|
-
const arch = os.arch();
|
|
14
|
+
const platform = __sys__.os.platform();
|
|
15
|
+
const arch = __sys__.os.arch();
|
|
16
16
|
if (platform !== "linux") {
|
|
17
17
|
throw new Error(`[XyNginC] Unsupported platform: ${platform}. Only Linux is supported.`);
|
|
18
18
|
}
|
|
@@ -20,11 +20,9 @@ export async function downloadBinary(version) {
|
|
|
20
20
|
const downloadUrl = version === "latest"
|
|
21
21
|
? `https://github.com/${GITHUB_REPO}/releases/latest/download/${binaryName}`
|
|
22
22
|
: `https://github.com/${GITHUB_REPO}/releases/download/${version}/${binaryName}`;
|
|
23
|
-
Logger.info(`[XyNginC] Downloading from: ${downloadUrl}`);
|
|
23
|
+
Logger.info(`[XyNginC] Downloading from: ${__strl__.createUrl(downloadUrl).hostname}`);
|
|
24
24
|
// Create bin directory
|
|
25
|
-
|
|
26
|
-
fs.mkdirSync(BINARY_DIR, { recursive: true });
|
|
27
|
-
}
|
|
25
|
+
fs.writeIfNotExistsSync(BINARY_DIR, { recursive: true });
|
|
28
26
|
const localPath = path.join(BINARY_DIR, BINARY_NAME);
|
|
29
27
|
return new Promise((resolve, reject) => {
|
|
30
28
|
function download(url) {
|
|
@@ -44,15 +42,14 @@ export async function downloadBinary(version) {
|
|
|
44
42
|
const file = fs.createWriteStream(localPath);
|
|
45
43
|
response.pipe(file);
|
|
46
44
|
file.on("finish", () => {
|
|
47
|
-
file.close();
|
|
48
|
-
fs.
|
|
45
|
+
file.close(); //
|
|
46
|
+
fs.chmod(localPath, "755"); // Make executable (octal version: 0o755)
|
|
49
47
|
Logger.success("[XyNginC] ✓ Binary downloaded successfully");
|
|
50
48
|
resolve(localPath);
|
|
51
49
|
});
|
|
52
50
|
})
|
|
53
51
|
.on("error", (err) => {
|
|
54
|
-
|
|
55
|
-
fs.unlinkSync(localPath);
|
|
52
|
+
fs.rmIfExists(localPath);
|
|
56
53
|
reject(err);
|
|
57
54
|
});
|
|
58
55
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
1
|
import { Logger } from "./logger";
|
|
4
2
|
import { execAsync } from "./execAsync";
|
|
5
3
|
import { BINARY_DIR, BINARY_NAME } from "./constant";
|
|
6
4
|
import { downloadBinary } from "./downloadBinary";
|
|
5
|
+
const fs = __sys__.fs;
|
|
6
|
+
const path = __sys__.path;
|
|
7
7
|
/**
|
|
8
8
|
* Ensures the xynginc binary exists.
|
|
9
9
|
* It checks the custom path, the system PATH, and the local bin directory.
|
|
@@ -16,14 +16,14 @@ import { downloadBinary } from "./downloadBinary";
|
|
|
16
16
|
*/
|
|
17
17
|
export async function ensureBinary(customPath, autoDownload, version) {
|
|
18
18
|
// 1. Try custom path
|
|
19
|
-
if (customPath && fs.
|
|
19
|
+
if (customPath && fs.exists(customPath)) {
|
|
20
20
|
return customPath;
|
|
21
21
|
}
|
|
22
22
|
// 2. Try PATH
|
|
23
23
|
try {
|
|
24
24
|
const { stdout } = await execAsync("which xynginc");
|
|
25
25
|
const globalPath = stdout.trim();
|
|
26
|
-
if (globalPath && fs.
|
|
26
|
+
if (globalPath && fs.exists(globalPath)) {
|
|
27
27
|
return globalPath;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -32,7 +32,7 @@ export async function ensureBinary(customPath, autoDownload, version) {
|
|
|
32
32
|
}
|
|
33
33
|
// 3. Try local bin directory
|
|
34
34
|
const localPath = path.join(BINARY_DIR, BINARY_NAME);
|
|
35
|
-
if (fs.
|
|
35
|
+
if (fs.exists(localPath)) {
|
|
36
36
|
return localPath;
|
|
37
37
|
}
|
|
38
38
|
// 4. Auto-download if enabled
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { __strl__ } from "strulink";
|
|
2
|
+
import { Interface } from "reliant-type";
|
|
3
|
+
/**
|
|
4
|
+
* Validates the plugin configuration.
|
|
5
|
+
*
|
|
6
|
+
* @param config - The configuration to validate.
|
|
7
|
+
* @throws Error if the configuration is invalid.
|
|
8
|
+
*/
|
|
9
|
+
export function validateConfig(config) {
|
|
10
|
+
const d = config.domains;
|
|
11
|
+
if (!d || d.length === 0) {
|
|
12
|
+
throw new Error("[XyNginC] Configuration error: 'domains' array cannot be empty");
|
|
13
|
+
}
|
|
14
|
+
for (const d2 of d) {
|
|
15
|
+
if (!d2.domain || typeof d2.domain !== "string") {
|
|
16
|
+
throw new Error("[XyNginC] Configuration error: 'domain' must be a non-empty string");
|
|
17
|
+
}
|
|
18
|
+
const vd = __strl__.checkUrl(d2.domain, { requireProtocol: false });
|
|
19
|
+
if (!vd.isValid) {
|
|
20
|
+
const EDOMAIN = vd?.validationDetails?.domain;
|
|
21
|
+
if (EDOMAIN) {
|
|
22
|
+
console.error("[XYNGINC::STRULINK:EDOMAIN]: ", EDOMAIN);
|
|
23
|
+
throw new Error("[XYNGINC::STRULINK:EDOMAIN]" + vd?.cause);
|
|
24
|
+
}
|
|
25
|
+
throw new Error(vd?.cause);
|
|
26
|
+
}
|
|
27
|
+
if (!d2.port ||
|
|
28
|
+
typeof d2.port !== "number" ||
|
|
29
|
+
d2.port < 1 ||
|
|
30
|
+
d2.port > 65535) {
|
|
31
|
+
throw new Error(`[XyNginC] Configuration error: 'port' must be between 1-65535 for ${d2.domain}`);
|
|
32
|
+
}
|
|
33
|
+
if (d2.ssl && !d2.email) {
|
|
34
|
+
throw new Error(`[XyNginC] Configuration error: 'email' is required when SSL is enabled for ${d2.domain}`);
|
|
35
|
+
}
|
|
36
|
+
const emailInterface = Interface({
|
|
37
|
+
email: "email",
|
|
38
|
+
});
|
|
39
|
+
const vmail = emailInterface.safeParse({ email: d2.email || "" });
|
|
40
|
+
if (!vmail.success) {
|
|
41
|
+
console.error(vmail.errors.join("\n"));
|
|
42
|
+
throw new Error(`[XyNginC] Configuration error: 'email' is invalid for ${d2.domain}`);
|
|
43
|
+
}
|
|
44
|
+
// Set default host to localhost if not provided
|
|
45
|
+
if (!d2.host) {
|
|
46
|
+
d2.host = "localhost";
|
|
47
|
+
}
|
|
48
|
+
// Set default maxBodySize if not provided
|
|
49
|
+
if (!d2.maxBodySize) {
|
|
50
|
+
d2.maxBodySize = "20M";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
package/dist/startPlugin.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { PluginServer } from ".";
|
|
1
2
|
import { XyNginCDomainConfig } from "./types";
|
|
2
|
-
export declare function startXNCPlugin(server:
|
|
3
|
+
export declare function startXNCPlugin(server: PluginServer, options: {
|
|
3
4
|
binaryPath?: string;
|
|
4
5
|
autoDownload: boolean;
|
|
5
6
|
version: string;
|
package/dist/startPlugin.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ensureBinary } from "./ensureBinary";
|
|
2
|
-
import { Logger } from "./logger";
|
|
3
|
-
import { addDomain, applyConfig, checkRequirements, getStatus, installRequirementsHandler, listDomains, reloadNginx, removeDomain, testNginx, } from "./requirements";
|
|
1
|
+
import { ensureBinary } from "./mods/ensureBinary";
|
|
2
|
+
import { Logger } from "./mods/logger";
|
|
3
|
+
import { addDomain, applyConfig, checkRequirements, getStatus, installRequirementsHandler, listDomains, reloadNginx, removeDomain, testNginx, } from "./mods/requirements";
|
|
4
4
|
const getSudo = (sudoPassword) => {
|
|
5
5
|
// Attempt multiple ways to get the password, including XyPriss internal env if somehow exposed
|
|
6
|
-
const envPwd =
|
|
6
|
+
const envPwd = __sys__.__env__.get("SUDO_PASSWORD");
|
|
7
7
|
// || (global as any).__sys__?.$env?.("SUDO_PASSWORD");
|
|
8
8
|
const pwd = sudoPassword || envPwd;
|
|
9
9
|
if (pwd) {
|
|
@@ -23,10 +23,19 @@ const getSudo = (sudoPassword) => {
|
|
|
23
23
|
export async function startXNCPlugin(server, options) {
|
|
24
24
|
const { binaryPath, autoDownload, version, domains, autoReload, autoFixFirewall, installRequirements, sudoPassword, } = options;
|
|
25
25
|
Logger.info("[XyNginC] Initializing Nginx Controller...");
|
|
26
|
+
if (!sudoPassword) {
|
|
27
|
+
Logger.warn("[XyNginC] To ensure optimal performance and prevent potential issues, it is recommended to provide your system sudo password.");
|
|
28
|
+
Logger.info("[XyNginC] Security notice: The password is used solely for privileged communication with your operating system. It is never stored, logged, or transmitted externally.");
|
|
29
|
+
}
|
|
26
30
|
try {
|
|
27
31
|
// 1. Ensure binary exists
|
|
28
32
|
const binary = await ensureBinary(binaryPath, autoDownload, version);
|
|
29
33
|
Logger.success(`[XyNginC] ✓ Binary located: ${binary}`);
|
|
34
|
+
__sys__.vars.update({
|
|
35
|
+
xynginc: {
|
|
36
|
+
binary,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
30
39
|
// 2. Check system requirements
|
|
31
40
|
Logger.info("[XyNginC] Checking system requirements...");
|
|
32
41
|
// Check if requirements are satisfied
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xynginc",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "XyPriss Nginx Controller - Automatic Nginx
|
|
3
|
+
"version": "1.0.85",
|
|
4
|
+
"description": "XyPriss Nginx Controller - Automatic Nginx \u0026 SSL management for XyPriss servers",
|
|
5
5
|
"author": "Seth Eleazar - iDevo",
|
|
6
6
|
"license": "NOSL",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -10,13 +10,14 @@
|
|
|
10
10
|
"dist",
|
|
11
11
|
"scripts",
|
|
12
12
|
"README.md",
|
|
13
|
-
"xypriss.plugin.xsig"
|
|
13
|
+
"xypriss.plugin.xsig",
|
|
14
|
+
"xypriss.config.jsonc"
|
|
14
15
|
],
|
|
15
16
|
"bin": {
|
|
16
17
|
"xynginc": "./bin/xynginc"
|
|
17
18
|
},
|
|
18
19
|
"engines": {
|
|
19
|
-
"node": "
|
|
20
|
+
"node": "\u003e=18.0.0"
|
|
20
21
|
},
|
|
21
22
|
"repository": {
|
|
22
23
|
"type": "git",
|
|
@@ -32,17 +33,19 @@
|
|
|
32
33
|
"plugin"
|
|
33
34
|
],
|
|
34
35
|
"scripts": {
|
|
35
|
-
"build": "tsc
|
|
36
|
-
"build:all": "xfpm run build:go
|
|
37
|
-
"build:go": "cd core-go
|
|
36
|
+
"build": "tsc \u0026\u0026 xfpm run build:multi",
|
|
37
|
+
"build:all": "xfpm run build:go \u0026\u0026 xfpm run build",
|
|
38
|
+
"build:go": "cd core-go \u0026\u0026 go build -o xynginc \u0026\u0026 cp xynginc ../bin/",
|
|
38
39
|
"build:multi": "bash scripts/build.sh",
|
|
39
40
|
"dev": "tsc --watch",
|
|
40
41
|
"install:manual": "sudo bash scripts/install.sh",
|
|
41
42
|
"postinstall": "node scripts/postinstall.js",
|
|
42
|
-
"prepublishOnly": "xfpm run build
|
|
43
|
+
"prepublishOnly": "xfpm run build \u0026\u0026 xfpm sign ./ --min-version 1.0.81 --fix"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
45
|
-
"
|
|
46
|
+
"reliant-type": "^2.1.5",
|
|
47
|
+
"strulink": "^1.2.0",
|
|
48
|
+
"xypriss": "^9.9.5",
|
|
46
49
|
"xypriss-security": "^2.1.16"
|
|
47
50
|
},
|
|
48
51
|
"devDependencies": {
|
|
@@ -55,4 +58,4 @@
|
|
|
55
58
|
"XHS.HOOK.LIFECYCLE.SERVER_READY"
|
|
56
59
|
]
|
|
57
60
|
}
|
|
58
|
-
}
|
|
61
|
+
}
|
package/xypriss.plugin.xsig
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- XYPRISS SIGNATURE (G3) ---
|
|
2
|
-
Manifest: xynginc@1.0.
|
|
2
|
+
Manifest: xynginc@1.0.85
|
|
3
3
|
Min-Engine: 1.0.81
|
|
4
|
-
Fingerprint: sha256:
|
|
4
|
+
Fingerprint: sha256:bb6ea669ad840648968355d3deb2ad767b4e3867029bd28935337d44dae87002
|
|
5
5
|
Identity: ed25519:a58b17a3e46302dd3ae5538bc9b8b991c57f4c5fe2e7d8ac41803de818d947f4
|
|
6
6
|
Privileges: XHS.HOOK.HTTP.REQUEST,XHS.HOOK.LIFECYCLE.SERVER_READY
|
|
7
|
-
Expires: 2027-04-
|
|
7
|
+
Expires: 2027-04-28T13:46:27Z
|
|
8
8
|
Revision: sha256:none
|
|
9
9
|
--- BEGIN CRYPTOGRAPHIC PROOF ---
|
|
10
|
-
base64
|
|
10
|
+
base64:LxbunS3M7aPEOokSUj69R9Ht2nSWB8TLzAiVWAwB4tD3BhGgkTAUZW47ULmzibDaTDeclleLSMHiFa3bpvXXDA==
|
|
11
11
|
--- END XYPRISS SIGNATURE ---
|
package/dist/validateConfig.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validates the plugin configuration.
|
|
3
|
-
*
|
|
4
|
-
* @param config - The configuration to validate.
|
|
5
|
-
* @throws Error if the configuration is invalid.
|
|
6
|
-
*/
|
|
7
|
-
export function validateConfig(config) {
|
|
8
|
-
if (!config.domains || config.domains.length === 0) {
|
|
9
|
-
throw new Error("[XyNginC] Configuration error: 'domains' array cannot be empty");
|
|
10
|
-
}
|
|
11
|
-
for (const domain of config.domains) {
|
|
12
|
-
if (!domain.domain || typeof domain.domain !== "string") {
|
|
13
|
-
throw new Error("[XyNginC] Configuration error: 'domain' must be a non-empty string");
|
|
14
|
-
}
|
|
15
|
-
if (!domain.port ||
|
|
16
|
-
typeof domain.port !== "number" ||
|
|
17
|
-
domain.port < 1 ||
|
|
18
|
-
domain.port > 65535) {
|
|
19
|
-
throw new Error(`[XyNginC] Configuration error: 'port' must be between 1-65535 for ${domain.domain}`);
|
|
20
|
-
}
|
|
21
|
-
if (domain.ssl && !domain.email) {
|
|
22
|
-
throw new Error(`[XyNginC] Configuration error: 'email' is required when SSL is enabled for ${domain.domain}`);
|
|
23
|
-
}
|
|
24
|
-
// Set default host to localhost if not provided
|
|
25
|
-
if (!domain.host) {
|
|
26
|
-
domain.host = "localhost";
|
|
27
|
-
}
|
|
28
|
-
// Set default maxBodySize if not provided
|
|
29
|
-
if (!domain.maxBodySize) {
|
|
30
|
-
domain.maxBodySize = "20M";
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|