vako 1.3.0 → 1.3.4
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/CHANGELOG.md +63 -63
- package/README.md +311 -1661
- package/bin/commands/setup-executor.js +1 -1
- package/bin/commands/setup.js +10 -10
- package/bin/create-veko-app.js +10 -10
- package/bin/vako.js +188 -0
- package/bin/veko-update.js +15 -15
- package/bin/veko.js +13 -13
- package/error/error.ejs +4 -4
- package/lib/adapters/nextjs-adapter.js +241 -241
- package/lib/app.js +10 -10
- package/lib/core/auth-manager.js +2 -2
- package/lib/core/auto-updater.js +50 -50
- package/lib/core/module-installer.js +2 -2
- package/lib/dev/dev-server.js +3 -3
- package/lib/layout/layout-manager.js +3 -3
- package/lib/plugin-manager.js +2 -2
- package/lib/routing/route-manager.js +3 -3
- package/package.json +12 -13
- package/templates/public/js/main.js +1 -1
- package/tsconfig.json +50 -50
- package/types/index.d.ts +238 -238
|
@@ -1,241 +1,241 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Next.js Adapter for
|
|
3
|
-
*
|
|
4
|
-
* Permet d'intégrer
|
|
5
|
-
* - Utilisez les routes
|
|
6
|
-
* - Utilisez les plugins
|
|
7
|
-
* - Compatible avec les API routes de Next.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const path = require('path');
|
|
11
|
-
|
|
12
|
-
class NextJsAdapter {
|
|
13
|
-
constructor(options = {}) {
|
|
14
|
-
this.nextApp = options.nextApp;
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.routePrefix = options.routePrefix || '/api/
|
|
18
|
-
this.
|
|
19
|
-
this.integrated = false;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Intègre les routes
|
|
24
|
-
* @param {App}
|
|
25
|
-
*/
|
|
26
|
-
integrateRoutes(
|
|
27
|
-
if (!this.nextApp) {
|
|
28
|
-
throw new Error('Next.js app instance is required');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
this.
|
|
32
|
-
|
|
33
|
-
if (!this.
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Créer un handler Next.js pour toutes les routes
|
|
38
|
-
this.nextApp.use(this.routePrefix, (req, res, next) => {
|
|
39
|
-
// Passer la requête à Express (
|
|
40
|
-
this.
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
this.integrated = true;
|
|
44
|
-
this.
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Active les plugins
|
|
49
|
-
* @param {App}
|
|
50
|
-
*/
|
|
51
|
-
usePlugins(
|
|
52
|
-
if (!this.
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
this.
|
|
57
|
-
|
|
58
|
-
// Exposer les plugins dans le contexte Next.js
|
|
59
|
-
if (this.nextApp.getRequestHandler) {
|
|
60
|
-
const originalHandler = this.nextApp.getRequestHandler();
|
|
61
|
-
|
|
62
|
-
this.nextApp.getRequestHandler = (req, res) => {
|
|
63
|
-
// Ajouter les plugins au contexte de la requête
|
|
64
|
-
req.
|
|
65
|
-
req.
|
|
66
|
-
|
|
67
|
-
return originalHandler(req, res);
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Crée un handler API Next.js à partir d'un handler
|
|
76
|
-
* @param {Function}
|
|
77
|
-
* @returns {Function} Handler compatible Next.js API route
|
|
78
|
-
*/
|
|
79
|
-
createApiHandler(
|
|
80
|
-
return async (req, res) => {
|
|
81
|
-
try {
|
|
82
|
-
// Adapter le contexte pour être compatible avec Express
|
|
83
|
-
await new Promise((resolve, reject) => {
|
|
84
|
-
const next = (err) => {
|
|
85
|
-
if (err) reject(err);
|
|
86
|
-
else resolve();
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// Appeler le handler
|
|
90
|
-
const result =
|
|
91
|
-
|
|
92
|
-
// Si c'est une Promise, attendre sa résolution
|
|
93
|
-
if (result && typeof result.then === 'function') {
|
|
94
|
-
result.catch(reject);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
} catch (error) {
|
|
98
|
-
if (!res.headersSent) {
|
|
99
|
-
res.status(500).json({ error: error.message });
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Middleware pour Next.js qui expose les fonctionnalités
|
|
107
|
-
* @returns {Function} Middleware Express compatible
|
|
108
|
-
*/
|
|
109
|
-
middleware() {
|
|
110
|
-
return (req, res, next) => {
|
|
111
|
-
if (!this.
|
|
112
|
-
return next();
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Ajouter l'app
|
|
116
|
-
req.
|
|
117
|
-
req.
|
|
118
|
-
req.
|
|
119
|
-
|
|
120
|
-
// Exécuter les hooks
|
|
121
|
-
if (this.
|
|
122
|
-
this.
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Hook pour la fin de la requête
|
|
126
|
-
const originalEnd = res.end;
|
|
127
|
-
res.end = function(...args) {
|
|
128
|
-
if (this.
|
|
129
|
-
this.
|
|
130
|
-
}
|
|
131
|
-
return originalEnd.apply(this, args);
|
|
132
|
-
}.bind({
|
|
133
|
-
|
|
134
|
-
next();
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Crée une route API Next.js dynamique depuis une route
|
|
140
|
-
* @param {string} method - Méthode HTTP
|
|
141
|
-
* @param {string} path - Chemin de la route
|
|
142
|
-
* @param {Function|Array} handlers - Handlers
|
|
143
|
-
*/
|
|
144
|
-
createNextApiRoute(method, path, handlers) {
|
|
145
|
-
if (!this.nextApp) {
|
|
146
|
-
throw new Error('Next.js app instance is required');
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const fullPath = path.startsWith('/') ? path : `/${path}`;
|
|
150
|
-
const apiPath = `${this.routePrefix}${fullPath}`;
|
|
151
|
-
|
|
152
|
-
// Convertir les handlers en handler Next.js
|
|
153
|
-
const handlerArray = Array.isArray(handlers) ? handlers : [handlers];
|
|
154
|
-
const nextHandler = this.createApiHandler(async (req, res) => {
|
|
155
|
-
for (const handler of handlerArray) {
|
|
156
|
-
await new Promise((resolve, reject) => {
|
|
157
|
-
const next = (err) => {
|
|
158
|
-
if (err) reject(err);
|
|
159
|
-
else resolve();
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
const result = handler(req, res, next);
|
|
163
|
-
if (result && typeof result.then === 'function') {
|
|
164
|
-
result.catch(reject);
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
// Enregistrer la route dans Next.js
|
|
171
|
-
// Note: Cela nécessite une configuration spéciale dans Next.js
|
|
172
|
-
// car Next.js utilise un système de routing basé sur les fichiers
|
|
173
|
-
this.
|
|
174
|
-
|
|
175
|
-
return {
|
|
176
|
-
path: apiPath,
|
|
177
|
-
method: method.toUpperCase(),
|
|
178
|
-
handler: nextHandler
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Génère les fichiers de routes API Next.js depuis les routes
|
|
184
|
-
* @param {string} outputDir - Dossier de sortie (pages/api ou app/api)
|
|
185
|
-
*/
|
|
186
|
-
generateNextApiFiles(outputDir = 'pages/api') {
|
|
187
|
-
if (!this.
|
|
188
|
-
throw new Error('
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const routes = this.
|
|
192
|
-
const fs = require('fs');
|
|
193
|
-
const path = require('path');
|
|
194
|
-
|
|
195
|
-
routes.forEach(route => {
|
|
196
|
-
const routePath = route.path.replace(this.routePrefix, '').replace(/^\//, '');
|
|
197
|
-
const filePath = path.join(outputDir, routePath.replace(/\//g, '/'));
|
|
198
|
-
const dirPath = path.dirname(filePath);
|
|
199
|
-
|
|
200
|
-
// Créer le dossier si nécessaire
|
|
201
|
-
if (!fs.existsSync(dirPath)) {
|
|
202
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Générer le fichier API Next.js
|
|
206
|
-
const content = this.generateNextApiFileContent(route);
|
|
207
|
-
fs.writeFileSync(`${filePath}.js`, content);
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
this.
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Génère le contenu d'un fichier API Next.js
|
|
215
|
-
* @private
|
|
216
|
-
*/
|
|
217
|
-
generateNextApiFileContent(route) {
|
|
218
|
-
return `// Auto-generated by
|
|
219
|
-
// Route: ${route.method} ${route.path}
|
|
220
|
-
|
|
221
|
-
export default async function handler(req, res) {
|
|
222
|
-
// Cette route est gérée par
|
|
223
|
-
// Pour personnaliser, modifiez ce fichier
|
|
224
|
-
|
|
225
|
-
if (req.method !== '${route.method}') {
|
|
226
|
-
return res.status(405).json({ error: 'Method not allowed' });
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Rediriger vers le handler
|
|
230
|
-
// Note: Vous devez configurer le proxy ou utiliser le middleware
|
|
231
|
-
return res.status(200).json({
|
|
232
|
-
message: 'Route handled by
|
|
233
|
-
route: '${route.path}',
|
|
234
|
-
method: '${route.method}'
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
`;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
module.exports = NextJsAdapter;
|
|
1
|
+
/**
|
|
2
|
+
* Next.js Adapter for Vako
|
|
3
|
+
*
|
|
4
|
+
* Permet d'intégrer Vako avec Next.js pour bénéficier des deux frameworks
|
|
5
|
+
* - Utilisez les routes Vako dans Next.js
|
|
6
|
+
* - Utilisez les plugins Vako dans Next.js
|
|
7
|
+
* - Compatible avec les API routes de Next.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
class NextJsAdapter {
|
|
13
|
+
constructor(options = {}) {
|
|
14
|
+
this.nextApp = options.nextApp;
|
|
15
|
+
this.enableVakoRoutes = options.enableVakoRoutes !== false;
|
|
16
|
+
this.enableVakoPlugins = options.enableVakoPlugins !== false;
|
|
17
|
+
this.routePrefix = options.routePrefix || '/api/vako';
|
|
18
|
+
this.vakoApp = null;
|
|
19
|
+
this.integrated = false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Intègre les routes Vako avec Next.js
|
|
24
|
+
* @param {App} vakoApp - Instance de l'application Vako
|
|
25
|
+
*/
|
|
26
|
+
integrateRoutes(vakoApp) {
|
|
27
|
+
if (!this.nextApp) {
|
|
28
|
+
throw new Error('Next.js app instance is required');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
this.vakoApp = vakoApp;
|
|
32
|
+
|
|
33
|
+
if (!this.enableVakoRoutes) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Créer un handler Next.js pour toutes les routes Vako
|
|
38
|
+
this.nextApp.use(this.routePrefix, (req, res, next) => {
|
|
39
|
+
// Passer la requête à Express (Vako utilise Express)
|
|
40
|
+
this.vakoApp.express(req, res, next);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
this.integrated = true;
|
|
44
|
+
this.vakoApp.log('success', 'Next.js adapter intégré', `Routes disponibles sous ${this.routePrefix}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Active les plugins Vako dans Next.js
|
|
49
|
+
* @param {App} vakoApp - Instance de l'application Vako
|
|
50
|
+
*/
|
|
51
|
+
usePlugins(vakoApp) {
|
|
52
|
+
if (!this.enableVakoPlugins) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
this.vakoApp = vakoApp;
|
|
57
|
+
|
|
58
|
+
// Exposer les plugins dans le contexte Next.js
|
|
59
|
+
if (this.nextApp.getRequestHandler) {
|
|
60
|
+
const originalHandler = this.nextApp.getRequestHandler();
|
|
61
|
+
|
|
62
|
+
this.nextApp.getRequestHandler = (req, res) => {
|
|
63
|
+
// Ajouter les plugins au contexte de la requête
|
|
64
|
+
req.vakoPlugins = vakoApp.pluginManager?.plugins || new Map();
|
|
65
|
+
req.vakoApp = vakoApp;
|
|
66
|
+
|
|
67
|
+
return originalHandler(req, res);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
vakoApp.log('info', 'Plugins Vako disponibles dans Next.js');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Crée un handler API Next.js à partir d'un handler Vako
|
|
76
|
+
* @param {Function} vakoHandler - Handler Vako
|
|
77
|
+
* @returns {Function} Handler compatible Next.js API route
|
|
78
|
+
*/
|
|
79
|
+
createApiHandler(vakoHandler) {
|
|
80
|
+
return async (req, res) => {
|
|
81
|
+
try {
|
|
82
|
+
// Adapter le contexte pour être compatible avec Express
|
|
83
|
+
await new Promise((resolve, reject) => {
|
|
84
|
+
const next = (err) => {
|
|
85
|
+
if (err) reject(err);
|
|
86
|
+
else resolve();
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// Appeler le handler Vako avec le contexte Express
|
|
90
|
+
const result = vakoHandler(req, res, next);
|
|
91
|
+
|
|
92
|
+
// Si c'est une Promise, attendre sa résolution
|
|
93
|
+
if (result && typeof result.then === 'function') {
|
|
94
|
+
result.catch(reject);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
} catch (error) {
|
|
98
|
+
if (!res.headersSent) {
|
|
99
|
+
res.status(500).json({ error: error.message });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Middleware pour Next.js qui expose les fonctionnalités Vako
|
|
107
|
+
* @returns {Function} Middleware Express compatible
|
|
108
|
+
*/
|
|
109
|
+
middleware() {
|
|
110
|
+
return (req, res, next) => {
|
|
111
|
+
if (!this.vakoApp) {
|
|
112
|
+
return next();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Ajouter l'app Vako au contexte de la requête
|
|
116
|
+
req.vakoApp = this.vakoApp;
|
|
117
|
+
req.vakoPlugins = this.vakoApp.pluginManager?.plugins || new Map();
|
|
118
|
+
req.vakoLogger = this.vakoApp.logger;
|
|
119
|
+
|
|
120
|
+
// Exécuter les hooks Vako
|
|
121
|
+
if (this.vakoApp.pluginManager) {
|
|
122
|
+
this.vakoApp.pluginManager.executeHook('request:start', req, res);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Hook pour la fin de la requête
|
|
126
|
+
const originalEnd = res.end;
|
|
127
|
+
res.end = function(...args) {
|
|
128
|
+
if (this.vakoApp?.pluginManager) {
|
|
129
|
+
this.vakoApp.pluginManager.executeHook('request:end', req, res);
|
|
130
|
+
}
|
|
131
|
+
return originalEnd.apply(this, args);
|
|
132
|
+
}.bind({ vakoApp: this.vakoApp });
|
|
133
|
+
|
|
134
|
+
next();
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Crée une route API Next.js dynamique depuis une route Vako
|
|
140
|
+
* @param {string} method - Méthode HTTP
|
|
141
|
+
* @param {string} path - Chemin de la route
|
|
142
|
+
* @param {Function|Array} handlers - Handlers Vako
|
|
143
|
+
*/
|
|
144
|
+
createNextApiRoute(method, path, handlers) {
|
|
145
|
+
if (!this.nextApp) {
|
|
146
|
+
throw new Error('Next.js app instance is required');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const fullPath = path.startsWith('/') ? path : `/${path}`;
|
|
150
|
+
const apiPath = `${this.routePrefix}${fullPath}`;
|
|
151
|
+
|
|
152
|
+
// Convertir les handlers en handler Next.js
|
|
153
|
+
const handlerArray = Array.isArray(handlers) ? handlers : [handlers];
|
|
154
|
+
const nextHandler = this.createApiHandler(async (req, res) => {
|
|
155
|
+
for (const handler of handlerArray) {
|
|
156
|
+
await new Promise((resolve, reject) => {
|
|
157
|
+
const next = (err) => {
|
|
158
|
+
if (err) reject(err);
|
|
159
|
+
else resolve();
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const result = handler(req, res, next);
|
|
163
|
+
if (result && typeof result.then === 'function') {
|
|
164
|
+
result.catch(reject);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// Enregistrer la route dans Next.js
|
|
171
|
+
// Note: Cela nécessite une configuration spéciale dans Next.js
|
|
172
|
+
// car Next.js utilise un système de routing basé sur les fichiers
|
|
173
|
+
this.vakoApp?.log('info', `Route Next.js créée: ${method.toUpperCase()} ${apiPath}`);
|
|
174
|
+
|
|
175
|
+
return {
|
|
176
|
+
path: apiPath,
|
|
177
|
+
method: method.toUpperCase(),
|
|
178
|
+
handler: nextHandler
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Génère les fichiers de routes API Next.js depuis les routes Vako
|
|
184
|
+
* @param {string} outputDir - Dossier de sortie (pages/api ou app/api)
|
|
185
|
+
*/
|
|
186
|
+
generateNextApiFiles(outputDir = 'pages/api') {
|
|
187
|
+
if (!this.vakoApp) {
|
|
188
|
+
throw new Error('Vako app must be integrated first');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const routes = this.vakoApp.listRoutes();
|
|
192
|
+
const fs = require('fs');
|
|
193
|
+
const path = require('path');
|
|
194
|
+
|
|
195
|
+
routes.forEach(route => {
|
|
196
|
+
const routePath = route.path.replace(this.routePrefix, '').replace(/^\//, '');
|
|
197
|
+
const filePath = path.join(outputDir, routePath.replace(/\//g, '/'));
|
|
198
|
+
const dirPath = path.dirname(filePath);
|
|
199
|
+
|
|
200
|
+
// Créer le dossier si nécessaire
|
|
201
|
+
if (!fs.existsSync(dirPath)) {
|
|
202
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Générer le fichier API Next.js
|
|
206
|
+
const content = this.generateNextApiFileContent(route);
|
|
207
|
+
fs.writeFileSync(`${filePath}.js`, content);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
this.vakoApp.log('success', 'Fichiers API Next.js générés', `Dans ${outputDir}`);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Génère le contenu d'un fichier API Next.js
|
|
215
|
+
* @private
|
|
216
|
+
*/
|
|
217
|
+
generateNextApiFileContent(route) {
|
|
218
|
+
return `// Auto-generated by Vako Next.js Adapter
|
|
219
|
+
// Route: ${route.method} ${route.path}
|
|
220
|
+
|
|
221
|
+
export default async function handler(req, res) {
|
|
222
|
+
// Cette route est gérée par Vako
|
|
223
|
+
// Pour personnaliser, modifiez ce fichier
|
|
224
|
+
|
|
225
|
+
if (req.method !== '${route.method}') {
|
|
226
|
+
return res.status(405).json({ error: 'Method not allowed' });
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Rediriger vers le handler Vako
|
|
230
|
+
// Note: Vous devez configurer le proxy ou utiliser le middleware
|
|
231
|
+
return res.status(200).json({
|
|
232
|
+
message: 'Route handled by Vako',
|
|
233
|
+
route: '${route.path}',
|
|
234
|
+
method: '${route.method}'
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
`;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
module.exports = NextJsAdapter;
|
package/lib/app.js
CHANGED
|
@@ -223,9 +223,9 @@ class App {
|
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
} else if (updateInfo.needsInstall && !silent) {
|
|
226
|
-
this.log('warning', '
|
|
226
|
+
this.log('warning', 'Vako non installé correctement', '⚠️ Réinstallation requise');
|
|
227
227
|
} else if (!updateInfo.hasUpdate && !silent) {
|
|
228
|
-
this.log('success', '
|
|
228
|
+
this.log('success', 'Vako à jour', `✅ Version ${updateInfo.currentVersion || 'inconnue'}`);
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
return updateInfo;
|
|
@@ -264,7 +264,7 @@ class App {
|
|
|
264
264
|
// Notification optionnelle de redémarrage
|
|
265
265
|
if (this.options.autoUpdater.showNotifications) {
|
|
266
266
|
console.log('\n' + '═'.repeat(60));
|
|
267
|
-
console.log('\x1b[32m\x1b[1m🎉 MISE À JOUR
|
|
267
|
+
console.log('\x1b[32m\x1b[1m🎉 MISE À JOUR VAKO RÉUSSIE!\x1b[0m');
|
|
268
268
|
console.log('\x1b[33m⚠️ Redémarrez l\'application pour appliquer les changements\x1b[0m');
|
|
269
269
|
console.log('═'.repeat(60) + '\n');
|
|
270
270
|
}
|
|
@@ -331,7 +331,7 @@ class App {
|
|
|
331
331
|
if (!this.autoUpdaterActive) return;
|
|
332
332
|
|
|
333
333
|
// Route pour vérifier les mises à jour
|
|
334
|
-
this.app.get('/
|
|
334
|
+
this.app.get('/_vako/updates/check', async (req, res) => {
|
|
335
335
|
try {
|
|
336
336
|
const updateInfo = await this.checkForUpdates(true);
|
|
337
337
|
res.json(updateInfo);
|
|
@@ -341,7 +341,7 @@ class App {
|
|
|
341
341
|
});
|
|
342
342
|
|
|
343
343
|
// Route pour déclencher une mise à jour
|
|
344
|
-
this.app.post('/
|
|
344
|
+
this.app.post('/_vako/updates/perform', async (req, res) => {
|
|
345
345
|
try {
|
|
346
346
|
const updateInfo = await this.checkForUpdates(true);
|
|
347
347
|
if (updateInfo.hasUpdate) {
|
|
@@ -356,12 +356,12 @@ class App {
|
|
|
356
356
|
});
|
|
357
357
|
|
|
358
358
|
// Route pour les statistiques
|
|
359
|
-
this.app.get('/
|
|
359
|
+
this.app.get('/_vako/updates/stats', (req, res) => {
|
|
360
360
|
res.json(this.getAutoUpdaterInfo());
|
|
361
361
|
});
|
|
362
362
|
|
|
363
363
|
// Route pour effectuer un rollback
|
|
364
|
-
this.app.post('/
|
|
364
|
+
this.app.post('/_vako/updates/rollback', async (req, res) => {
|
|
365
365
|
try {
|
|
366
366
|
const { backupPath } = req.body;
|
|
367
367
|
const success = await this.rollbackUpdate(backupPath);
|
|
@@ -371,7 +371,7 @@ class App {
|
|
|
371
371
|
}
|
|
372
372
|
});
|
|
373
373
|
|
|
374
|
-
this.log('info', 'Routes auto-updater configurées', '🔗 /
|
|
374
|
+
this.log('info', 'Routes auto-updater configurées', '🔗 /_vako/updates/*');
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
async init() {
|
|
@@ -573,7 +573,7 @@ class App {
|
|
|
573
573
|
console.log('\n' + '═'.repeat(60));
|
|
574
574
|
console.log(`\x1b[35m\x1b[1m
|
|
575
575
|
╔══════════════════════════════════════════════════════╗
|
|
576
|
-
║ 🚀
|
|
576
|
+
║ 🚀 VAKO 🚀 ║
|
|
577
577
|
╚══════════════════════════════════════════════════════╝\x1b[0m`);
|
|
578
578
|
|
|
579
579
|
this.logger.log('server', 'Server started successfully', `🌐 http://localhost:${port}`);
|
|
@@ -583,7 +583,7 @@ class App {
|
|
|
583
583
|
try {
|
|
584
584
|
const autoUpdaterInfo = this.getAutoUpdaterInfo();
|
|
585
585
|
if (autoUpdaterInfo.currentVersion) {
|
|
586
|
-
this.logger.log('info', 'Auto-updater active', `🔄 Version
|
|
586
|
+
this.logger.log('info', 'Auto-updater active', `🔄 Version Vako: ${autoUpdaterInfo.currentVersion}`);
|
|
587
587
|
this.logger.log('info', 'Canal de mise à jour', `📢 ${autoUpdaterInfo.config.updateChannel}`);
|
|
588
588
|
}
|
|
589
589
|
|
package/lib/core/auth-manager.js
CHANGED
|
@@ -14,7 +14,7 @@ class AuthManager {
|
|
|
14
14
|
mysql: {
|
|
15
15
|
host: 'localhost',
|
|
16
16
|
port: 3306,
|
|
17
|
-
database: '
|
|
17
|
+
database: 'vako_auth',
|
|
18
18
|
username: 'root',
|
|
19
19
|
password: ''
|
|
20
20
|
}
|
|
@@ -358,7 +358,7 @@ class AuthManager {
|
|
|
358
358
|
secret: this.config.session.secret,
|
|
359
359
|
resave: false,
|
|
360
360
|
saveUninitialized: false,
|
|
361
|
-
name: '
|
|
361
|
+
name: 'vako.sid', // Nom personnalisé pour masquer l'usage d'Express
|
|
362
362
|
cookie: {
|
|
363
363
|
maxAge: this.config.session.maxAge,
|
|
364
364
|
secure: this.config.session.secure,
|