vantuz 3.2.4 → 3.2.5
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/cli.js +19 -25
- package/onboard.js +4 -3
- package/package.json +7 -4
- package/plugins/vantuz/platforms/trendyol.js +1 -1
- package/plugins/vantuz/services/license.js +15 -259
package/cli.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* VANTUZ CLI v3.2.2
|
|
4
|
-
* Enterprise E-Ticaret Yönetimi
|
|
5
|
-
* Emojisiz, Kurumsal Arayüz
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import fs from 'fs';
|
|
9
2
|
import path from 'path';
|
|
10
3
|
import os from 'os';
|
|
4
|
+
import fs from 'fs';
|
|
11
5
|
import readline from 'readline';
|
|
12
|
-
import { getEngine } from './core/engine.js';
|
|
13
6
|
import { log, getLogs, clearLogs } from './core/ai-provider.js';
|
|
7
|
+
import { getEngine } from './core/engine.js';
|
|
14
8
|
import { LicenseManager } from './plugins/vantuz/services/license.js';
|
|
15
9
|
|
|
16
10
|
// CONFIG
|
|
@@ -67,20 +61,20 @@ async function runTUI() {
|
|
|
67
61
|
clearScreen();
|
|
68
62
|
printHeader();
|
|
69
63
|
|
|
70
|
-
// License check
|
|
71
|
-
const hasLicense = await checkLicense();
|
|
72
|
-
if (!hasLicense) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
64
|
+
// License check disabled for Dev Mode
|
|
65
|
+
// const hasLicense = await checkLicense();
|
|
66
|
+
// if (!hasLicense) {
|
|
67
|
+
// console.log(c('red', '[HATA] Geçerli lisans bulunamadı.'));
|
|
68
|
+
// console.log('Lütfen önce kurulumu tamamlayın:\n');
|
|
69
|
+
// console.log(' vantuz-onboard\n');
|
|
70
|
+
// process.exit(1);
|
|
71
|
+
// }
|
|
78
72
|
|
|
79
73
|
console.log('Sistem başlatılıyor...\n');
|
|
80
74
|
// ... (TUI init simplified for brevity, engine logic assumes valid license)
|
|
81
75
|
|
|
82
76
|
const engine = await getEngine();
|
|
83
|
-
console.log(c('green', '[OK] Sistem Aktif\n'));
|
|
77
|
+
console.log(c('green', '[OK] Sistem Aktif (Dev Mode)\n'));
|
|
84
78
|
console.log('Komutlar: /help, /stok, /siparis, /exit\n');
|
|
85
79
|
|
|
86
80
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -115,12 +109,12 @@ const command = args[0]?.toLowerCase();
|
|
|
115
109
|
async function main() {
|
|
116
110
|
const env = loadEnv();
|
|
117
111
|
|
|
118
|
-
// Auto-redirect
|
|
119
|
-
if (!env.VANTUZ_LICENSE_KEY && command !== 'onboard') {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
112
|
+
// Auto-redirect removed
|
|
113
|
+
// if (!env.VANTUZ_LICENSE_KEY && command !== 'onboard') {
|
|
114
|
+
// console.log(c('yellow', 'Lisans bulunamadı. Kurulum sihirbazı başlatılıyor...\n'));
|
|
115
|
+
// import('./onboard.js');
|
|
116
|
+
// return;
|
|
117
|
+
// }
|
|
124
118
|
|
|
125
119
|
switch (command) {
|
|
126
120
|
case 'tui':
|
|
@@ -130,8 +124,8 @@ async function main() {
|
|
|
130
124
|
|
|
131
125
|
case 'status':
|
|
132
126
|
printHeader();
|
|
133
|
-
const valid = await checkLicense();
|
|
134
|
-
console.log(`Lisans Durumu: ${
|
|
127
|
+
// const valid = await checkLicense();
|
|
128
|
+
console.log(`Lisans Durumu: ${c('green', 'Aktif (Dev Mode)')}`);
|
|
135
129
|
break;
|
|
136
130
|
|
|
137
131
|
default:
|
package/onboard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* VANTUZ - Profesyonel Kurulum Sihirbazı
|
|
@@ -67,7 +67,8 @@ class OnboardingWizard {
|
|
|
67
67
|
try {
|
|
68
68
|
await this.showLogo();
|
|
69
69
|
await this.showWelcome();
|
|
70
|
-
await this.step1_License();
|
|
70
|
+
// await this.step1_License(); // Lisans adımı kaldırıldı
|
|
71
|
+
console.log(c('green', '⚡ Geliştirici Modu: Lisans kontrolü atlandı.\n'));
|
|
71
72
|
await this.step2_AIProvider();
|
|
72
73
|
await this.step3_Platforms();
|
|
73
74
|
await this.step4_Channels();
|
|
@@ -97,7 +98,7 @@ class OnboardingWizard {
|
|
|
97
98
|
this.printHeader('LİSANS AKTİVASYONU');
|
|
98
99
|
|
|
99
100
|
console.log('Vantuz AI kullanımı için geçerli bir lisans anahtarı gereklidir.');
|
|
100
|
-
console.log(c('dim', '
|
|
101
|
+
console.log(c('dim', 'Size verilen Kullanıcı Modu anahtarını girin.\n'));
|
|
101
102
|
|
|
102
103
|
while (true) {
|
|
103
104
|
const key = await this.prompt('Lisans Anahtarı: '); // Changed from promptSecret to avoid issues
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vantuz",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.5",
|
|
4
4
|
"description": "Yapay Zeka Destekli E-Ticaret Yönetim Platformu - 7 Pazaryeri + WhatsApp/Telegram",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "cli.js",
|
|
@@ -53,8 +53,11 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"axios": "^1.6.0",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
56
|
+
"body-parser": "^2.2.2",
|
|
57
|
+
"cors": "^2.8.6",
|
|
58
|
+
"dotenv": "^16.0.0",
|
|
59
|
+
"express": "^5.2.1",
|
|
60
|
+
"xml2js": "^0.6.2"
|
|
58
61
|
},
|
|
59
62
|
"devDependencies": {
|
|
60
63
|
"eslint": "^8.0.0"
|
|
@@ -75,4 +78,4 @@
|
|
|
75
78
|
"README.md",
|
|
76
79
|
"LICENSE"
|
|
77
80
|
]
|
|
78
|
-
}
|
|
81
|
+
}
|
|
@@ -29,7 +29,7 @@ export class TrendyolAPI {
|
|
|
29
29
|
return {
|
|
30
30
|
'Authorization': `Basic ${this.auth}`,
|
|
31
31
|
'Content-Type': 'application/json',
|
|
32
|
-
'User-Agent': `${this.supplierId} - SelfIntegration`
|
|
32
|
+
'User-Agent': `${this.supplierId} - SelfIntegration (Vantuz/3.2.2)` // Daha standart format
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -1,278 +1,34 @@
|
|
|
1
|
+
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
3
|
+
* LİSANS YÖNETİCİSİ (DEV MODE - HERKES SÜPER KULLANICI)
|
|
4
|
+
* Kullanıcının isteği üzerine tüm güvenlik/lisans kontrolleri kaldırılmıştır.
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
|
-
import crypto from 'crypto';
|
|
7
|
-
import fs from 'fs';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import { fileURLToPath } from 'url';
|
|
10
|
-
|
|
11
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
-
const LOCAL_CACHE = path.join(__dirname, '..', '..', '.license-cache');
|
|
13
|
-
const LICENSE_DURATION_DAYS = 365;
|
|
14
|
-
|
|
15
|
-
// Sunucu URL (gerçek sunucunuz olduğunda değiştirin)
|
|
16
|
-
const LICENSE_SERVER = process.env.VANTUZ_LICENSE_SERVER || 'https://license.vantuz.ai';
|
|
17
|
-
|
|
18
7
|
export class LicenseManager {
|
|
19
8
|
constructor(api = null) {
|
|
20
|
-
this.
|
|
21
|
-
this.currentLicense = null;
|
|
22
|
-
this.licenseData = null;
|
|
23
|
-
this.isValidated = false;
|
|
9
|
+
this.isValidated = true; // Her zaman aktif
|
|
24
10
|
}
|
|
25
11
|
|
|
26
|
-
/**
|
|
27
|
-
* Başlatma - önce cache kontrol, sonra sunucu
|
|
28
|
-
*/
|
|
29
12
|
async initialize() {
|
|
30
|
-
|
|
31
|
-
if (envKey) {
|
|
32
|
-
// Önce local cache kontrol
|
|
33
|
-
const cached = this._loadCache();
|
|
34
|
-
if (cached && cached.key === envKey && this._isNotExpired(cached)) {
|
|
35
|
-
this.currentLicense = envKey;
|
|
36
|
-
this.licenseData = cached;
|
|
37
|
-
this.isValidated = true;
|
|
38
|
-
return { success: true, cached: true };
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Cache yoksa veya geçersizse sunucuya sor
|
|
42
|
-
return await this.activate(envKey);
|
|
43
|
-
}
|
|
44
|
-
return { success: false, demo: true };
|
|
13
|
+
return { success: true, bypassed: true };
|
|
45
14
|
}
|
|
46
15
|
|
|
47
|
-
/**
|
|
48
|
-
* Lisans formatını doğrula (offline)
|
|
49
|
-
*/
|
|
50
|
-
validateFormat(key) {
|
|
51
|
-
// Yeni Format: VNTUZ-PAYLOAD.SIGNATURE (RSA İmzalı)
|
|
52
|
-
if (!key || !key.startsWith('VNTUZ-')) {
|
|
53
|
-
return { valid: false, error: 'Geçersiz lisans formatı (VNTUZ- prefix eksik)' };
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// İmza ve payload ayrımı kontrolü
|
|
57
|
-
const parts = key.slice(6).split('.');
|
|
58
|
-
if (parts.length !== 2) {
|
|
59
|
-
return { valid: false, error: 'Lisans yapısal olarak bozuk (Payload.Signature bekleniyor)' };
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return { valid: true };
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Sunucudan lisans doğrula
|
|
67
|
-
*/
|
|
68
16
|
async activate(key) {
|
|
69
|
-
// Format kontrolü
|
|
70
|
-
const formatCheck = this.validateFormat(key);
|
|
71
|
-
if (!formatCheck.valid) {
|
|
72
|
-
return { success: false, error: formatCheck.error };
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
try {
|
|
76
|
-
// Sunucuya doğrulama isteği (gerçek sunucu olmadığında offline mod)
|
|
77
|
-
const result = await this._verifyWithServer(key);
|
|
78
|
-
|
|
79
|
-
if (result.success) {
|
|
80
|
-
this.currentLicense = key;
|
|
81
|
-
this.licenseData = result.data;
|
|
82
|
-
this.isValidated = true;
|
|
83
|
-
|
|
84
|
-
// Cache'e kaydet (7 gün geçerli)
|
|
85
|
-
this._saveCache({
|
|
86
|
-
key,
|
|
87
|
-
...result.data,
|
|
88
|
-
cachedAt: new Date().toISOString(),
|
|
89
|
-
cacheExpires: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString()
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
return result;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return result;
|
|
96
|
-
} catch (error) {
|
|
97
|
-
// Sunucuya ulaşılamazsa cache kullan
|
|
98
|
-
const cached = this._loadCache();
|
|
99
|
-
if (cached && cached.key === key) {
|
|
100
|
-
this.currentLicense = key;
|
|
101
|
-
this.licenseData = cached;
|
|
102
|
-
this.isValidated = true;
|
|
103
|
-
return { success: true, offline: true, data: cached };
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Format doğruysa offline geçerli say
|
|
107
|
-
if (formatCheck.valid) {
|
|
108
|
-
return {
|
|
109
|
-
success: true,
|
|
110
|
-
offline: true,
|
|
111
|
-
warning: 'Sunucuya ulaşılamadı, offline doğrulama yapıldı',
|
|
112
|
-
data: {
|
|
113
|
-
status: 'active',
|
|
114
|
-
features: ['offline_valid']
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return {
|
|
120
|
-
success: false,
|
|
121
|
-
error: 'Lisans sunucusuna ulaşılamadı ve format geçersiz',
|
|
122
|
-
demo: true
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Sunucu ile iletişim
|
|
129
|
-
*/
|
|
130
|
-
async _verifyWithServer(key) {
|
|
131
|
-
// RSA İmza Doğrulama (Offline & Secure)
|
|
132
|
-
try {
|
|
133
|
-
// Format: VNTUZ-PAYLOAD.SIGNATURE
|
|
134
|
-
if (!key.startsWith('VNTUZ-')) return { success: false, error: 'Geçersiz format' };
|
|
135
|
-
|
|
136
|
-
const parts = key.slice(6).split('.');
|
|
137
|
-
if (parts.length !== 2) return { success: false, error: 'Bozuk lisans anahtarı' };
|
|
138
|
-
|
|
139
|
-
const [payloadB64, signatureHex] = parts;
|
|
140
|
-
const payload = Buffer.from(payloadB64, 'base64');
|
|
141
|
-
const signature = Buffer.from(signatureHex, 'hex');
|
|
142
|
-
|
|
143
|
-
// Public Key (RSA-2048) - User Generated
|
|
144
|
-
const publicKey = `-----BEGIN PUBLIC KEY-----
|
|
145
|
-
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAphjtxJVk8qG3HpXTVKoG
|
|
146
|
-
QKvvUdPeO4dohFFc2S2SP31mapevTgXDklO6fDapEAzRAaySZDYMQhyeK5lZXlXZ
|
|
147
|
-
fSf8OhzM2vyQ/oBp0VuLOv0fcx9oDYsPOoDY6F4X04cfPHlrIXdzeSpk9G+Dv8HL
|
|
148
|
-
/P2uVlLn249Olwhj0bKioFqUggm+m+WIhsHeHtSngzbrqi0A1O8FG8Srj1Zb5O/9
|
|
149
|
-
99c1JjzDa36XwuIEMYHFgewvNuVS8GqB+Tr3EYdA0dbzI27Y273N3Ay9l3LhzfmR
|
|
150
|
-
6faAgQcegPVdrbhqyCQmuDDUBbt4vE+sGGwitl5UyT6Edyaf/GRciXp/KHytvUCe
|
|
151
|
-
vQIDAQAB
|
|
152
|
-
-----END PUBLIC KEY-----`;
|
|
153
|
-
|
|
154
|
-
const isVerified = crypto.verify(
|
|
155
|
-
"sha256",
|
|
156
|
-
payload,
|
|
157
|
-
publicKey,
|
|
158
|
-
signature
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
if (isVerified) {
|
|
162
|
-
const data = JSON.parse(payload.toString());
|
|
163
|
-
|
|
164
|
-
// Tarih kontrolü
|
|
165
|
-
if (new Date(data.expires) < new Date()) {
|
|
166
|
-
return { success: false, error: 'Lisans süresi dolmuş' };
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return {
|
|
170
|
-
success: true,
|
|
171
|
-
offline: true,
|
|
172
|
-
data: {
|
|
173
|
-
status: 'active',
|
|
174
|
-
expiresAt: data.expires,
|
|
175
|
-
features: data.features
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
} else {
|
|
179
|
-
return { success: false, error: 'Lisans imzası geçersiz (Sahte Lisans)' };
|
|
180
|
-
}
|
|
181
|
-
} catch (e) {
|
|
182
|
-
return { success: false, error: 'Lisans okunamadı' };
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Cache yönetimi
|
|
188
|
-
*/
|
|
189
|
-
_loadCache() {
|
|
190
|
-
try {
|
|
191
|
-
if (fs.existsSync(LOCAL_CACHE)) {
|
|
192
|
-
const data = JSON.parse(fs.readFileSync(LOCAL_CACHE, 'utf-8'));
|
|
193
|
-
// Cache süresi dolmamışsa kullan
|
|
194
|
-
if (data.cacheExpires && new Date(data.cacheExpires) > new Date()) {
|
|
195
|
-
return data;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
} catch (e) { }
|
|
199
|
-
return null;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
_saveCache(data) {
|
|
203
|
-
try {
|
|
204
|
-
fs.writeFileSync(LOCAL_CACHE, JSON.stringify(data, null, 2));
|
|
205
|
-
} catch (e) { }
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
_isNotExpired(data) {
|
|
209
|
-
if (!data.expiresAt) return false;
|
|
210
|
-
return new Date(data.expiresAt) > new Date();
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Lisans geçerli mi?
|
|
215
|
-
*/
|
|
216
|
-
isValid() {
|
|
217
|
-
if (!this.licenseData) return false;
|
|
218
|
-
if (this.licenseData.status !== 'active') return false;
|
|
219
|
-
return this._isNotExpired(this.licenseData);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Özellik kontrolü
|
|
224
|
-
*/
|
|
225
|
-
hasFeature(feature) {
|
|
226
|
-
if (!this.isValid()) return false;
|
|
227
|
-
const features = this.licenseData?.features || [];
|
|
228
|
-
return features.includes(feature) || features.includes('all');
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Durum bilgisi (anahtarı GÖSTERMİYORUZ)
|
|
233
|
-
*/
|
|
234
|
-
getStatus() {
|
|
235
|
-
if (!this.licenseData) {
|
|
236
|
-
return {
|
|
237
|
-
valid: false,
|
|
238
|
-
reason: 'Lisans yüklenmemiş',
|
|
239
|
-
demo: true
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
const expiresAt = new Date(this.licenseData.expiresAt);
|
|
244
|
-
const now = new Date();
|
|
245
|
-
const daysLeft = Math.ceil((expiresAt - now) / (1000 * 60 * 60 * 24));
|
|
246
|
-
|
|
247
|
-
if (expiresAt < now) {
|
|
248
|
-
return {
|
|
249
|
-
valid: false,
|
|
250
|
-
reason: 'Lisans süresi dolmuş'
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
|
|
254
17
|
return {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
features: this.licenseData.features,
|
|
262
|
-
status: this.licenseData.status
|
|
18
|
+
success: true,
|
|
19
|
+
data: {
|
|
20
|
+
user: 'Developer',
|
|
21
|
+
features: ['all'],
|
|
22
|
+
expiresAt: '2099-12-31'
|
|
23
|
+
}
|
|
263
24
|
};
|
|
264
25
|
}
|
|
265
26
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
*/
|
|
269
|
-
isDemo() {
|
|
270
|
-
return !this.isValid();
|
|
27
|
+
validateFormat(key) {
|
|
28
|
+
return { valid: true };
|
|
271
29
|
}
|
|
272
30
|
|
|
273
|
-
async
|
|
274
|
-
return
|
|
31
|
+
async getFeatureStatus() {
|
|
32
|
+
return { enabled: true }; // Tüm özellikler açık
|
|
275
33
|
}
|
|
276
34
|
}
|
|
277
|
-
|
|
278
|
-
export default LicenseManager;
|