pr_01m47d15m3e54sn21z27rpy5n9/apps/web/app/routes/repo/webhooks.tsx

38 lines1,699 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Webhooks: every event, to your own addresses, signed and retried1import type { Route } from "./+types/webhooks";
Social cards for every page: og.g1t.sh2import { page } from "../../lib/meta";
Project settings move into the sidebar, grouped, with a heading per page3import { RepoSettingsHeading } from "../../components/repo-settings-heading";
Webhooks: every event, to your own addresses, signed and retried4import { WebhooksPanel } from "../../components/webhooks";
5import { actOnWebhooks, loadWebhooks } from "../../lib/webhooks.server";
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look6import { assertSameOrigin, getViewer, requireUser } from "../../lib/session.server";
7import { requireCapability, requireInsider } from "../../lib/access.server";
Webhooks: every event, to your own addresses, signed and retried8
Social cards for every page: og.g1t.sh9export function meta({ params, ...args }: Route.MetaArgs) {
10 return page(args, { title: `Webhooks · ${params.owner}/${params.repo} · g1t` });
Webhooks: every event, to your own addresses, signed and retried11}
12
13function ownerOf(params: { owner: string; repo: string }) {
14 return { workspace: params.owner.toLowerCase(), repo: { namespace: params.owner, name: params.repo } };
15}
16
17export async function loader({ params, context, request }: Route.LoaderArgs) {
18 const viewer = getViewer(context);
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look19 // Admins; to anyone without a role here the page does not exist.
20 await requireInsider(context, params, "manage_integrations");
Webhooks: every event, to your own addresses, signed and retried21 return loadWebhooks(ownerOf(params), viewer, request);
22}
23
24export async function action({ request, params, context }: Route.ActionArgs) {
25 assertSameOrigin(request);
26 const user = requireUser(context, request);
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look27 await requireCapability(context, params, "manage_integrations");
Webhooks: every event, to your own addresses, signed and retried28 return actOnWebhooks(ownerOf(params), user, await request.formData());
29}
30
31export default function RepoWebhooks({ loaderData, actionData, params }: Route.ComponentProps) {
32 return (
33 <div>
Project settings move into the sidebar, grouped, with a heading per page34 <RepoSettingsHeading base={`/${params.owner}/${params.repo}`} />
Webhooks: every event, to your own addresses, signed and retried35 <WebhooksPanel data={loaderData} action={actionData} manage scope={`${params.owner}/${params.repo}`} />
36 </div>
37 );
38}