@materializecms/cli 0.2.0 → 0.3.0
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 +8 -0
- package/LICENSE +1 -1
- package/package.json +10 -5
- package/src/commands.js +58 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ Ogni versione, dalla più recente. Le novità in arrivo si scrivono sotto «Pros
|
|
|
4
4
|
|
|
5
5
|
## Prossima versione
|
|
6
6
|
|
|
7
|
+
## 0.3.0 — 2026-11-01
|
|
8
|
+
|
|
9
|
+
- **Backup fuori dal server**, ogni notte e cifrati, su uno spazio S3 compatibile (Cloudflare R2, Backblaze B2, Hetzner, Amazon S3…) o in una cartella WebDAV (Nextcloud, NAS Synology e QNAP…). Si attiva in Impostazioni → Backup; `materialize decrypt` rende di nuovo leggibili i file scaricati.
|
|
10
|
+
- **Email più facile da configurare**: si sceglie il fornitore (Brevo, Postmark, Mailgun, Amazon SES, Gmail…) e il server si compila da solo; se la prova non riesce, il pannello spiega perché (porta bloccata, password rifiutata, mittente non verificato…); **Controlla il dominio** verifica SPF, DKIM e DMARC.
|
|
11
|
+
- **Pannello più chiaro**: Impostazioni → Protezione divisa in Sicurezza, Backup e Registro attività; barra dell'editor a gruppi, con gli elementi meno usati in **⋯**; pannello sinistro dell'editor allargabile; menu a tendina, intestazioni e testi d'aiuto uniformi e più leggibili; pagina dedicata per gli indirizzi del pannello che non esistono; in Persone, chi entra con la sola password si riconosce a colpo d'occhio; accesso e installazione con l'aspetto del pannello.
|
|
12
|
+
- **Chi ha fatto ogni versione**: la cronologia mostra il nome dell'autore accanto alla data.
|
|
13
|
+
- **Informazioni su Materialize** in Impostazioni: versione, autore, licenza, novità, guida e licenze di terzi.
|
|
14
|
+
|
|
7
15
|
## 0.2.0 — 2026-11-01
|
|
8
16
|
|
|
9
17
|
- **Password dimenticata?** nella pagina di accesso: un link per email, valido un'ora. Senza email configurata, il comando `materialize reset-password` stampa il link sul server, anche per l'unico amministratore.
|
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@materializecms/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Il comando materialize: sviluppo, produzione con aggiornamenti dal pannello, generazione del sito, backup, MCP.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@materializecms/astro": "0.
|
|
25
|
-
"@materializecms/core": "0.
|
|
26
|
-
"@materializecms/db": "0.
|
|
27
|
-
"@materializecms/server": "0.
|
|
24
|
+
"@materializecms/astro": "0.3.0",
|
|
25
|
+
"@materializecms/core": "0.3.0",
|
|
26
|
+
"@materializecms/db": "0.3.0",
|
|
27
|
+
"@materializecms/server": "0.3.0",
|
|
28
28
|
"@modelcontextprotocol/sdk": "1.32.2"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
@@ -42,6 +42,11 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"changelog": [
|
|
45
|
+
{
|
|
46
|
+
"version": "0.3.0",
|
|
47
|
+
"date": "2026-11-01",
|
|
48
|
+
"notes": "- **Backup fuori dal server**, ogni notte e cifrati, su uno spazio S3 compatibile (Cloudflare R2, Backblaze B2, Hetzner, Amazon S3…) o in una cartella WebDAV (Nextcloud, NAS Synology e QNAP…). Si attiva in Impostazioni → Backup; `materialize decrypt` rende di nuovo leggibili i file scaricati.\n- **Email più facile da configurare**: si sceglie il fornitore (Brevo, Postmark, Mailgun, Amazon SES, Gmail…) e il server si compila da solo; se la prova non riesce, il pannello spiega perché (porta bloccata, password rifiutata, mittente non verificato…); **Controlla il dominio** verifica SPF, DKIM e DMARC.\n- **Pannello più chiaro**: Impostazioni → Protezione divisa in Sicurezza, Backup e Registro attività; barra dell'editor a gruppi, con gli elementi meno usati in **⋯**; pannello sinistro dell'editor allargabile; menu a tendina, intestazioni e testi d'aiuto uniformi e più leggibili; pagina dedicata per gli indirizzi del pannello che non esistono; in Persone, chi entra con la sola password si riconosce a colpo d'occhio; accesso e installazione con l'aspetto del pannello.\n- **Chi ha fatto ogni versione**: la cronologia mostra il nome dell'autore accanto alla data.\n- **Informazioni su Materialize** in Impostazioni: versione, autore, licenza, novità, guida e licenze di terzi."
|
|
49
|
+
},
|
|
45
50
|
{
|
|
46
51
|
"version": "0.2.0",
|
|
47
52
|
"date": "2026-11-01",
|
package/src/commands.js
CHANGED
|
@@ -5,7 +5,7 @@ import { dirname, join, relative, resolve } from 'node:path';
|
|
|
5
5
|
import { styleText } from 'node:util';
|
|
6
6
|
import { resolveRedirect } from '@materializecms/core/seo';
|
|
7
7
|
import { createActivityStore, createAuthStore, createContentStore, createSettingsStore, openDatabase, } from '@materializecms/db';
|
|
8
|
-
import { apiCaller, createFonts, createMcpServer, createMediaFiles, extractTarGz, restoreMedia, startServer, VERSION, } from '@materializecms/server';
|
|
8
|
+
import { apiCaller, createFonts, createMcpServer, createMediaFiles, decryptTree, extractTarGz, parseRecoveryKey, restoreMedia, startServer, VERSION, } from '@materializecms/server';
|
|
9
9
|
import { findConfig, loadConfig } from './load-config.js';
|
|
10
10
|
import { buildSite, exportFonts, exportMedia, hasSite, ProductionSite, startDevSite } from './site.js';
|
|
11
11
|
import { RESTART } from './supervisor.js';
|
|
@@ -28,6 +28,9 @@ ${accent('materialize')} ${dim(VERSION)}
|
|
|
28
28
|
materialize reset-password <email>
|
|
29
29
|
Un link per una nuova password, valido un'ora: per chi non può riceverlo per email
|
|
30
30
|
(per esempio l'unico amministratore, senza email configurata)
|
|
31
|
+
materialize decrypt <cartella o file> [--key <chiave>]
|
|
32
|
+
Decifra i backup scaricati dallo spazio esterno (S3, WebDAV); la chiave di
|
|
33
|
+
ripristino si può dare anche con MATERIALIZE_BACKUP_KEY
|
|
31
34
|
materialize --help Mostra questo aiuto
|
|
32
35
|
|
|
33
36
|
Opzioni
|
|
@@ -402,6 +405,57 @@ async function resetPassword(args) {
|
|
|
402
405
|
database.close();
|
|
403
406
|
}
|
|
404
407
|
}
|
|
408
|
+
/**
|
|
409
|
+
* The backups sent outside the server, downloaded with any tool, made readable again: every .mzb
|
|
410
|
+
* file is decrypted next to itself. The key comes from --key, MATERIALIZE_BACKUP_KEY or, in the
|
|
411
|
+
* folder of a site that still has its database, from its settings.
|
|
412
|
+
*/
|
|
413
|
+
async function decrypt(args) {
|
|
414
|
+
const flag = args.indexOf('--key');
|
|
415
|
+
const source = args.find((a, i) => !a.startsWith('--') && (flag < 0 || i !== flag + 1));
|
|
416
|
+
if (!source) {
|
|
417
|
+
console.error(fail('Indica la cartella (o il file) da decifrare: materialize decrypt <cartella> --key <chiave>'));
|
|
418
|
+
process.exit(1);
|
|
419
|
+
}
|
|
420
|
+
let text = flag >= 0 ? args[flag + 1] : process.env.MATERIALIZE_BACKUP_KEY;
|
|
421
|
+
if (!text) {
|
|
422
|
+
const path = findConfig(process.cwd());
|
|
423
|
+
if (path) {
|
|
424
|
+
const database = await openDatabase((await loadConfig(path)).database).catch(() => null);
|
|
425
|
+
if (database) {
|
|
426
|
+
text = (await createSettingsStore(database.db).get('offsite'))?.key;
|
|
427
|
+
database.close();
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if (!text) {
|
|
432
|
+
console.error(fail('Manca la chiave di ripristino: --key mzk1-… oppure MATERIALIZE_BACKUP_KEY.'));
|
|
433
|
+
process.exit(1);
|
|
434
|
+
}
|
|
435
|
+
let key;
|
|
436
|
+
try {
|
|
437
|
+
key = parseRecoveryKey(text);
|
|
438
|
+
}
|
|
439
|
+
catch (error) {
|
|
440
|
+
console.error(fail(describeError(error)));
|
|
441
|
+
process.exit(1);
|
|
442
|
+
}
|
|
443
|
+
try {
|
|
444
|
+
const done = await decryptTree(resolve(source), key);
|
|
445
|
+
console.log(` ${ok('✓')} ${done.length} ${done.length === 1 ? 'file decifrato' : 'file decifrati'}, accanto agli originali.`);
|
|
446
|
+
const db = done
|
|
447
|
+
.filter((f) => /content-[^/\\]+\.db$/.test(f))
|
|
448
|
+
.sort()
|
|
449
|
+
.at(-1);
|
|
450
|
+
if (db)
|
|
451
|
+
// The shorter of the two ways to write the path.
|
|
452
|
+
console.log(dim(` Per rimettere il database (a server fermo): npx materialize restore ${[relative(process.cwd(), db), db].sort((x, y) => x.length - y.length)[0]}`));
|
|
453
|
+
}
|
|
454
|
+
catch (error) {
|
|
455
|
+
console.error(fail(describeError(error)));
|
|
456
|
+
process.exit(1);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
405
459
|
const [command = 'help', ...args] = process.argv.slice(2);
|
|
406
460
|
if (command === 'dev' || command === 'start' || command === 'build') {
|
|
407
461
|
await run(command, args);
|
|
@@ -409,6 +463,9 @@ if (command === 'dev' || command === 'start' || command === 'build') {
|
|
|
409
463
|
else if (command === 'mcp') {
|
|
410
464
|
await mcp(args);
|
|
411
465
|
}
|
|
466
|
+
else if (command === 'decrypt') {
|
|
467
|
+
await decrypt(args);
|
|
468
|
+
}
|
|
412
469
|
else if (command === 'reset-password') {
|
|
413
470
|
await resetPassword(args);
|
|
414
471
|
}
|