create-orqevio 1.1.1 → 1.2.1

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.
Files changed (2) hide show
  1. package/dist/cli.js +181 -22
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -18,6 +18,7 @@ var DEFAULT_NAME = "orqevio";
18
18
  var NAME = /^[a-z0-9](?:[a-z0-9-]{0,48}[a-z0-9])?$/;
19
19
  var isValidName = (name) => NAME.test(name);
20
20
  var bucketName = (name) => `${name}-uploads`;
21
+ var backupBucketName = (name) => `${name}-backups`;
21
22
  function loadOrqevio(from = import.meta.url) {
22
23
  const require2 = createRequire(from);
23
24
  const manifest = require2.resolve("orqevio/package.json");
@@ -26,15 +27,16 @@ function loadOrqevio(from = import.meta.url) {
26
27
  const base = JSON.parse(readFileSync(path.join(dir, "dist/wrangler.json"), "utf8"));
27
28
  return { dir: path.join(dir, "dist"), version, base };
28
29
  }
29
- function copyConfig(base, distDir, name, install = "cli", bucket = bucketName(name)) {
30
+ function copyConfig(base, distDir, name, install = "cli", bucket = bucketName(name), backupBucket = backupBucketName(name)) {
31
+ const names = { UPLOADS: bucket, BACKUPS: backupBucket };
30
32
  return {
31
33
  ...base,
32
34
  name,
33
35
  // Other variables set in the dashboard are kept (keep_vars below).
34
- vars: { ...base.vars, ORQEVIO_INSTALL: install, ORQEVIO_COPY_NAME: name, ORQEVIO_BUCKET: bucket },
36
+ vars: { ...base.vars, ORQEVIO_INSTALL: install, ORQEVIO_COPY_NAME: name, ORQEVIO_BUCKET: bucket, ORQEVIO_BACKUP_BUCKET: backupBucket },
35
37
  main: path.join(distDir, base.main),
36
38
  assets: { ...base.assets, directory: path.join(distDir, base.assets.directory) },
37
- r2_buckets: base.r2_buckets.map((binding) => binding.binding === "UPLOADS" ? { ...binding, bucket_name: bucket } : binding),
39
+ r2_buckets: base.r2_buckets.map((binding) => names[binding.binding] ? { ...binding, bucket_name: names[binding.binding] } : binding),
38
40
  // Variables the owner set in the Cloudflare dashboard (APP_URL, MAX_UPLOAD_MB) survive updates.
39
41
  keep_vars: true
40
42
  };
@@ -89,6 +91,8 @@ Du brauchst ein Cloudflare-Konto (der kostenlose Plan reicht aus). Beim ersten M
89
91
  sich dein Browser, damit du dich anmelden kannst.`,
90
92
  no: /^n/i,
91
93
  yesNo: "[J/n]",
94
+ yes: /^j/i,
95
+ noYes: "[j/N]",
92
96
  extraArgument: (arg) => `Unerwartetes Argument \u201E${arg}\u201C.`,
93
97
  unknownOption: (option) => `Unbekannte Option \u201E${option}\u201C.`,
94
98
  missingValue: (option) => `Die Option \u201E${option}\u201C braucht einen Wert.`,
@@ -182,6 +186,22 @@ Deine Instanz l\xE4uft jetzt mit Orqevio ${version}: ${address}`,
182
186
  "Der Installer kann deine Instanz die Anh\xE4nge l\xF6schen lassen: Er autorisiert sie \xFCber dein Cloudflare-Konto, ohne deinen Zugangsschl\xFCssel.",
183
187
  "Lass die Antwort leer, wenn du es anders machen willst."
184
188
  ].join("\n"),
189
+ askDeleteBackups: (bucket) => `Auch die Sicherungen l\xF6schen? Der Bucket \u201E${bucket}\u201C enth\xE4lt die letzten 7 t\xE4glichen Sicherungen: Beh\xE4ltst du ihn, kann eine mit demselben Namen neu installierte Instanz sie wiederherstellen.`,
190
+ emptyingBackupsThroughCopy: (bucket) => [
191
+ "",
192
+ `Der Bucket \u201E${bucket}\u201C enth\xE4lt noch Sicherungen, und Cloudflare l\xF6scht nur leere Buckets.`,
193
+ "Das Installationsprogramm kann deine Instanz bitten, sie zu l\xF6schen: Es autorisiert sie \xFCber dein Cloudflare-Konto, ohne deinen Zugangsschl\xFCssel.",
194
+ "Lass die Antwort leer, um es anders zu machen."
195
+ ].join("\n"),
196
+ backupsNotEmpty: (bucket, retryCommand) => [
197
+ "",
198
+ `Der Bucket \u201E${bucket}\u201C enth\xE4lt noch Sicherungen, und Cloudflare l\xF6scht nur leere Buckets. Es wurde nichts gel\xF6scht.`,
199
+ `Leere ihn im Cloudflare-Dashboard (R2 \u2192 ${bucket} \u2192 Settings \u2192 Empty Bucket) und f\xFChre dann ${retryCommand} noch einmal aus.`
200
+ ].join("\n"),
201
+ backupsKept: (bucket, installCommand) => [
202
+ `Die Sicherungen bleiben im Bucket \u201E${bucket}\u201C. Um sie zur\xFCckzuholen, installiere eine Instanz mit demselben Namen (${installCommand}) und stelle eine unter Einstellungen \u2192 Sicherungen wieder her.`,
203
+ `Um sie zu l\xF6schen, leere und l\xF6sche diesen Bucket im Cloudflare-Dashboard: R2 \u2192 ${bucket}.`
204
+ ].join("\n"),
185
205
  askAddress: (name) => `Adresse deiner Instanz (zum Beispiel https://${name}.<deine-subdomain>.workers.dev): `,
186
206
  badAddress: (address) => `\u201E${address}\u201C ist keine Adresse: Nimm die, die du im Browser \xF6ffnest.`,
187
207
  notOrqevio: (origin) => `Unter ${origin} antwortet keine Orqevio-Instanz.`,
@@ -215,6 +235,8 @@ You need a Cloudflare account (the free plan is enough). The first time, your br
215
235
  opens so you can sign in.`,
216
236
  no: /^n/i,
217
237
  yesNo: "[Y/n]",
238
+ yes: /^y/i,
239
+ noYes: "[y/N]",
218
240
  extraArgument: (arg) => `Unexpected \u201C${arg}\u201D.`,
219
241
  unknownOption: (option) => `Unknown option \u201C${option}\u201D.`,
220
242
  missingValue: (option) => `\u201C${option}\u201D needs a value.`,
@@ -307,6 +329,22 @@ Your copy is updated to Orqevio ${version}: ${address}`,
307
329
  "The installer can have your copy delete them: it authorizes the copy from your Cloudflare account, with no need for your access key.",
308
330
  "Leave the answer blank to do it another way."
309
331
  ].join("\n"),
332
+ askDeleteBackups: (bucket) => `Delete its backups too? The bucket \u201C${bucket}\u201D keeps its last 7 daily backups: keep it, and a copy you install again with the same name can restore them.`,
333
+ emptyingBackupsThroughCopy: (bucket) => [
334
+ "",
335
+ `The bucket \u201C${bucket}\u201D still holds backups, and Cloudflare only deletes empty buckets.`,
336
+ "The installer can have your copy delete them: it authorizes the copy from your Cloudflare account, with no need for your access key.",
337
+ "Leave the answer blank to do it another way."
338
+ ].join("\n"),
339
+ backupsNotEmpty: (bucket, retryCommand) => [
340
+ "",
341
+ `The bucket \u201C${bucket}\u201D still holds backups, and Cloudflare only deletes empty buckets. Nothing was deleted.`,
342
+ `Empty it in the Cloudflare dashboard (R2 \u2192 ${bucket} \u2192 Settings \u2192 Empty Bucket), then run ${retryCommand} again.`
343
+ ].join("\n"),
344
+ backupsKept: (bucket, installCommand) => [
345
+ `Its backups stay in the bucket \u201C${bucket}\u201D. To bring them back, install a copy with the same name (${installCommand}) and restore one in Settings \u2192 Backups.`,
346
+ `To delete them, empty and delete that bucket in the Cloudflare dashboard: R2 \u2192 ${bucket}.`
347
+ ].join("\n"),
310
348
  askAddress: (name) => `Address of your copy (for example https://${name}.<your-subdomain>.workers.dev): `,
311
349
  badAddress: (address) => `\u201C${address}\u201D isn\u2019t an address: use the one you open in the browser.`,
312
350
  notOrqevio: (origin) => `There\u2019s no copy of Orqevio answering at ${origin}.`,
@@ -340,6 +378,8 @@ Necesitas una cuenta de Cloudflare (el plan gratuito basta). La primera vez se a
340
378
  navegador para que inicies sesi\xF3n.`,
341
379
  no: /^n/i,
342
380
  yesNo: "[S/n]",
381
+ yes: /^s/i,
382
+ noYes: "[s/N]",
343
383
  extraArgument: (arg) => `Sobra \xAB${arg}\xBB.`,
344
384
  unknownOption: (option) => `No conozco la opci\xF3n \xAB${option}\xBB.`,
345
385
  missingValue: (option) => `\xAB${option}\xBB necesita un valor.`,
@@ -432,6 +472,22 @@ Tu copia est\xE1 actualizada a Orqevio ${version}: ${address}`,
432
472
  "El instalador puede pedirle a tu copia que los borre: la autoriza desde tu cuenta de Cloudflare, sin necesidad de tu clave de acceso.",
433
473
  "Deja la respuesta en blanco si prefieres hacerlo de otra forma."
434
474
  ].join("\n"),
475
+ askDeleteBackups: (bucket) => `\xBFBorrar tambi\xE9n sus copias de seguridad? El bucket \xAB${bucket}\xBB guarda sus 7 \xFAltimas copias diarias: si lo conservas, una copia que vuelvas a instalar con el mismo nombre podr\xE1 restaurarlas.`,
476
+ emptyingBackupsThroughCopy: (bucket) => [
477
+ "",
478
+ `El bucket \xAB${bucket}\xBB todav\xEDa guarda copias de seguridad, y Cloudflare solo borra buckets vac\xEDos.`,
479
+ "El instalador puede pedirle a tu copia que las borre: la autoriza desde tu cuenta de Cloudflare, sin necesidad de tu clave de acceso.",
480
+ "Deja la respuesta en blanco para hacerlo de otra forma."
481
+ ].join("\n"),
482
+ backupsNotEmpty: (bucket, retryCommand) => [
483
+ "",
484
+ `El bucket \xAB${bucket}\xBB todav\xEDa guarda copias de seguridad, y Cloudflare solo borra buckets vac\xEDos. No se ha borrado nada.`,
485
+ `Vac\xEDalo en el panel de Cloudflare (R2 \u2192 ${bucket} \u2192 Settings \u2192 Empty Bucket) y vuelve a ejecutar ${retryCommand}.`
486
+ ].join("\n"),
487
+ backupsKept: (bucket, installCommand) => [
488
+ `Sus copias de seguridad siguen en el bucket \xAB${bucket}\xBB. Para recuperarlas, instala una copia con el mismo nombre (${installCommand}) y restaura una en Ajustes \u2192 Copias de seguridad.`,
489
+ `Para borrarlas, vac\xEDa y borra ese bucket en el panel de Cloudflare: R2 \u2192 ${bucket}.`
490
+ ].join("\n"),
435
491
  askAddress: (name) => `Direcci\xF3n de tu copia (por ejemplo, https://${name}.<tu-subdominio>.workers.dev): `,
436
492
  badAddress: (address) => `\xAB${address}\xBB no es una direcci\xF3n: usa la que abres en el navegador.`,
437
493
  notOrqevio: (origin) => `En ${origin} no responde ninguna copia de Orqevio.`,
@@ -465,6 +521,8 @@ Il vous faut un compte Cloudflare (l\u2019offre gratuite suffit). La premi\xE8re
465
521
  navigateur s\u2019ouvre pour que vous puissiez vous connecter.`,
466
522
  no: /^n/i,
467
523
  yesNo: "[O/n]",
524
+ yes: /^o/i,
525
+ noYes: "[o/N]",
468
526
  extraArgument: (arg) => `Argument inattendu : \xAB ${arg} \xBB.`,
469
527
  unknownOption: (option) => `Option inconnue : \xAB ${option} \xBB.`,
470
528
  missingValue: (option) => `L\u2019option \xAB ${option} \xBB attend une valeur.`,
@@ -558,6 +616,22 @@ Votre copie est pass\xE9e \xE0 Orqevio ${version} : ${address}`,
558
616
  "L\u2019installateur peut demander \xE0 votre copie de les supprimer : il l\u2019y autorise depuis votre compte Cloudflare, sans votre cl\xE9 d\u2019acc\xE8s.",
559
617
  "Laissez la r\xE9ponse vide pour proc\xE9der autrement."
560
618
  ].join("\n"),
619
+ askDeleteBackups: (bucket) => `Supprimer aussi ses sauvegardes ? Le bucket \xAB ${bucket} \xBB garde ses 7 derni\xE8res sauvegardes quotidiennes : si vous le gardez, une copie r\xE9install\xE9e avec le m\xEAme nom pourra les restaurer.`,
620
+ emptyingBackupsThroughCopy: (bucket) => [
621
+ "",
622
+ `Le bucket \xAB ${bucket} \xBB contient encore des sauvegardes, et Cloudflare ne supprime que les buckets vides.`,
623
+ "L\u2019installateur peut demander \xE0 votre copie de les supprimer : il l\u2019autorise depuis votre compte Cloudflare, sans votre cl\xE9 d\u2019acc\xE8s.",
624
+ "Laissez la r\xE9ponse vide pour le faire autrement."
625
+ ].join("\n"),
626
+ backupsNotEmpty: (bucket, retryCommand) => [
627
+ "",
628
+ `Le bucket \xAB ${bucket} \xBB contient encore des sauvegardes, et Cloudflare ne supprime que les buckets vides. Rien n\u2019a \xE9t\xE9 supprim\xE9.`,
629
+ `Videz-le dans le tableau de bord Cloudflare (R2 \u2192 ${bucket} \u2192 Settings \u2192 Empty Bucket), puis relancez ${retryCommand}.`
630
+ ].join("\n"),
631
+ backupsKept: (bucket, installCommand) => [
632
+ `Ses sauvegardes restent dans le bucket \xAB ${bucket} \xBB. Pour les r\xE9cup\xE9rer, installez une copie avec le m\xEAme nom (${installCommand}) et restaurez-en une dans Param\xE8tres \u2192 Sauvegardes.`,
633
+ `Pour les supprimer, videz puis supprimez ce bucket dans le tableau de bord Cloudflare : R2 \u2192 ${bucket}.`
634
+ ].join("\n"),
561
635
  askAddress: (name) => `Adresse de votre copie (par exemple https://${name}.<votre-sous-domaine>.workers.dev) : `,
562
636
  badAddress: (address) => `\xAB ${address} \xBB n\u2019est pas une adresse : utilisez celle que vous ouvrez dans le navigateur.`,
563
637
  notOrqevio: (origin) => `Aucune copie d\u2019Orqevio ne r\xE9pond \xE0 ${origin}.`,
@@ -591,6 +665,8 @@ Ti serve un account Cloudflare (basta il piano gratuito). La prima volta si apre
591
665
  per farti accedere.`,
592
666
  no: /^n/i,
593
667
  yesNo: "[S/n]",
668
+ yes: /^s/i,
669
+ noYes: "[s/N]",
594
670
  extraArgument: (arg) => `Argomento inatteso: \xAB${arg}\xBB.`,
595
671
  unknownOption: (option) => `Opzione sconosciuta: \xAB${option}\xBB.`,
596
672
  missingValue: (option) => `L\u2019opzione \xAB${option}\xBB richiede un valore.`,
@@ -684,6 +760,22 @@ La tua copia \xE8 stata aggiornata a Orqevio ${version}: ${address}`,
684
760
  "L\u2019installer pu\xF2 chiedere alla tua copia di eliminarli: la autorizza dal tuo account Cloudflare, senza bisogno della tua chiave di accesso.",
685
761
  "Lascia la risposta vuota se preferisci farlo in un altro modo."
686
762
  ].join("\n"),
763
+ askDeleteBackups: (bucket) => `Eliminare anche i suoi backup? Il bucket \xAB${bucket}\xBB conserva gli ultimi 7 backup giornalieri: se lo tieni, una copia installata di nuovo con lo stesso nome potr\xE0 ripristinarli.`,
764
+ emptyingBackupsThroughCopy: (bucket) => [
765
+ "",
766
+ `Il bucket \xAB${bucket}\xBB contiene ancora dei backup, e Cloudflare elimina solo i bucket vuoti.`,
767
+ "L\u2019installer pu\xF2 chiedere alla tua copia di eliminarli: la autorizza dal tuo account Cloudflare, senza bisogno della tua chiave di accesso.",
768
+ "Lascia la risposta vuota per farlo in un altro modo."
769
+ ].join("\n"),
770
+ backupsNotEmpty: (bucket, retryCommand) => [
771
+ "",
772
+ `Il bucket \xAB${bucket}\xBB contiene ancora dei backup, e Cloudflare elimina solo i bucket vuoti. Non \xE8 stato eliminato niente.`,
773
+ `Svuotalo nella dashboard di Cloudflare (R2 \u2192 ${bucket} \u2192 Settings \u2192 Empty Bucket), poi esegui di nuovo ${retryCommand}.`
774
+ ].join("\n"),
775
+ backupsKept: (bucket, installCommand) => [
776
+ `I suoi backup restano nel bucket \xAB${bucket}\xBB. Per recuperarli, installa una copia con lo stesso nome (${installCommand}) e ripristinane uno in Impostazioni \u2192 Backup.`,
777
+ `Per eliminarli, svuota ed elimina quel bucket nella dashboard di Cloudflare: R2 \u2192 ${bucket}.`
778
+ ].join("\n"),
687
779
  askAddress: (name) => `Indirizzo della tua copia (per esempio https://${name}.<tuo-sottodominio>.workers.dev): `,
688
780
  badAddress: (address) => `\xAB${address}\xBB non \xE8 un indirizzo: usa quello che apri nel browser.`,
689
781
  notOrqevio: (origin) => `Nessuna copia di Orqevio risponde a ${origin}.`,
@@ -718,6 +810,8 @@ Cloudflare\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u5FC5\u8981\u3067\u3059\uFF08\u71
718
810
  // n, no, いいえ, and the full-width n that a Japanese input method may type.
719
811
  no: /^(n|n|いいえ)/i,
720
812
  yesNo: "[Y/n]",
813
+ yes: /^(y|y|はい)/i,
814
+ noYes: "[y/N]",
721
815
  extraArgument: (arg) => `\u4E88\u671F\u3057\u306A\u3044\u5F15\u6570\u300C${arg}\u300D\u304C\u3042\u308A\u307E\u3059\u3002`,
722
816
  unknownOption: (option) => `\u4E0D\u660E\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u300C${option}\u300D\u3067\u3059\u3002`,
723
817
  missingValue: (option) => `\u30AA\u30D7\u30B7\u30E7\u30F3\u300C${option}\u300D\u306B\u306F\u5024\u304C\u5FC5\u8981\u3067\u3059\u3002`,
@@ -811,6 +905,22 @@ Orqevio ${version}\u3078\u306E\u66F4\u65B0\u304C\u5B8C\u4E86\u3057\u307E\u3057\u
811
905
  "\u30A4\u30F3\u30B9\u30C8\u30FC\u30E9\u30FC\u304CCloudflare\u30A2\u30AB\u30A6\u30F3\u30C8\u304B\u3089Orqevio\u306B\u8A31\u53EF\u3092\u4E0E\u3048\u3001\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u3092\u524A\u9664\u3055\u305B\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u30A2\u30AF\u30BB\u30B9\u30AD\u30FC\u306F\u4E0D\u8981\u3067\u3059\u3002",
812
906
  "\u5225\u306E\u65B9\u6CD5\u3067\u884C\u3046\u5834\u5408\u306F\u3001\u4F55\u3082\u5165\u529B\u305B\u305A\u306BEnter\u3092\u62BC\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
813
907
  ].join("\n"),
908
+ askDeleteBackups: (bucket) => `\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u3082\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F \u30D0\u30B1\u30C3\u30C8\u300C${bucket}\u300D\u306B\u306F\u76F4\u8FD17\u65E5\u5206\u306E\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u304C\u3042\u308A\u307E\u3059\u3002\u6B8B\u3057\u3066\u304A\u3051\u3070\u3001\u540C\u3058\u540D\u524D\u3067\u5165\u308C\u76F4\u3057\u305FOrqevio\u3067\u5FA9\u5143\u3067\u304D\u307E\u3059\u3002`,
909
+ emptyingBackupsThroughCopy: (bucket) => [
910
+ "",
911
+ `\u30D0\u30B1\u30C3\u30C8\u300C${bucket}\u300D\u306B\u306F\u307E\u3060\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u304C\u3042\u308A\u3001Cloudflare\u306F\u7A7A\u306E\u30D0\u30B1\u30C3\u30C8\u3057\u304B\u524A\u9664\u3067\u304D\u307E\u305B\u3093\u3002`,
912
+ "\u30A4\u30F3\u30B9\u30C8\u30FC\u30E9\u30FC\u304B\u3089Orqevio\u306B\u524A\u9664\u3092\u983C\u3081\u307E\u3059\u3002\u30A2\u30AF\u30BB\u30B9\u30AD\u30FC\u306F\u4E0D\u8981\u3067\u3001\u3042\u306A\u305F\u306ECloudflare\u30A2\u30AB\u30A6\u30F3\u30C8\u304B\u3089\u8A31\u53EF\u3057\u307E\u3059\u3002",
913
+ "\u5225\u306E\u65B9\u6CD5\u3067\u884C\u3046\u5834\u5408\u306F\u3001\u4F55\u3082\u5165\u529B\u305B\u305A\u306BEnter\u3092\u62BC\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
914
+ ].join("\n"),
915
+ backupsNotEmpty: (bucket, retryCommand) => [
916
+ "",
917
+ `\u30D0\u30B1\u30C3\u30C8\u300C${bucket}\u300D\u306B\u306F\u307E\u3060\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u304C\u3042\u308A\u3001Cloudflare\u306F\u7A7A\u306E\u30D0\u30B1\u30C3\u30C8\u3057\u304B\u524A\u9664\u3067\u304D\u307E\u305B\u3093\u3002\u4F55\u3082\u524A\u9664\u3057\u3066\u3044\u307E\u305B\u3093\u3002`,
918
+ `Cloudflare\u306E\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\uFF08R2 \u2192 ${bucket} \u2192 Settings \u2192 Empty Bucket\uFF09\u3067\u7A7A\u306B\u3057\u3066\u304B\u3089\u3001\u3082\u3046\u4E00\u5EA6 ${retryCommand} \u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002`
919
+ ].join("\n"),
920
+ backupsKept: (bucket, installCommand) => [
921
+ `\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306F\u30D0\u30B1\u30C3\u30C8\u300C${bucket}\u300D\u306B\u6B8B\u3063\u3066\u3044\u307E\u3059\u3002\u623B\u3059\u306B\u306F\u3001\u540C\u3058\u540D\u524D\u3067\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3057\u76F4\u3057\uFF08${installCommand}\uFF09\u3001\u8A2D\u5B9A \u2192 \u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u304B\u3089\u5FA9\u5143\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,
922
+ `\u524A\u9664\u3059\u308B\u306B\u306F\u3001Cloudflare\u306E\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\u3067\u305D\u306E\u30D0\u30B1\u30C3\u30C8\u3092\u7A7A\u306B\u3057\u3066\u304B\u3089\u524A\u9664\u3057\u3066\u304F\u3060\u3055\u3044\uFF1AR2 \u2192 ${bucket}`
923
+ ].join("\n"),
814
924
  askAddress: (name) => `Orqevio\u306E\u30A2\u30C9\u30EC\u30B9\uFF08\u4F8B\uFF1Ahttps://${name}.<\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3>.workers.dev\uFF09\uFF1A`,
815
925
  badAddress: (address) => `\u300C${address}\u300D\u306F\u30A2\u30C9\u30EC\u30B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u30D6\u30E9\u30A6\u30B6\u30FC\u3067\u958B\u3044\u3066\u3044\u308B\u30A2\u30C9\u30EC\u30B9\u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002`,
816
926
  notOrqevio: (origin) => `${origin}\u3067\u306FOrqevio\u304C\u5FDC\u7B54\u3057\u307E\u305B\u3093\u3002`,
@@ -844,6 +954,8 @@ Je hebt een Cloudflare-account nodig (het gratis abonnement is genoeg). De eerst
844
954
  opent je browser, zodat je kunt inloggen.`,
845
955
  no: /^n/i,
846
956
  yesNo: "[J/n]",
957
+ yes: /^j/i,
958
+ noYes: "[j/N]",
847
959
  extraArgument: (arg) => `Onverwacht argument \u2018${arg}\u2019.`,
848
960
  unknownOption: (option) => `Onbekende optie \u2018${option}\u2019.`,
849
961
  missingValue: (option) => `De optie \u2018${option}\u2019 heeft een waarde nodig.`,
@@ -936,6 +1048,22 @@ Je installatie is bijgewerkt naar Orqevio ${version}: ${address}`,
936
1048
  "Het installatieprogramma kan je installatie de bijlagen laten verwijderen: het geeft toestemming via je Cloudflare-account, zonder je toegangssleutel.",
937
1049
  "Laat het antwoord leeg als je het liever anders doet."
938
1050
  ].join("\n"),
1051
+ askDeleteBackups: (bucket) => `Ook de back-ups verwijderen? De bucket \u2018${bucket}\u2019 bewaart de laatste 7 dagelijkse back-ups: als je hem houdt, kan een installatie met dezelfde naam ze terugzetten.`,
1052
+ emptyingBackupsThroughCopy: (bucket) => [
1053
+ "",
1054
+ `De bucket \u2018${bucket}\u2019 bevat nog back-ups, en Cloudflare verwijdert alleen lege buckets.`,
1055
+ "Het installatieprogramma kan je installatie vragen ze te verwijderen: het geeft daarvoor toestemming vanuit je Cloudflare-account, zonder je toegangssleutel.",
1056
+ "Laat het antwoord leeg om het op een andere manier te doen."
1057
+ ].join("\n"),
1058
+ backupsNotEmpty: (bucket, retryCommand) => [
1059
+ "",
1060
+ `De bucket \u2018${bucket}\u2019 bevat nog back-ups, en Cloudflare verwijdert alleen lege buckets. Er is niets verwijderd.`,
1061
+ `Maak hem leeg in het Cloudflare-dashboard (R2 \u2192 ${bucket} \u2192 Settings \u2192 Empty Bucket) en voer daarna ${retryCommand} opnieuw uit.`
1062
+ ].join("\n"),
1063
+ backupsKept: (bucket, installCommand) => [
1064
+ `De back-ups blijven in de bucket \u2018${bucket}\u2019. Om ze terug te halen, installeer je Orqevio opnieuw met dezelfde naam (${installCommand}) en zet je er een terug via Instellingen \u2192 Back-ups.`,
1065
+ `Om ze te verwijderen, maak je die bucket leeg en verwijder je hem in het Cloudflare-dashboard: R2 \u2192 ${bucket}.`
1066
+ ].join("\n"),
939
1067
  askAddress: (name) => `Adres van je installatie (bijvoorbeeld https://${name}.<je-subdomein>.workers.dev): `,
940
1068
  badAddress: (address) => `\u2018${address}\u2019 is geen adres: gebruik het adres dat je in de browser opent.`,
941
1069
  notOrqevio: (origin) => `Op ${origin} reageert geen Orqevio-installatie.`,
@@ -969,6 +1097,8 @@ Voc\xEA precisa de uma conta da Cloudflare (o plano gratuito basta). Na primeira
969
1097
  navegador abre para voc\xEA fazer login.`,
970
1098
  no: /^n/i,
971
1099
  yesNo: "[S/n]",
1100
+ yes: /^s/i,
1101
+ noYes: "[s/N]",
972
1102
  extraArgument: (arg) => `Argumento inesperado: \u201C${arg}\u201D.`,
973
1103
  unknownOption: (option) => `Op\xE7\xE3o desconhecida: \u201C${option}\u201D.`,
974
1104
  missingValue: (option) => `A op\xE7\xE3o \u201C${option}\u201D precisa de um valor.`,
@@ -1061,6 +1191,22 @@ Sua c\xF3pia foi atualizada para o Orqevio ${version}: ${address}`,
1061
1191
  "O instalador pode pedir que a sua c\xF3pia os apague: ele a autoriza pela sua conta da Cloudflare, sem precisar da sua chave de acesso.",
1062
1192
  "Deixe a resposta em branco se preferir fazer de outra forma."
1063
1193
  ].join("\n"),
1194
+ askDeleteBackups: (bucket) => `Apagar tamb\xE9m os backups? O bucket \u201C${bucket}\u201D guarda os 7 \xFAltimos backups di\xE1rios: se voc\xEA o mantiver, uma c\xF3pia instalada de novo com o mesmo nome poder\xE1 restaur\xE1-los.`,
1195
+ emptyingBackupsThroughCopy: (bucket) => [
1196
+ "",
1197
+ `O bucket \u201C${bucket}\u201D ainda guarda backups, e a Cloudflare s\xF3 apaga buckets vazios.`,
1198
+ "O instalador pode pedir \xE0 sua c\xF3pia que os apague: ele a autoriza a partir da sua conta da Cloudflare, sem precisar da sua chave de acesso.",
1199
+ "Deixe a resposta em branco para fazer isso de outra forma."
1200
+ ].join("\n"),
1201
+ backupsNotEmpty: (bucket, retryCommand) => [
1202
+ "",
1203
+ `O bucket \u201C${bucket}\u201D ainda guarda backups, e a Cloudflare s\xF3 apaga buckets vazios. Nada foi apagado.`,
1204
+ `Esvazie-o no painel da Cloudflare (R2 \u2192 ${bucket} \u2192 Settings \u2192 Empty Bucket) e execute ${retryCommand} de novo.`
1205
+ ].join("\n"),
1206
+ backupsKept: (bucket, installCommand) => [
1207
+ `Os backups continuam no bucket \u201C${bucket}\u201D. Para recuper\xE1-los, instale uma c\xF3pia com o mesmo nome (${installCommand}) e restaure um em Configura\xE7\xF5es \u2192 Backups.`,
1208
+ `Para apag\xE1-los, esvazie e apague esse bucket no painel da Cloudflare: R2 \u2192 ${bucket}.`
1209
+ ].join("\n"),
1064
1210
  askAddress: (name) => `Endere\xE7o da sua c\xF3pia (por exemplo, https://${name}.<seu-subdominio>.workers.dev): `,
1065
1211
  badAddress: (address) => `\u201C${address}\u201D n\xE3o \xE9 um endere\xE7o: use o que voc\xEA abre no navegador.`,
1066
1212
  notOrqevio: (origin) => `Nenhuma c\xF3pia do Orqevio responde em ${origin}.`,
@@ -1128,7 +1274,7 @@ function copyOrigin(address) {
1128
1274
  return null;
1129
1275
  }
1130
1276
  }
1131
- async function emptyCopy(origin, name, token, fetchImpl = fetch) {
1277
+ async function emptyCopy(origin, name, token, fetchImpl = fetch, deleteBackups = false) {
1132
1278
  const call = async (path4, init = {}) => {
1133
1279
  try {
1134
1280
  const res = await fetchImpl(`${origin}${path4}`, { ...init, headers: { Accept: "application/json", ...init.headers }, signal: AbortSignal.timeout(6e4) });
@@ -1144,7 +1290,7 @@ async function emptyCopy(origin, name, token, fetchImpl = fetch) {
1144
1290
  if (!session.res.ok || !state || !("claimed" in state || "user" in state)) return { ok: false, reason: "not-orqevio" };
1145
1291
  if (typeof state.copyName === "string" && state.copyName !== name) return { ok: false, reason: "other-copy", detail: state.copyName };
1146
1292
  if (state.uninstalled) return { ok: true, already: true };
1147
- const uninstall2 = await call("/api/uninstall", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ token }) });
1293
+ const uninstall2 = await call("/api/uninstall", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(deleteBackups ? { token, deleteBackups } : { token }) });
1148
1294
  if ("error" in uninstall2) return { ok: false, reason: "unreachable", detail: uninstall2.error };
1149
1295
  if (uninstall2.res.ok) return { ok: true, already: false };
1150
1296
  if (uninstall2.res.status === 410) return { ok: true, already: true };
@@ -1483,7 +1629,8 @@ async function deployRepo(orqevio, dryRun, io, m) {
1483
1629
  return 1;
1484
1630
  }
1485
1631
  const bucket = repo.r2_buckets?.find((b) => b.binding === "UPLOADS")?.bucket_name;
1486
- const config = copyConfig(orqevio.base, orqevio.dir, name, "button", bucket || void 0);
1632
+ const backupBucket = repo.r2_buckets?.find((b) => b.binding === "BACKUPS")?.bucket_name;
1633
+ const config = copyConfig(orqevio.base, orqevio.dir, name, "button", bucket || void 0, backupBucket || void 0);
1487
1634
  return withWorkspace(async (dir) => {
1488
1635
  const configFile = path3.join(dir, "wrangler.json");
1489
1636
  await writeFile(configFile, JSON.stringify(config, null, 2));
@@ -1519,36 +1666,48 @@ async function putSecret(name, key, value, env) {
1519
1666
  }
1520
1667
  async function uninstall(name, workerFound, env, io, m, deps) {
1521
1668
  const bucket = bucketName(name);
1669
+ const backups = backupBucketName(name);
1522
1670
  const bucketFound = await bucketExists(bucket, env);
1523
- if (!workerFound && bucketFound === false) {
1671
+ const backupsFound = await bucketExists(backups, env);
1672
+ if (!workerFound && bucketFound === false && backupsFound === false) {
1524
1673
  io.err(m.nothingToUninstall(name));
1525
1674
  return 1;
1526
1675
  }
1527
1676
  io.out(m.uninstallWarning(name, bucket));
1677
+ const deleteBackups = backupsFound !== false && m.yes.test((await io.ask(`${m.askDeleteBackups(backups)} ${m.noYes} `)).trim());
1528
1678
  if ((await io.ask(m.askUninstallName(name))).trim() !== name) {
1529
1679
  io.err(m.nothingDeleted);
1530
1680
  return 1;
1531
1681
  }
1532
1682
  const retryCommand = `npx create-orqevio@latest uninstall${nameFlag(name)}`;
1533
- if (bucketFound !== false) {
1534
- let bucketDeleted = await deleteBucket(bucket, env, io);
1535
- if (bucketDeleted === "not-empty" && workerFound && await emptyThroughCopy(name, bucket, env, io, m, deps)) {
1536
- bucketDeleted = await deleteBucket(bucket, env, io);
1537
- }
1538
- if (bucketDeleted === "not-empty") {
1539
- io.err(m.bucketNotEmpty(bucket, retryCommand));
1540
- return 1;
1541
- }
1542
- if (bucketDeleted === "failed") {
1543
- io.err(m.uninstallFailed);
1544
- return 1;
1683
+ const targets = [...bucketFound !== false ? [bucket] : [], ...deleteBackups ? [backups] : []];
1684
+ const results = /* @__PURE__ */ new Map();
1685
+ for (const target of targets) results.set(target, await deleteBucket(target, env, io));
1686
+ const full = () => targets.filter((target) => results.get(target) === "not-empty");
1687
+ if (full().length && workerFound) {
1688
+ const message = full().includes(bucket) ? m.emptyingThroughCopy(bucket) : m.emptyingBackupsThroughCopy(backups);
1689
+ if (await emptyThroughCopy(name, message, env, io, m, deps, deleteBackups)) {
1690
+ for (const target of full()) results.set(target, await deleteBucket(target, env, io));
1545
1691
  }
1546
1692
  }
1693
+ if (results.get(bucket) === "not-empty") {
1694
+ io.err(m.bucketNotEmpty(bucket, retryCommand));
1695
+ return 1;
1696
+ }
1697
+ if (results.get(backups) === "not-empty") {
1698
+ io.err(m.backupsNotEmpty(backups, retryCommand));
1699
+ return 1;
1700
+ }
1701
+ if ([...results.values()].includes("failed")) {
1702
+ io.err(m.uninstallFailed);
1703
+ return 1;
1704
+ }
1547
1705
  if (workerFound && (await runWrangler(["delete", "--name", name, "--force"], { env })).code !== 0) {
1548
1706
  io.err(m.uninstallFailed);
1549
1707
  return 1;
1550
1708
  }
1551
1709
  io.out(m.uninstalled(name, "npx wrangler logout"));
1710
+ if (backupsFound !== false && !deleteBackups) io.out(m.backupsKept(backups, `npx create-orqevio@latest${nameFlag(name)}`));
1552
1711
  return 0;
1553
1712
  }
1554
1713
  async function deleteBucket(bucket, env, io) {
@@ -1559,9 +1718,9 @@ async function deleteBucket(bucket, env, io) {
1559
1718
  io.err(output.trim());
1560
1719
  return "failed";
1561
1720
  }
1562
- async function emptyThroughCopy(name, bucket, env, io, m, deps) {
1721
+ async function emptyThroughCopy(name, message, env, io, m, deps, deleteBackups) {
1563
1722
  const wait = deps.uninstallWait ?? UNINSTALL_WAIT;
1564
- io.out(m.emptyingThroughCopy(bucket));
1723
+ io.out(message);
1565
1724
  for (let attempt = 0; attempt < 3; attempt++) {
1566
1725
  const address = (await io.ask(m.askAddress(name))).trim();
1567
1726
  if (!address) return false;
@@ -1581,7 +1740,7 @@ async function emptyThroughCopy(name, bucket, env, io, m, deps) {
1581
1740
  const started = Date.now();
1582
1741
  let saidWaiting = false;
1583
1742
  for (; ; ) {
1584
- const result = await emptyCopy(origin, name, token, deps.fetch);
1743
+ const result = await emptyCopy(origin, name, token, deps.fetch, deleteBackups);
1585
1744
  if (result.ok) {
1586
1745
  io.out(m.copyEmptied);
1587
1746
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-orqevio",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "description": "Install your own copy of Orqevio on your Cloudflare account with one command.",
5
5
  "license": "FSL-1.1-ALv2",
6
6
  "repository": {
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "dependencies": {
23
23
  "wrangler": "4.161.0",
24
- "orqevio": "1.1.1"
24
+ "orqevio": "1.2.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/node": "^22.20.5",