update
This commit is contained in:
parent
186e94c1a2
commit
e7174e8630
4
cli.child.js
Normal file
4
cli.child.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
process.env.CLI_CALL = 'true';
|
||||||
|
import * as cliTool from './ts/index.js';
|
||||||
|
cliTool.runCli();
|
@ -20,7 +20,7 @@
|
|||||||
"@git.zone/tsrun": "^1.2.8",
|
"@git.zone/tsrun": "^1.2.8",
|
||||||
"@git.zone/tstest": "^1.9.0",
|
"@git.zone/tstest": "^1.9.0",
|
||||||
"@git.zone/tswatch": "^2.0.1",
|
"@git.zone/tswatch": "^2.0.1",
|
||||||
"@types/node": "^22.15.18"
|
"@types/node": "^22.15.19"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@api.global/typedrequest": "^3.0.19",
|
"@api.global/typedrequest": "^3.0.19",
|
||||||
@ -29,7 +29,7 @@
|
|||||||
"@apiclient.xyz/cloudflare": "^6.4.1",
|
"@apiclient.xyz/cloudflare": "^6.4.1",
|
||||||
"@push.rocks/projectinfo": "^5.0.1",
|
"@push.rocks/projectinfo": "^5.0.1",
|
||||||
"@push.rocks/qenv": "^6.1.0",
|
"@push.rocks/qenv": "^6.1.0",
|
||||||
"@push.rocks/smartacme": "^7.3.3",
|
"@push.rocks/smartacme": "^8.0.0",
|
||||||
"@push.rocks/smartdata": "^5.15.1",
|
"@push.rocks/smartdata": "^5.15.1",
|
||||||
"@push.rocks/smartdns": "^6.2.2",
|
"@push.rocks/smartdns": "^6.2.2",
|
||||||
"@push.rocks/smartfile": "^11.0.4",
|
"@push.rocks/smartfile": "^11.0.4",
|
||||||
@ -37,7 +37,7 @@
|
|||||||
"@push.rocks/smartmail": "^2.1.0",
|
"@push.rocks/smartmail": "^2.1.0",
|
||||||
"@push.rocks/smartpath": "^5.0.5",
|
"@push.rocks/smartpath": "^5.0.5",
|
||||||
"@push.rocks/smartpromise": "^4.0.3",
|
"@push.rocks/smartpromise": "^4.0.3",
|
||||||
"@push.rocks/smartproxy": "^18.1.0",
|
"@push.rocks/smartproxy": "^19.3.3",
|
||||||
"@push.rocks/smartrequest": "^2.1.0",
|
"@push.rocks/smartrequest": "^2.1.0",
|
||||||
"@push.rocks/smartrule": "^2.0.1",
|
"@push.rocks/smartrule": "^2.0.1",
|
||||||
"@push.rocks/smartrx": "^3.0.10",
|
"@push.rocks/smartrx": "^3.0.10",
|
||||||
|
938
pnpm-lock.yaml
generated
938
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -39,6 +39,13 @@ export interface IDcRouterOptions {
|
|||||||
|
|
||||||
/** DNS server configuration */
|
/** DNS server configuration */
|
||||||
dnsServerConfig?: plugins.smartdns.IDnsServerOptions;
|
dnsServerConfig?: plugins.smartdns.IDnsServerOptions;
|
||||||
|
|
||||||
|
/** DNS challenge configuration for ACME (optional) */
|
||||||
|
dnsChallenge?: {
|
||||||
|
/** Cloudflare API key for DNS challenges */
|
||||||
|
cloudflareApiKey?: string;
|
||||||
|
/** Other DNS providers can be added here */
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,6 +118,7 @@ export class DcRouter {
|
|||||||
* Set up SmartProxy with direct configuration and automatic email routes
|
* Set up SmartProxy with direct configuration and automatic email routes
|
||||||
*/
|
*/
|
||||||
private async setupSmartProxy(): Promise<void> {
|
private async setupSmartProxy(): Promise<void> {
|
||||||
|
console.log('[DcRouter] Setting up SmartProxy...');
|
||||||
let routes: plugins.smartproxy.IRouteConfig[] = [];
|
let routes: plugins.smartproxy.IRouteConfig[] = [];
|
||||||
let acmeConfig: plugins.smartproxy.IAcmeOptions | undefined;
|
let acmeConfig: plugins.smartproxy.IAcmeOptions | undefined;
|
||||||
|
|
||||||
@ -118,6 +126,8 @@ export class DcRouter {
|
|||||||
if (this.options.smartProxyConfig) {
|
if (this.options.smartProxyConfig) {
|
||||||
routes = this.options.smartProxyConfig.routes || [];
|
routes = this.options.smartProxyConfig.routes || [];
|
||||||
acmeConfig = this.options.smartProxyConfig.acme;
|
acmeConfig = this.options.smartProxyConfig.acme;
|
||||||
|
console.log(`[DcRouter] Found ${routes.length} routes in config`);
|
||||||
|
console.log(`[DcRouter] ACME config present: ${!!acmeConfig}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If email config exists, automatically add email routes
|
// If email config exists, automatically add email routes
|
||||||
@ -137,6 +147,15 @@ export class DcRouter {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Configure DNS challenge if available
|
||||||
|
let challengeHandlers: any[] = [];
|
||||||
|
if (this.options.dnsChallenge?.cloudflareApiKey) {
|
||||||
|
console.log('Configuring Cloudflare DNS challenge for ACME');
|
||||||
|
const cloudflareAccount = new plugins.cloudflare.CloudflareAccount(this.options.dnsChallenge.cloudflareApiKey);
|
||||||
|
const dns01Handler = new plugins.smartacme.handlers.Dns01Handler(cloudflareAccount);
|
||||||
|
challengeHandlers.push(dns01Handler);
|
||||||
|
}
|
||||||
|
|
||||||
// If we have routes or need a basic SmartProxy instance, create it
|
// If we have routes or need a basic SmartProxy instance, create it
|
||||||
if (routes.length > 0 || this.options.smartProxyConfig) {
|
if (routes.length > 0 || this.options.smartProxyConfig) {
|
||||||
console.log('Setting up SmartProxy with combined configuration');
|
console.log('Setting up SmartProxy with combined configuration');
|
||||||
@ -148,26 +167,48 @@ export class DcRouter {
|
|||||||
acme: acmeConfig
|
acme: acmeConfig
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// If we have DNS challenge handlers, enhance the config
|
||||||
|
if (challengeHandlers.length > 0) {
|
||||||
|
// We'll need to pass this to SmartProxy somehow
|
||||||
|
// For now, we'll set it as a property
|
||||||
|
(smartProxyConfig as any).acmeChallengeHandlers = challengeHandlers;
|
||||||
|
(smartProxyConfig as any).acmeChallengePriority = ['dns-01', 'http-01'];
|
||||||
|
}
|
||||||
|
|
||||||
// Create SmartProxy instance
|
// Create SmartProxy instance
|
||||||
|
console.log('[DcRouter] Creating SmartProxy instance with config:', JSON.stringify({
|
||||||
|
routeCount: smartProxyConfig.routes?.length,
|
||||||
|
acmeEnabled: smartProxyConfig.acme?.enabled,
|
||||||
|
acmeEmail: smartProxyConfig.acme?.email,
|
||||||
|
certProvisionFunction: !!smartProxyConfig.certProvisionFunction
|
||||||
|
}, null, 2));
|
||||||
|
|
||||||
this.smartProxy = new plugins.smartproxy.SmartProxy(smartProxyConfig);
|
this.smartProxy = new plugins.smartproxy.SmartProxy(smartProxyConfig);
|
||||||
|
|
||||||
// Set up event listeners
|
// Set up event listeners
|
||||||
this.smartProxy.on('error', (err) => {
|
this.smartProxy.on('error', (err) => {
|
||||||
console.error('SmartProxy error:', err);
|
console.error('[DcRouter] SmartProxy error:', err);
|
||||||
|
console.error('[DcRouter] Error stack:', err.stack);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (acmeConfig) {
|
if (acmeConfig) {
|
||||||
this.smartProxy.on('certificate-issued', (event) => {
|
this.smartProxy.on('certificate-issued', (event) => {
|
||||||
console.log(`Certificate issued for ${event.domain}, expires ${event.expiryDate}`);
|
console.log(`[DcRouter] Certificate issued for ${event.domain}, expires ${event.expiryDate}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.smartProxy.on('certificate-renewed', (event) => {
|
this.smartProxy.on('certificate-renewed', (event) => {
|
||||||
console.log(`Certificate renewed for ${event.domain}, expires ${event.expiryDate}`);
|
console.log(`[DcRouter] Certificate renewed for ${event.domain}, expires ${event.expiryDate}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.smartProxy.on('certificate-failed', (event) => {
|
||||||
|
console.error(`[DcRouter] Certificate failed for ${event.domain}:`, event.error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start SmartProxy
|
// Start SmartProxy
|
||||||
|
console.log('[DcRouter] Starting SmartProxy...');
|
||||||
await this.smartProxy.start();
|
await this.smartProxy.start();
|
||||||
|
console.log('[DcRouter] SmartProxy started successfully');
|
||||||
|
|
||||||
console.log(`SmartProxy started with ${routes.length} routes`);
|
console.log(`SmartProxy started with ${routes.length} routes`);
|
||||||
}
|
}
|
||||||
|
8
ts_web/00_commitinfo_data.js
Normal file
8
ts_web/00_commitinfo_data.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @push.rocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@serve.zone/platformservice',
|
||||||
|
version: '2.12.0',
|
||||||
|
description: 'A multifaceted platform service handling mail, SMS, letter delivery, and AI services.'
|
||||||
|
};
|
2
ts_web/index.js
Normal file
2
ts_web/index.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
console.log('minidash');
|
||||||
|
export {};
|
Loading…
x
Reference in New Issue
Block a user