create-orqevio 1.0.0-rc.3 → 1.0.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/dist/cli.js +223 -16
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/main.ts
|
|
4
|
+
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
4
5
|
import { rmSync } from "node:fs";
|
|
5
6
|
import { mkdtemp, writeFile } from "node:fs/promises";
|
|
6
7
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
@@ -173,7 +174,22 @@ Deine Instanz l\xE4uft jetzt mit Orqevio ${version}: ${address}`,
|
|
|
173
174
|
"",
|
|
174
175
|
`Die Instanz \u201E${name}\u201C ist deinstalliert: Ihr Worker und ihr Bucket sind aus deinem Cloudflare-Konto entfernt.`,
|
|
175
176
|
`Wenn du Wrangler sonst nicht nutzt, melde dich mit ${logoutCommand} ab.`
|
|
176
|
-
].join("\n")
|
|
177
|
+
].join("\n"),
|
|
178
|
+
emptyingThroughCopy: (bucket) => [
|
|
179
|
+
"",
|
|
180
|
+
`Der Bucket \u201E${bucket}\u201C enth\xE4lt noch Anh\xE4nge, und Cloudflare l\xF6scht nur leere Buckets.`,
|
|
181
|
+
"Der Installer kann deine Instanz die Anh\xE4nge l\xF6schen lassen: Er autorisiert sie \xFCber dein Cloudflare-Konto, ohne deinen Zugangsschl\xFCssel.",
|
|
182
|
+
"Lass die Antwort leer, wenn du es anders machen willst."
|
|
183
|
+
].join("\n"),
|
|
184
|
+
askAddress: (name) => `Adresse deiner Instanz (zum Beispiel https://${name}.<deine-subdomain>.workers.dev): `,
|
|
185
|
+
badAddress: (address) => `\u201E${address}\u201C ist keine Adresse: Nimm die, die du im Browser \xF6ffnest.`,
|
|
186
|
+
notOrqevio: (origin) => `Unter ${origin} antwortet keine Orqevio-Instanz.`,
|
|
187
|
+
otherCopy: (origin, other, name) => `${origin} ist die Instanz \u201E${other}\u201C, nicht \u201E${name}\u201C.`,
|
|
188
|
+
copyUnreachable: (origin, detail) => `Deine Instanz unter ${origin} war nicht erreichbar (${detail}). Es wurde nichts gel\xF6scht.`,
|
|
189
|
+
authorizingCopy: "Deine Instanz wird \xFCber dein Cloudflare-Konto autorisiert; warte auf ihre Antwort (ein paar Sekunden) \u2026",
|
|
190
|
+
notThisAccount: (origin, name) => `${origin} ist nicht die Instanz \u201E${name}\u201C dieses Cloudflare-Kontos: Sie hat die Autorisierung nicht erhalten. Es wurde nichts gel\xF6scht.`,
|
|
191
|
+
copyTooOld: (updateCommand) => `Deine Instanz hat eine \xE4ltere Version, die das noch nicht kann. Aktualisiere sie mit ${updateCommand} und f\xFChre diesen Befehl noch einmal aus, oder leere den Bucket in der App oder im Dashboard.`,
|
|
192
|
+
copyEmptied: "Deine Instanz hat ihre Daten und Anh\xE4nge gel\xF6scht."
|
|
177
193
|
};
|
|
178
194
|
|
|
179
195
|
// src/messages/en.ts
|
|
@@ -281,7 +297,22 @@ Your copy is updated to Orqevio ${version}: ${address}`,
|
|
|
281
297
|
"",
|
|
282
298
|
`The copy \u201C${name}\u201D is uninstalled: its Worker and its bucket are gone from your Cloudflare account.`,
|
|
283
299
|
`If you don\u2019t use Wrangler for anything else, sign out with ${logoutCommand}.`
|
|
284
|
-
].join("\n")
|
|
300
|
+
].join("\n"),
|
|
301
|
+
emptyingThroughCopy: (bucket) => [
|
|
302
|
+
"",
|
|
303
|
+
`The bucket \u201C${bucket}\u201D still holds attachments, and Cloudflare only deletes empty buckets.`,
|
|
304
|
+
"The installer can have your copy delete them: it authorizes the copy from your Cloudflare account, with no need for your access key.",
|
|
305
|
+
"Leave the answer blank to do it another way."
|
|
306
|
+
].join("\n"),
|
|
307
|
+
askAddress: (name) => `Address of your copy (for example https://${name}.<your-subdomain>.workers.dev): `,
|
|
308
|
+
badAddress: (address) => `\u201C${address}\u201D isn\u2019t an address: use the one you open in the browser.`,
|
|
309
|
+
notOrqevio: (origin) => `There\u2019s no copy of Orqevio answering at ${origin}.`,
|
|
310
|
+
otherCopy: (origin, other, name) => `${origin} is the copy \u201C${other}\u201D, not \u201C${name}\u201D.`,
|
|
311
|
+
copyUnreachable: (origin, detail) => `Couldn\u2019t reach your copy at ${origin} (${detail}). Nothing was deleted.`,
|
|
312
|
+
authorizingCopy: "Authorizing your copy from your Cloudflare account and waiting for it to answer (a few seconds)\u2026",
|
|
313
|
+
notThisAccount: (origin, name) => `${origin} isn\u2019t the copy \u201C${name}\u201D of this Cloudflare account: it didn\u2019t receive the authorization. Nothing was deleted.`,
|
|
314
|
+
copyTooOld: (updateCommand) => `Your copy is from an earlier version that can\u2019t do this. Update it with ${updateCommand} and run this command again, or empty the bucket from the app or the dashboard.`,
|
|
315
|
+
copyEmptied: "Your copy deleted its data and its attachments."
|
|
285
316
|
};
|
|
286
317
|
|
|
287
318
|
// src/messages/es.ts
|
|
@@ -389,7 +420,22 @@ Tu copia est\xE1 actualizada a Orqevio ${version}: ${address}`,
|
|
|
389
420
|
"",
|
|
390
421
|
`La copia \xAB${name}\xBB est\xE1 desinstalada: su Worker y su bucket ya no est\xE1n en tu cuenta de Cloudflare.`,
|
|
391
422
|
`Si no usas Wrangler para nada m\xE1s, cierra la sesi\xF3n con ${logoutCommand}.`
|
|
392
|
-
].join("\n")
|
|
423
|
+
].join("\n"),
|
|
424
|
+
emptyingThroughCopy: (bucket) => [
|
|
425
|
+
"",
|
|
426
|
+
`El bucket \xAB${bucket}\xBB todav\xEDa guarda adjuntos, y Cloudflare solo borra buckets vac\xEDos.`,
|
|
427
|
+
"El instalador puede pedirle a tu copia que los borre: la autoriza desde tu cuenta de Cloudflare, sin necesidad de tu clave de acceso.",
|
|
428
|
+
"Deja la respuesta en blanco si prefieres hacerlo de otra forma."
|
|
429
|
+
].join("\n"),
|
|
430
|
+
askAddress: (name) => `Direcci\xF3n de tu copia (por ejemplo, https://${name}.<tu-subdominio>.workers.dev): `,
|
|
431
|
+
badAddress: (address) => `\xAB${address}\xBB no es una direcci\xF3n: usa la que abres en el navegador.`,
|
|
432
|
+
notOrqevio: (origin) => `En ${origin} no responde ninguna copia de Orqevio.`,
|
|
433
|
+
otherCopy: (origin, other, name) => `${origin} es la copia \xAB${other}\xBB, no \xAB${name}\xBB.`,
|
|
434
|
+
copyUnreachable: (origin, detail) => `No he podido conectar con tu copia en ${origin} (${detail}). No se ha borrado nada.`,
|
|
435
|
+
authorizingCopy: "Autorizando a tu copia desde tu cuenta de Cloudflare y esperando su respuesta (unos segundos)\u2026",
|
|
436
|
+
notThisAccount: (origin, name) => `${origin} no es la copia \xAB${name}\xBB de esta cuenta de Cloudflare: no ha recibido la autorizaci\xF3n. No se ha borrado nada.`,
|
|
437
|
+
copyTooOld: (updateCommand) => `Tu copia es de una versi\xF3n anterior que no sabe hacer esto. Actual\xEDzala con ${updateCommand} y vuelve a ejecutar este comando, o vac\xEDa el bucket desde la app o desde el panel.`,
|
|
438
|
+
copyEmptied: "Tu copia ha borrado sus datos y sus adjuntos."
|
|
393
439
|
};
|
|
394
440
|
|
|
395
441
|
// src/messages/fr.ts
|
|
@@ -498,7 +544,22 @@ Votre copie est pass\xE9e \xE0 Orqevio ${version} : ${address}`,
|
|
|
498
544
|
"",
|
|
499
545
|
`La copie \xAB ${name} \xBB est d\xE9sinstall\xE9e : son Worker et son bucket ont disparu de votre compte Cloudflare.`,
|
|
500
546
|
`Si vous n\u2019utilisez Wrangler pour rien d\u2019autre, d\xE9connectez-vous avec ${logoutCommand}.`
|
|
501
|
-
].join("\n")
|
|
547
|
+
].join("\n"),
|
|
548
|
+
emptyingThroughCopy: (bucket) => [
|
|
549
|
+
"",
|
|
550
|
+
`Le bucket \xAB ${bucket} \xBB contient encore des pi\xE8ces jointes, et Cloudflare ne supprime que les buckets vides.`,
|
|
551
|
+
"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.",
|
|
552
|
+
"Laissez la r\xE9ponse vide pour proc\xE9der autrement."
|
|
553
|
+
].join("\n"),
|
|
554
|
+
askAddress: (name) => `Adresse de votre copie (par exemple https://${name}.<votre-sous-domaine>.workers.dev) : `,
|
|
555
|
+
badAddress: (address) => `\xAB ${address} \xBB n\u2019est pas une adresse : utilisez celle que vous ouvrez dans le navigateur.`,
|
|
556
|
+
notOrqevio: (origin) => `Aucune copie d\u2019Orqevio ne r\xE9pond \xE0 ${origin}.`,
|
|
557
|
+
otherCopy: (origin, other, name) => `${origin} est la copie \xAB ${other} \xBB, pas \xAB ${name} \xBB.`,
|
|
558
|
+
copyUnreachable: (origin, detail) => `Impossible de joindre votre copie \xE0 ${origin} (${detail}). Rien n\u2019a \xE9t\xE9 supprim\xE9.`,
|
|
559
|
+
authorizingCopy: "Autorisation de votre copie depuis votre compte Cloudflare, en attente de sa r\xE9ponse (quelques secondes)\u2026",
|
|
560
|
+
notThisAccount: (origin, name) => `${origin} n\u2019est pas la copie \xAB ${name} \xBB de ce compte Cloudflare : elle n\u2019a pas re\xE7u l\u2019autorisation. Rien n\u2019a \xE9t\xE9 supprim\xE9.`,
|
|
561
|
+
copyTooOld: (updateCommand) => `Votre copie est d\u2019une version ant\xE9rieure qui ne sait pas le faire. Mettez-la \xE0 jour avec ${updateCommand} puis relancez cette commande, ou videz le bucket depuis l\u2019app ou le tableau de bord.`,
|
|
562
|
+
copyEmptied: "Votre copie a supprim\xE9 ses donn\xE9es et ses pi\xE8ces jointes."
|
|
502
563
|
};
|
|
503
564
|
|
|
504
565
|
// src/messages/it.ts
|
|
@@ -607,7 +668,22 @@ La tua copia \xE8 stata aggiornata a Orqevio ${version}: ${address}`,
|
|
|
607
668
|
"",
|
|
608
669
|
`La copia \xAB${name}\xBB \xE8 disinstallata: il suo Worker e il suo bucket non sono pi\xF9 nel tuo account Cloudflare.`,
|
|
609
670
|
`Se non usi Wrangler per nient\u2019altro, esci con ${logoutCommand}.`
|
|
610
|
-
].join("\n")
|
|
671
|
+
].join("\n"),
|
|
672
|
+
emptyingThroughCopy: (bucket) => [
|
|
673
|
+
"",
|
|
674
|
+
`Il bucket \xAB${bucket}\xBB contiene ancora degli allegati, e Cloudflare elimina solo i bucket vuoti.`,
|
|
675
|
+
"L\u2019installer pu\xF2 chiedere alla tua copia di eliminarli: la autorizza dal tuo account Cloudflare, senza bisogno della tua chiave di accesso.",
|
|
676
|
+
"Lascia la risposta vuota se preferisci farlo in un altro modo."
|
|
677
|
+
].join("\n"),
|
|
678
|
+
askAddress: (name) => `Indirizzo della tua copia (per esempio https://${name}.<tuo-sottodominio>.workers.dev): `,
|
|
679
|
+
badAddress: (address) => `\xAB${address}\xBB non \xE8 un indirizzo: usa quello che apri nel browser.`,
|
|
680
|
+
notOrqevio: (origin) => `Nessuna copia di Orqevio risponde a ${origin}.`,
|
|
681
|
+
otherCopy: (origin, other, name) => `${origin} \xE8 la copia \xAB${other}\xBB, non \xAB${name}\xBB.`,
|
|
682
|
+
copyUnreachable: (origin, detail) => `Non riesco a raggiungere la tua copia a ${origin} (${detail}). Non \xE8 stato eliminato niente.`,
|
|
683
|
+
authorizingCopy: "Autorizzo la tua copia dal tuo account Cloudflare e aspetto la sua risposta (qualche secondo)\u2026",
|
|
684
|
+
notThisAccount: (origin, name) => `${origin} non \xE8 la copia \xAB${name}\xBB di questo account Cloudflare: non ha ricevuto l\u2019autorizzazione. Non \xE8 stato eliminato niente.`,
|
|
685
|
+
copyTooOld: (updateCommand) => `La tua copia \xE8 di una versione precedente che non sa farlo. Aggiornala con ${updateCommand} ed esegui di nuovo questo comando, oppure svuota il bucket dall\u2019app o dalla dashboard.`,
|
|
686
|
+
copyEmptied: "La tua copia ha eliminato i suoi dati e i suoi allegati."
|
|
611
687
|
};
|
|
612
688
|
|
|
613
689
|
// src/messages/ja.ts
|
|
@@ -717,7 +793,22 @@ Orqevio ${version}\u3078\u306E\u66F4\u65B0\u304C\u5B8C\u4E86\u3057\u307E\u3057\u
|
|
|
717
793
|
"",
|
|
718
794
|
`\u300C${name}\u300D\u3092\u30A2\u30F3\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3057\u307E\u3057\u305F\u3002Worker\u3068\u30D0\u30B1\u30C3\u30C8\u306FCloudflare\u30A2\u30AB\u30A6\u30F3\u30C8\u304B\u3089\u524A\u9664\u3055\u308C\u307E\u3057\u305F\u3002`,
|
|
719
795
|
`\u307B\u304B\u306BWrangler\u3092\u4F7F\u3063\u3066\u3044\u306A\u3051\u308C\u3070\u3001${logoutCommand} \u3067\u30ED\u30B0\u30A2\u30A6\u30C8\u3057\u3066\u304F\u3060\u3055\u3044\u3002`
|
|
720
|
-
].join("\n")
|
|
796
|
+
].join("\n"),
|
|
797
|
+
emptyingThroughCopy: (bucket) => [
|
|
798
|
+
"",
|
|
799
|
+
`\u30D0\u30B1\u30C3\u30C8\u300C${bucket}\u300D\u306B\u306F\u307E\u3060\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u304C\u3042\u308A\u3001Cloudflare\u306F\u7A7A\u306E\u30D0\u30B1\u30C3\u30C8\u3057\u304B\u524A\u9664\u3067\u304D\u307E\u305B\u3093\u3002`,
|
|
800
|
+
"\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",
|
|
801
|
+
"\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"
|
|
802
|
+
].join("\n"),
|
|
803
|
+
askAddress: (name) => `Orqevio\u306E\u30A2\u30C9\u30EC\u30B9\uFF08\u4F8B\uFF1Ahttps://${name}.<\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3>.workers.dev\uFF09\uFF1A`,
|
|
804
|
+
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`,
|
|
805
|
+
notOrqevio: (origin) => `${origin}\u3067\u306FOrqevio\u304C\u5FDC\u7B54\u3057\u307E\u305B\u3093\u3002`,
|
|
806
|
+
otherCopy: (origin, other, name) => `${origin}\u306F\u300C${other}\u300D\u3067\u3001\u300C${name}\u300D\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002`,
|
|
807
|
+
copyUnreachable: (origin, detail) => `${origin}\u306EOrqevio\u306B\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF08${detail}\uFF09\u3002\u4F55\u3082\u524A\u9664\u3057\u3066\u3044\u307E\u305B\u3093\u3002`,
|
|
808
|
+
authorizingCopy: "Cloudflare\u30A2\u30AB\u30A6\u30F3\u30C8\u304B\u3089Orqevio\u306B\u8A31\u53EF\u3092\u4E0E\u3048\u3001\u5FDC\u7B54\u3092\u5F85\u3063\u3066\u3044\u307E\u3059\uFF08\u6570\u79D2\u304B\u304B\u308A\u307E\u3059\uFF09\u2026",
|
|
809
|
+
notThisAccount: (origin, name) => `${origin}\u306F\u3053\u306ECloudflare\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u300C${name}\u300D\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08\u8A31\u53EF\u304C\u5C4A\u304D\u307E\u305B\u3093\u3067\u3057\u305F\uFF09\u3002\u4F55\u3082\u524A\u9664\u3057\u3066\u3044\u307E\u305B\u3093\u3002`,
|
|
810
|
+
copyTooOld: (updateCommand) => `\u304A\u4F7F\u3044\u306EOrqevio\u306F\u4EE5\u524D\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u306E\u305F\u3081\u3001\u3053\u306E\u64CD\u4F5C\u306B\u5BFE\u5FDC\u3057\u3066\u3044\u307E\u305B\u3093\u3002${updateCommand}\u3067\u66F4\u65B0\u3057\u3066\u304B\u3089\u3082\u3046\u4E00\u5EA6\u3053\u306E\u30B3\u30DE\u30F3\u30C9\u3092\u5B9F\u884C\u3059\u308B\u304B\u3001\u30A2\u30D7\u30EA\u307E\u305F\u306F\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\u3067\u30D0\u30B1\u30C3\u30C8\u3092\u7A7A\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,
|
|
811
|
+
copyEmptied: "Orqevio\u304C\u30C7\u30FC\u30BF\u3068\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u3092\u524A\u9664\u3057\u307E\u3057\u305F\u3002"
|
|
721
812
|
};
|
|
722
813
|
|
|
723
814
|
// src/messages/nl.ts
|
|
@@ -825,7 +916,22 @@ Je installatie is bijgewerkt naar Orqevio ${version}: ${address}`,
|
|
|
825
916
|
"",
|
|
826
917
|
`De installatie \u2018${name}\u2019 is verwijderd: de Worker en de bucket staan niet meer in je Cloudflare-account.`,
|
|
827
918
|
`Gebruik je Wrangler verder nergens voor, meld je dan af met ${logoutCommand}.`
|
|
828
|
-
].join("\n")
|
|
919
|
+
].join("\n"),
|
|
920
|
+
emptyingThroughCopy: (bucket) => [
|
|
921
|
+
"",
|
|
922
|
+
`De bucket \u2018${bucket}\u2019 bevat nog bijlagen, en Cloudflare verwijdert alleen lege buckets.`,
|
|
923
|
+
"Het installatieprogramma kan je installatie de bijlagen laten verwijderen: het geeft toestemming via je Cloudflare-account, zonder je toegangssleutel.",
|
|
924
|
+
"Laat het antwoord leeg als je het liever anders doet."
|
|
925
|
+
].join("\n"),
|
|
926
|
+
askAddress: (name) => `Adres van je installatie (bijvoorbeeld https://${name}.<je-subdomein>.workers.dev): `,
|
|
927
|
+
badAddress: (address) => `\u2018${address}\u2019 is geen adres: gebruik het adres dat je in de browser opent.`,
|
|
928
|
+
notOrqevio: (origin) => `Op ${origin} reageert geen Orqevio-installatie.`,
|
|
929
|
+
otherCopy: (origin, other, name) => `${origin} is de installatie \u2018${other}\u2019, niet \u2018${name}\u2019.`,
|
|
930
|
+
copyUnreachable: (origin, detail) => `Je installatie op ${origin} is niet bereikbaar (${detail}). Er is niets verwijderd.`,
|
|
931
|
+
authorizingCopy: "Je installatie krijgt toestemming via je Cloudflare-account; wachten op antwoord (een paar seconden)\u2026",
|
|
932
|
+
notThisAccount: (origin, name) => `${origin} is niet de installatie \u2018${name}\u2019 van dit Cloudflare-account: die heeft de toestemming niet gekregen. Er is niets verwijderd.`,
|
|
933
|
+
copyTooOld: (updateCommand) => `Je installatie heeft een oudere versie die dit nog niet kan. Werk haar bij met ${updateCommand} en voer deze opdracht opnieuw uit, of maak de bucket leeg via de app of het dashboard.`,
|
|
934
|
+
copyEmptied: "Je installatie heeft haar gegevens en bijlagen verwijderd."
|
|
829
935
|
};
|
|
830
936
|
|
|
831
937
|
// src/messages/pt.ts
|
|
@@ -933,7 +1039,22 @@ Sua c\xF3pia foi atualizada para o Orqevio ${version}: ${address}`,
|
|
|
933
1039
|
"",
|
|
934
1040
|
`A c\xF3pia \u201C${name}\u201D foi desinstalada: o Worker e o bucket dela n\xE3o est\xE3o mais na sua conta da Cloudflare.`,
|
|
935
1041
|
`Se voc\xEA n\xE3o usa o Wrangler para mais nada, saia da sess\xE3o com ${logoutCommand}.`
|
|
936
|
-
].join("\n")
|
|
1042
|
+
].join("\n"),
|
|
1043
|
+
emptyingThroughCopy: (bucket) => [
|
|
1044
|
+
"",
|
|
1045
|
+
`O bucket \u201C${bucket}\u201D ainda guarda anexos, e a Cloudflare s\xF3 apaga buckets vazios.`,
|
|
1046
|
+
"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.",
|
|
1047
|
+
"Deixe a resposta em branco se preferir fazer de outra forma."
|
|
1048
|
+
].join("\n"),
|
|
1049
|
+
askAddress: (name) => `Endere\xE7o da sua c\xF3pia (por exemplo, https://${name}.<seu-subdominio>.workers.dev): `,
|
|
1050
|
+
badAddress: (address) => `\u201C${address}\u201D n\xE3o \xE9 um endere\xE7o: use o que voc\xEA abre no navegador.`,
|
|
1051
|
+
notOrqevio: (origin) => `Nenhuma c\xF3pia do Orqevio responde em ${origin}.`,
|
|
1052
|
+
otherCopy: (origin, other, name) => `${origin} \xE9 a c\xF3pia \u201C${other}\u201D, n\xE3o \u201C${name}\u201D.`,
|
|
1053
|
+
copyUnreachable: (origin, detail) => `N\xE3o foi poss\xEDvel falar com a sua c\xF3pia em ${origin} (${detail}). Nada foi apagado.`,
|
|
1054
|
+
authorizingCopy: "Autorizando a sua c\xF3pia pela sua conta da Cloudflare e esperando a resposta dela (alguns segundos)\u2026",
|
|
1055
|
+
notThisAccount: (origin, name) => `${origin} n\xE3o \xE9 a c\xF3pia \u201C${name}\u201D desta conta da Cloudflare: ela n\xE3o recebeu a autoriza\xE7\xE3o. Nada foi apagado.`,
|
|
1056
|
+
copyTooOld: (updateCommand) => `Sua c\xF3pia \xE9 de uma vers\xE3o anterior que n\xE3o sabe fazer isso. Atualize-a com ${updateCommand} e execute este comando de novo, ou esvazie o bucket pelo app ou pelo painel.`,
|
|
1057
|
+
copyEmptied: "Sua c\xF3pia apagou os dados e os anexos."
|
|
937
1058
|
};
|
|
938
1059
|
|
|
939
1060
|
// src/messages/index.ts
|
|
@@ -980,6 +1101,42 @@ function openOnWindows(url) {
|
|
|
980
1101
|
}
|
|
981
1102
|
}
|
|
982
1103
|
|
|
1104
|
+
// src/copy.ts
|
|
1105
|
+
function copyOrigin(address) {
|
|
1106
|
+
const value = address.trim();
|
|
1107
|
+
try {
|
|
1108
|
+
const url = new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(value) ? value : `https://${value}`);
|
|
1109
|
+
const local = url.hostname === "localhost" || url.hostname === "127.0.0.1";
|
|
1110
|
+
return url.protocol === "https:" || local && url.protocol === "http:" ? url.origin : null;
|
|
1111
|
+
} catch {
|
|
1112
|
+
return null;
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
async function emptyCopy(origin, name, token, fetchImpl = fetch) {
|
|
1116
|
+
const call = async (path4, init = {}) => {
|
|
1117
|
+
try {
|
|
1118
|
+
const res = await fetchImpl(`${origin}${path4}`, { ...init, headers: { Accept: "application/json", ...init.headers }, signal: AbortSignal.timeout(6e4) });
|
|
1119
|
+
const body = await res.json().catch(() => null);
|
|
1120
|
+
return { res, body };
|
|
1121
|
+
} catch (error) {
|
|
1122
|
+
return { error: error.message };
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
const session = await call("/api/auth/session");
|
|
1126
|
+
if ("error" in session) return { ok: false, reason: "unreachable", detail: session.error };
|
|
1127
|
+
const state = session.body;
|
|
1128
|
+
if (!session.res.ok || !state || !("claimed" in state || "user" in state)) return { ok: false, reason: "not-orqevio" };
|
|
1129
|
+
if (typeof state.copyName === "string" && state.copyName !== name) return { ok: false, reason: "other-copy", detail: state.copyName };
|
|
1130
|
+
if (state.uninstalled) return { ok: true, already: true };
|
|
1131
|
+
const uninstall2 = await call("/api/uninstall", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ token }) });
|
|
1132
|
+
if ("error" in uninstall2) return { ok: false, reason: "unreachable", detail: uninstall2.error };
|
|
1133
|
+
if (uninstall2.res.ok) return { ok: true, already: false };
|
|
1134
|
+
if (uninstall2.res.status === 410) return { ok: true, already: true };
|
|
1135
|
+
if (uninstall2.res.status === 404) return { ok: false, reason: "too-old" };
|
|
1136
|
+
if (uninstall2.res.status === 403) return { ok: false, reason: "not-authorized" };
|
|
1137
|
+
return { ok: false, reason: "unreachable", detail: `HTTP ${uninstall2.res.status}` };
|
|
1138
|
+
}
|
|
1139
|
+
|
|
983
1140
|
// src/wrangler.ts
|
|
984
1141
|
import { spawn as spawn2 } from "node:child_process";
|
|
985
1142
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
@@ -1103,7 +1260,7 @@ ${m.heading(command, orqevio.version, name)}
|
|
|
1103
1260
|
io.err(m.accountUnreachable);
|
|
1104
1261
|
return 1;
|
|
1105
1262
|
}
|
|
1106
|
-
if (command === "uninstall") return uninstall(name, exists, env, io, m);
|
|
1263
|
+
if (command === "uninstall") return uninstall(name, exists, env, io, m, deps);
|
|
1107
1264
|
let mode = command;
|
|
1108
1265
|
if (command === "install" && exists) {
|
|
1109
1266
|
const answer = io.ask ? (await io.ask(`${m.askUpdate(name)} ${m.yesNo} `)).trim() : "n";
|
|
@@ -1329,7 +1486,7 @@ async function recover(name, env, io, m) {
|
|
|
1329
1486
|
io.out(m.recovered(setupCode));
|
|
1330
1487
|
return 0;
|
|
1331
1488
|
}
|
|
1332
|
-
async function uninstall(name, workerFound, env, io, m) {
|
|
1489
|
+
async function uninstall(name, workerFound, env, io, m, deps) {
|
|
1333
1490
|
const bucket = bucketName(name);
|
|
1334
1491
|
const bucketFound = await bucketExists(bucket, env);
|
|
1335
1492
|
if (!workerFound && bucketFound === false) {
|
|
@@ -1341,15 +1498,17 @@ async function uninstall(name, workerFound, env, io, m) {
|
|
|
1341
1498
|
io.err(m.nothingDeleted);
|
|
1342
1499
|
return 1;
|
|
1343
1500
|
}
|
|
1501
|
+
const retryCommand = `npx create-orqevio@latest uninstall${nameFlag(name)}`;
|
|
1344
1502
|
if (bucketFound !== false) {
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1503
|
+
let bucketDeleted = await deleteBucket(bucket, env, io);
|
|
1504
|
+
if (bucketDeleted === "not-empty" && workerFound && await emptyThroughCopy(name, bucket, env, io, m, deps)) {
|
|
1505
|
+
bucketDeleted = await deleteBucket(bucket, env, io);
|
|
1506
|
+
}
|
|
1507
|
+
if (bucketDeleted === "not-empty") {
|
|
1508
|
+
io.err(m.bucketNotEmpty(bucket, retryCommand));
|
|
1349
1509
|
return 1;
|
|
1350
1510
|
}
|
|
1351
|
-
if (
|
|
1352
|
-
io.err(output.trim());
|
|
1511
|
+
if (bucketDeleted === "failed") {
|
|
1353
1512
|
io.err(m.uninstallFailed);
|
|
1354
1513
|
return 1;
|
|
1355
1514
|
}
|
|
@@ -1361,6 +1520,54 @@ async function uninstall(name, workerFound, env, io, m) {
|
|
|
1361
1520
|
io.out(m.uninstalled(name, "npx wrangler logout"));
|
|
1362
1521
|
return 0;
|
|
1363
1522
|
}
|
|
1523
|
+
async function deleteBucket(bucket, env, io) {
|
|
1524
|
+
const run = await runWrangler(["r2", "bucket", "delete", bucket], { capture: true, env });
|
|
1525
|
+
const output = run.stdout + run.stderr;
|
|
1526
|
+
if (run.code === 0 || /\b10006\b/.test(output)) return "deleted";
|
|
1527
|
+
if (/\b10008\b/.test(output)) return "not-empty";
|
|
1528
|
+
io.err(output.trim());
|
|
1529
|
+
return "failed";
|
|
1530
|
+
}
|
|
1531
|
+
async function emptyThroughCopy(name, bucket, env, io, m, deps) {
|
|
1532
|
+
const { intervalMs, timeoutMs } = deps.uninstallWait ?? { intervalMs: 3e3, timeoutMs: 9e4 };
|
|
1533
|
+
io.out(m.emptyingThroughCopy(bucket));
|
|
1534
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
1535
|
+
const address = (await io.ask(m.askAddress(name))).trim();
|
|
1536
|
+
if (!address) return false;
|
|
1537
|
+
const origin = copyOrigin(address);
|
|
1538
|
+
if (!origin) {
|
|
1539
|
+
io.err(m.badAddress(address));
|
|
1540
|
+
continue;
|
|
1541
|
+
}
|
|
1542
|
+
const token = `${Date.now() + 15 * 6e4}.${randomBytes2(32).toString("base64url")}`;
|
|
1543
|
+
const set = await runWrangler(["secret", "put", "ORQEVIO_UNINSTALL_TOKEN", "--name", name], { input: token, env, capture: true });
|
|
1544
|
+
if (set.code !== 0) {
|
|
1545
|
+
io.err((set.stderr || set.stdout).trim());
|
|
1546
|
+
io.err(m.uninstallFailed);
|
|
1547
|
+
return false;
|
|
1548
|
+
}
|
|
1549
|
+
io.out(m.authorizingCopy);
|
|
1550
|
+
const deadline = Date.now() + timeoutMs;
|
|
1551
|
+
for (; ; ) {
|
|
1552
|
+
const result = await emptyCopy(origin, name, token, deps.fetch);
|
|
1553
|
+
if (result.ok) {
|
|
1554
|
+
io.out(m.copyEmptied);
|
|
1555
|
+
return true;
|
|
1556
|
+
}
|
|
1557
|
+
if (result.reason === "not-authorized" && Date.now() < deadline) {
|
|
1558
|
+
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
1559
|
+
continue;
|
|
1560
|
+
}
|
|
1561
|
+
if (result.reason === "not-authorized") io.err(m.notThisAccount(origin, name));
|
|
1562
|
+
else if (result.reason === "too-old") io.err(m.copyTooOld(`npx create-orqevio@latest update${nameFlag(name)}`));
|
|
1563
|
+
else if (result.reason === "unreachable") io.err(m.copyUnreachable(origin, result.detail ?? ""));
|
|
1564
|
+
else io.err(result.reason === "other-copy" ? m.otherCopy(origin, result.detail ?? "", name) : m.notOrqevio(origin));
|
|
1565
|
+
if (result.reason === "other-copy" || result.reason === "not-orqevio") break;
|
|
1566
|
+
return false;
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
return false;
|
|
1570
|
+
}
|
|
1364
1571
|
async function bucketExists(bucket, env) {
|
|
1365
1572
|
const run = await runWrangler(["r2", "bucket", "info", bucket, "--json"], { capture: true, env });
|
|
1366
1573
|
if (run.code === 0) return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-orqevio",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
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.0.0
|
|
24
|
+
"orqevio": "1.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^22.20.5",
|