@dench.com/cli 3.11.51-staging.952 → 3.11.52
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/cron.ts +17 -2
- package/package.json +1 -1
package/cron.ts
CHANGED
|
@@ -502,13 +502,24 @@ async function runCreate(ctx: CronCliContext): Promise<void> {
|
|
|
502
502
|
})) as { jobId?: string };
|
|
503
503
|
|
|
504
504
|
if (isWebhook && created.jobId) {
|
|
505
|
+
// A webhook created --disabled answers every request 403; its note must
|
|
506
|
+
// never read as if the URL works yet (DEN-512).
|
|
507
|
+
const jobId = created.jobId;
|
|
508
|
+
const noteFor = (note: string) =>
|
|
509
|
+
disabled
|
|
510
|
+
? `Saved turned off (--disabled): the URL answers every request 403 until \`dench cron enable ${jobId}\`. After that: ${note}`
|
|
511
|
+
: note;
|
|
512
|
+
const state = disabled ? { enabled: false } : {};
|
|
505
513
|
if (unsigned) {
|
|
506
514
|
out(ctx, {
|
|
507
515
|
...created,
|
|
516
|
+
...state,
|
|
508
517
|
webhookUrl: automationWebhookUrl(ctx, created.jobId),
|
|
509
518
|
webhookAccess: "open",
|
|
510
519
|
warning: UNSIGNED_WEBHOOK_WARNING,
|
|
511
|
-
note:
|
|
520
|
+
note: noteFor(
|
|
521
|
+
"Plain POSTs to webhookUrl fire this automation. `dench cron secret <jobId>` turns signing back on.",
|
|
522
|
+
),
|
|
512
523
|
});
|
|
513
524
|
return;
|
|
514
525
|
}
|
|
@@ -519,6 +530,7 @@ async function runCreate(ctx: CronCliContext): Promise<void> {
|
|
|
519
530
|
// Created, signing required, no secret yet: the URL accepts nothing.
|
|
520
531
|
out(ctx, {
|
|
521
532
|
...created,
|
|
533
|
+
...state,
|
|
522
534
|
webhookUrl: automationWebhookUrl(ctx, created.jobId),
|
|
523
535
|
webhookAccess: "off",
|
|
524
536
|
note: `Created with signing on, but its secret could not be made (${error instanceof Error ? error.message : String(error)}). The URL accepts no requests until you run \`dench cron secret ${created.jobId}\`.`,
|
|
@@ -527,8 +539,11 @@ async function runCreate(ctx: CronCliContext): Promise<void> {
|
|
|
527
539
|
}
|
|
528
540
|
out(ctx, {
|
|
529
541
|
...created,
|
|
542
|
+
...state,
|
|
530
543
|
...secret,
|
|
531
|
-
note:
|
|
544
|
+
note: noteFor(
|
|
545
|
+
"Signed: every POST to webhookUrl must carry a valid HMAC signature. The secret is shown once; store it now (`dench cron secret <jobId>` rotates it).",
|
|
546
|
+
),
|
|
532
547
|
});
|
|
533
548
|
return;
|
|
534
549
|
}
|