feat(rust): scaffold Rust workspace and fix TypeScript build errors
- Add @git.zone/tsrust with linux_amd64/linux_arm64 cross-compilation - Scaffold Rust workspace with 5 crates: mailer-core, mailer-smtp, mailer-security, mailer-napi, mailer-bin - Fix all TypeScript compilation errors for upgraded dependencies (smartfile v13, mailauth v4.13, smartproxy v23) - Replace smartfile.fs/memory with @push.rocks/smartfs throughout codebase - Fix .ts import extensions to .js for NodeNext module resolution - Update DKIMSignOptions usage to match mailauth v4.13 API - Add MTA error classes with permissive signatures for legacy SMTP client - Replace removed DcRouter/StorageManager/deliverability imports with local interfaces
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
import * as plugins from '../../plugins.ts';
|
||||
import * as paths from '../../paths.ts';
|
||||
import type { UnifiedEmailServer } from '../routing/classes.unified.email.server.ts';
|
||||
import * as plugins from '../../plugins.js';
|
||||
import * as paths from '../../paths.js';
|
||||
import type { UnifiedEmailServer } from '../routing/classes.unified.email.server.js';
|
||||
|
||||
/**
|
||||
* Configures email server storage settings
|
||||
* @param emailServer Reference to the unified email server
|
||||
* @param options Configuration options containing storage paths
|
||||
*/
|
||||
export function configureEmailStorage(emailServer: UnifiedEmailServer, options: any): void {
|
||||
export async function configureEmailStorage(emailServer: UnifiedEmailServer, options: any): Promise<void> {
|
||||
// Extract the receivedEmailsPath if available
|
||||
if (options?.emailPortConfig?.receivedEmailsPath) {
|
||||
const receivedEmailsPath = options.emailPortConfig.receivedEmailsPath;
|
||||
|
||||
|
||||
// Ensure the directory exists
|
||||
plugins.smartfile.fs.ensureDirSync(receivedEmailsPath);
|
||||
|
||||
await plugins.smartfs.directory(receivedEmailsPath).recursive().create();
|
||||
|
||||
// Set path for received emails
|
||||
if (emailServer) {
|
||||
// Storage paths are now handled by the unified email server system
|
||||
plugins.smartfile.fs.ensureDirSync(paths.receivedEmailsDir);
|
||||
|
||||
await plugins.smartfs.directory(paths.receivedEmailsDir).recursive().create();
|
||||
|
||||
console.log(`Configured email server to store received emails to: ${receivedEmailsPath}`);
|
||||
}
|
||||
}
|
||||
@@ -30,8 +30,8 @@ export function configureEmailStorage(emailServer: UnifiedEmailServer, options:
|
||||
* @param emailServer Reference to the unified email server
|
||||
* @param config Configuration settings for email server
|
||||
*/
|
||||
export function configureEmailServer(
|
||||
emailServer: UnifiedEmailServer,
|
||||
export async function configureEmailServer(
|
||||
emailServer: UnifiedEmailServer,
|
||||
config: {
|
||||
ports?: number[];
|
||||
hostname?: string;
|
||||
@@ -42,32 +42,32 @@ export function configureEmailServer(
|
||||
};
|
||||
storagePath?: string;
|
||||
}
|
||||
): boolean {
|
||||
): Promise<boolean> {
|
||||
if (!emailServer) {
|
||||
console.error('Email server not available');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Configure the email server with updated options
|
||||
const serverOptions = {
|
||||
ports: config.ports || [25, 587, 465],
|
||||
hostname: config.hostname || 'localhost',
|
||||
tls: config.tls
|
||||
};
|
||||
|
||||
|
||||
// Update the email server options
|
||||
emailServer.updateOptions(serverOptions);
|
||||
|
||||
|
||||
console.log(`Configured email server on ports ${serverOptions.ports.join(', ')}`);
|
||||
|
||||
|
||||
// Set up storage path if provided
|
||||
if (config.storagePath) {
|
||||
configureEmailStorage(emailServer, {
|
||||
await configureEmailStorage(emailServer, {
|
||||
emailPortConfig: {
|
||||
receivedEmailsPath: config.storagePath
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user