GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(web): webhook URLs say who can reach them, using the shared addr… · pingdotgg/t3code@1882ec2

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src/components/settings
    • ScheduledTasksSettings.tsx
    • scheduledTasksSettings.logic.test.ts
    • scheduledTasksSettings.logic.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/components/settings/ScheduledTasksSettings.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/settings/ScheduledTasksSettings.tsx
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import {
4242
sortProviderInstanceEntries,
4343
} from "../../providerInstances";
4444
import { requestConfirmDialog } from "../../confirmDialog";
45+
import { webhookAddress } from "@t3tools/client-runtime/webhook-address";
4546
import { useCopyToClipboard } from "../../hooks/useCopyToClipboard";
4647
import {
4748
useEnvironment,
@@ -62,7 +63,6 @@ import {
6263
scheduleFromDraft,
6364
scheduledTaskDefaultModel,
6465
taskToDraft,
65-
webhookUrl,
6666
type DraftState,
6767
type ScheduleMode,
6868
type WorkspaceMode,
@@ -671,7 +671,7 @@ function WebhookEndpointField({
671671
if (!task || !endpoint) {
672672
return <p className="text-sm text-muted-foreground">The URL appears after you save.</p>;
673673
}
674-
const url = webhookUrl(endpoint, httpBaseUrl);
674+
const { address: url, copyable, note } = webhookAddress(endpoint, httpBaseUrl);
675675
const rotateUrl = async () => {
676676
const confirmed =
677677
(await requestConfirmDialog("Rotate this webhook URL?\nThe current URL stops working.", {
@@ -708,7 +708,7 @@ function WebhookEndpointField({
708708
variant="outline"
709709
type="button"
710710
// A bare path is not a URL a sender can call.
711-
disabled={!url.startsWith("http")}
711+
disabled={!copyable}
712712
onClick={() => copyToClipboard(url, undefined)}
713713
>
714714
<CopyIcon />
@@ -724,12 +724,7 @@ function WebhookEndpointField({
724724
Rotate
725725
</Button>
726726
</div>
727-
{endpoint.url === null ? (
728-
<p className="text-xs text-muted-foreground">
729-
Link this environment to T3 Connect for a public URL. This address works wherever the
730-
environment is reachable.
731-
</p>
732-
) : null}
727+
{note !== null ? <p className="text-xs text-muted-foreground">{note}</p> : null}
733728
</div>
734729
);
735730
}
Collapse file

‎apps/web/src/components/settings/scheduledTasksSettings.logic.test.ts‎

Copy file name to clipboardExpand all lines: apps/web/src/components/settings/scheduledTasksSettings.logic.test.ts
-12Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
matchesScheduledTaskScope,
2222
scheduleFromDraft,
2323
taskToDraft,
24-
webhookUrl,
2524
} from "./scheduledTasksSettings.logic";
2625

2726
const laptopId = EnvironmentId.make("laptop");
@@ -195,17 +194,6 @@ describe("webhook scheduled tasks", () => {
195194
expect(draft.signatureHeader).toBe("x-hub-signature-256");
196195
expect(scheduleFromDraft(draft)).toEqual({ type: "webhook", signature: null });
197196
});
198-
199-
it("prefers the Connect URL and otherwise resolves the path on the environment", () => {
200-
const endpoint = { path: "/api/hooks/id/token", url: null, hasSecret: false };
201-
expect(webhookUrl({ ...endpoint, url: "https://relay/v1/hooks/e/id/token" }, null)).toBe(
202-
"https://relay/v1/hooks/e/id/token",
203-
);
204-
expect(webhookUrl(endpoint, "https://box.tailnet.ts.net:3773/")).toBe(
205-
"https://box.tailnet.ts.net:3773/api/hooks/id/token",
206-
);
207-
expect(webhookUrl(endpoint, null)).toBe("/api/hooks/id/token");
208-
});
209197
});
210198

211199
describe("scheduled task model defaults", () => {
Collapse file

‎apps/web/src/components/settings/scheduledTasksSettings.logic.ts‎

Copy file name to clipboardExpand all lines: apps/web/src/components/settings/scheduledTasksSettings.logic.ts
-10Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
ScheduledTaskId,
55
type ScheduledTask,
66
type ScheduledTaskUpsertSchedule,
7-
type ScheduledTaskWebhookEndpoint,
87
type ModelSelection,
98
type RuntimeMode,
109
type ProviderInteractionMode,
@@ -118,15 +117,6 @@ export function scheduleFromDraft(draft: DraftState): ScheduledTaskUpsertSchedul
118117
};
119118
}
120119

121-
/** The address a sender should call: the public Connect URL, else the path on this environment's address. */
122-
export function webhookUrl(
123-
endpoint: ScheduledTaskWebhookEndpoint,
124-
httpBaseUrl: string | null,
125-
): string {
126-
if (endpoint.url !== null) return endpoint.url;
127-
return httpBaseUrl ? new URL(endpoint.path, httpBaseUrl).href : endpoint.path;
128-
}
129-
130120
export function taskToDraft(task: ScheduledTask): DraftState {
131121
const schedule = task.schedule;
132122
const weekdays =

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.