nolimit-x 1.0.54 → 1.0.55
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/package.json +1 -1
- package/src/init.js +44 -22
- package/src/license.js +28 -5
- package/templates/subjects.txt +3 -0
package/package.json
CHANGED
package/src/init.js
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
-
function copyTemplate(src, dest) {
|
|
5
|
-
try {
|
|
6
|
-
const srcPath = path.join(__dirname, '../templates', src);
|
|
7
|
-
const destPath = path.join(dest, src);
|
|
8
|
-
console.log(`Copying from ${srcPath} to ${destPath}`);
|
|
9
|
-
fs.copyFileSync(srcPath, destPath);
|
|
10
|
-
} catch (err) {
|
|
11
|
-
console.error(`Failed to copy template ${src}:`, err);
|
|
12
|
-
throw err;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
4
|
function init(projectName) {
|
|
17
|
-
console.log('Init function called with:', projectName);
|
|
18
5
|
const projectPath = path.resolve(process.cwd(), projectName);
|
|
19
|
-
console.log('Project path:', projectPath);
|
|
20
6
|
|
|
21
7
|
if (fs.existsSync(projectPath)) {
|
|
22
8
|
console.error(`Directory ${projectName} already exists.`);
|
|
@@ -24,20 +10,56 @@ function init(projectName) {
|
|
|
24
10
|
}
|
|
25
11
|
|
|
26
12
|
try {
|
|
13
|
+
// Create project directory and subdirectories
|
|
27
14
|
fs.mkdirSync(projectPath);
|
|
28
|
-
|
|
15
|
+
fs.mkdirSync(path.join(projectPath, 'attachments'));
|
|
29
16
|
|
|
30
17
|
// Copy template files
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
const templates = [
|
|
19
|
+
'config.json',
|
|
20
|
+
'emails.txt',
|
|
21
|
+
'senders.txt',
|
|
22
|
+
'messages.html',
|
|
23
|
+
'smtps.txt',
|
|
24
|
+
'subjects.txt',
|
|
25
|
+
'functions.txt'
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const templatesDir = path.join(__dirname, '../templates');
|
|
29
|
+
for (const file of templates) {
|
|
30
|
+
const srcPath = path.join(templatesDir, file);
|
|
31
|
+
if (fs.existsSync(srcPath)) {
|
|
32
|
+
fs.copyFileSync(srcPath, path.join(projectPath, file));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Create empty nolimit.key placeholder
|
|
37
|
+
fs.writeFileSync(path.join(projectPath, 'nolimit.key'), '');
|
|
38
|
+
|
|
39
|
+
// Create placeholder attachment
|
|
40
|
+
fs.writeFileSync(
|
|
41
|
+
path.join(projectPath, 'attachments', 'document.html'),
|
|
42
|
+
'<html>\n<body>\n <p>Your attachment content here.</p>\n</body>\n</html>\n'
|
|
43
|
+
);
|
|
35
44
|
|
|
36
|
-
console.log(`Initialized
|
|
45
|
+
console.log(`Initialized campaign: ${projectPath}`);
|
|
46
|
+
console.log('');
|
|
47
|
+
console.log('Files created:');
|
|
48
|
+
console.log(' config.json - SMTP and campaign settings');
|
|
49
|
+
console.log(' emails.txt - Recipient email list');
|
|
50
|
+
console.log(' senders.txt - Sender email list');
|
|
51
|
+
console.log(' messages.html - Email body template');
|
|
52
|
+
console.log(' smtps.txt - SMTP providers for rotation');
|
|
53
|
+
console.log(' subjects.txt - Subject lines for rotation');
|
|
54
|
+
console.log(' functions.txt - Placeholder reference guide');
|
|
55
|
+
console.log(' nolimit.key - Paste your license key here');
|
|
56
|
+
console.log(' attachments/ - Attachment files');
|
|
57
|
+
console.log('');
|
|
58
|
+
console.log('Next: edit config.json with your SMTP details, then run: nolimit send');
|
|
37
59
|
} catch (error) {
|
|
38
|
-
console.error('Error during initialization:', error);
|
|
60
|
+
console.error('Error during initialization:', error.message);
|
|
39
61
|
process.exit(1);
|
|
40
62
|
}
|
|
41
63
|
}
|
|
42
64
|
|
|
43
|
-
module.exports = init;
|
|
65
|
+
module.exports = init;
|
package/src/license.js
CHANGED
|
@@ -67,10 +67,20 @@ function checkLicense(workdir) {
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
// 2. Decode the key
|
|
70
|
+
// 2. Decode the key (supports both base64 and base64url formats)
|
|
71
71
|
let payloadB64, signatureB64;
|
|
72
72
|
try {
|
|
73
|
-
|
|
73
|
+
// Try base64url first (new shorter format), then standard base64 (legacy)
|
|
74
|
+
let inner;
|
|
75
|
+
try {
|
|
76
|
+
inner = Buffer.from(rawKey, 'base64url').toString('utf8');
|
|
77
|
+
} catch {
|
|
78
|
+
inner = Buffer.from(rawKey, 'base64').toString('utf8');
|
|
79
|
+
}
|
|
80
|
+
// If decoding produced garbage, try the other format
|
|
81
|
+
if (!inner.includes('.')) {
|
|
82
|
+
inner = Buffer.from(rawKey, 'base64').toString('utf8');
|
|
83
|
+
}
|
|
74
84
|
const dotIdx = inner.indexOf('.');
|
|
75
85
|
if (dotIdx === -1) {
|
|
76
86
|
return { valid: false, error: 'Invalid license key format.' };
|
|
@@ -81,11 +91,24 @@ function checkLicense(workdir) {
|
|
|
81
91
|
return { valid: false, error: 'Invalid license key encoding.' };
|
|
82
92
|
}
|
|
83
93
|
|
|
84
|
-
// 3. Verify Ed25519 signature
|
|
94
|
+
// 3. Verify Ed25519 signature (supports both base64 and base64url payload/signature)
|
|
85
95
|
let payload;
|
|
86
96
|
try {
|
|
87
|
-
|
|
88
|
-
|
|
97
|
+
let payloadBuf, signatureBuf;
|
|
98
|
+
try {
|
|
99
|
+
payloadBuf = Buffer.from(payloadB64, 'base64url');
|
|
100
|
+
signatureBuf = Buffer.from(signatureB64, 'base64url');
|
|
101
|
+
} catch {
|
|
102
|
+
payloadBuf = Buffer.from(payloadB64, 'base64');
|
|
103
|
+
signatureBuf = Buffer.from(signatureB64, 'base64');
|
|
104
|
+
}
|
|
105
|
+
// Validate payload is valid JSON, if not try other encoding
|
|
106
|
+
try {
|
|
107
|
+
JSON.parse(payloadBuf.toString('utf8'));
|
|
108
|
+
} catch {
|
|
109
|
+
payloadBuf = Buffer.from(payloadB64, 'base64');
|
|
110
|
+
signatureBuf = Buffer.from(signatureB64, 'base64');
|
|
111
|
+
}
|
|
89
112
|
|
|
90
113
|
const publicKey = crypto.createPublicKey(PUBLIC_KEY_PEM);
|
|
91
114
|
const isValid = crypto.verify(null, payloadBuf, publicKey, signatureBuf);
|