Open History to see the last commit
1import { SourceControlProviderKind } from "@t3tools/contracts";
2import * as Effect from "effect/Effect";
3import * as Schema from "effect/Schema";
4import * as Result from "effect/Result";
5import type { PullRequestCapabilities, PullRequestViewerPermissions } from "@t3tools/contracts";
6import { decodeJsonResult } from "@t3tools/shared/schemaJson";
7import * as ForgejoCli from "./ForgejoCli.ts";
8import { parseDiffFileRevisions } from "@t3tools/source-control-core/server/diffFileRevisions";
9import {
10 PullRequestProviderError,
11 type ProviderChangeRequestDetail,
12 type ProviderRepositoryRef,
13 type PullRequestProviderApi,
14} from "@t3tools/source-control-core/server/PullRequestProvider";
15import {
16 ForgejoPullRequest,
17 ForgejoRepository,
18 ForgejoUser,
19 ForgejoComment,
20 ForgejoReview,
21 ForgejoReviewComment,
22 ForgejoCommit,
23 ForgejoStatus,
24 ForgejoLabel,
25 ForgejoReaction,
26 FORGEJO_REACTIONS,
27 forgejoChangeRequest,
28 forgejoActor,
29 forgejoComment,
30 forgejoReview,
31 forgejoReviewThread,
32 forgejoCommit,
33 forgejoChecks,
34 forgejoReactions,
35} from "./forgejoPullRequestJson.ts";
36import { ForgejoBranchStatusChecks, markRequiredForgejoChecks } from "./forgejoRequiredChecks.ts";
37import { definition } from "../client/definition.ts";
38
39const isForgejoCliError = Schema.is(ForgejoCli.ForgejoCliError);
40
41const CAPABILITIES: PullRequestCapabilities = {
42 diff: true,
43 viewedFiles: "environment",
44 comment: true,
45 actions: [...definition.changeRequestActions],
46 mergeMethods: ["merge", "squash", "rebase"],
47 updateMethods: ["merge", "rebase"],
48 search: false,
49 reactions: true,
50 labels: true,
51 // Forgejo's public API has no thread replies/resolution or draft conversion endpoint.
52 review: {
53 inlineComment: true,
54 reply: false,
55 resolve: false,
56 verdicts: ["comment", "approve", "request-changes"],
57 },
58 reviewers: { request: true, listCandidates: true },
59 edit: { changeRequest: true, comment: true },
60};
61const repoPath = (input: ProviderRepositoryRef) =>
62 `repos/${input.repository.split("/").map(encodeURIComponent).join("/")}`;
63const pullPath = (input: ProviderRepositoryRef & { readonly number: number }) =>
64 `${repoPath(input)}/pulls/${input.number}`;
65const issuePath = (input: ProviderRepositoryRef & { readonly number: number }) =>
66 `${repoPath(input)}/issues/${input.number}`;
67// Review IDs differ from the issue-comment IDs used by Forgejo's reactions API.
68const reviewCommentId = (review: typeof ForgejoReview.Type) =>
69 /#issuecomment-([1-9]\d*)$/.exec(review.html_url ?? "")?.[1];
70
71export const make = Effect.gen(function* () {
72 const cli = yield* ForgejoCli.ForgejoCli;
73 const failure = (operation: string, detail: string, cause?: unknown) =>
74 new PullRequestProviderError({
75 provider: SourceControlProviderKind.make("forgejo"),
76 operation,
77 reason: "failed",
78 detail,
79 ...(cause === undefined ? {} : { cause }),
80 });
81 const request = (input: ForgejoCli.ForgejoApiInput) =>
82 cli.api(input).pipe(
83 Effect.mapError(
84 (error) =>
85 new PullRequestProviderError({
86 provider: SourceControlProviderKind.make("forgejo"),
87 operation: input.path,
88 detail: error.detail,
89 cause: error,
90 reason:
91 error.reason === "missing-cli"
92 ? "missing-tool"
93 : error.reason === "authentication"
94 ? "unauthenticated"
95 : error.reason === "rate-limit"
96 ? "rate-limited"
97 : error.reason === "not-found"
98 ? "not-found"
99 : "failed",
100 }),
101 ),
102 );
103 const read = Effect.fn("ForgejoPullRequestProvider.read")(function* <A>(
104 input: ForgejoCli.ForgejoApiInput,
105 schema: Schema.Codec<A, unknown, never, never>,
106 ) {
107 const result = yield* request(input);
108 if (result.stdoutTruncated)
109 return yield* failure(input.path, "Forgejo response exceeded the output limit.");
110 const decoded = decodeJsonResult(schema)(result.stdout);
111 return Result.isSuccess(decoded)
112 ? decoded.success
113 : yield* failure(input.path, "Forgejo returned an invalid response.", decoded.failure);
114 });
115 const readArray = <A>(
116 input: ForgejoCli.ForgejoApiInput,
117 schema: Schema.Codec<A, unknown, never, never>,
118 ) => read(input, Schema.NullOr(Schema.Array(schema))).pipe(Effect.map((rows) => rows ?? []));
119 const readPage = Effect.fn("ForgejoPullRequestProvider.readPage")(function* <A>(
120 input: ForgejoCli.ForgejoApiInput,
121 schema: Schema.Codec<A, unknown, never, never>,
122 index: number,
123 ) {
124 const result = yield* request({
125 ...input,
126 path: `${input.path}${input.path.includes("?") ? "&" : "?"}limit=50&page=${index}`,
127 });
128 if (result.stdoutTruncated)
129 return yield* failure(input.path, "Forgejo response exceeded the output limit.");
130 const decoded = decodeJsonResult(Schema.NullOr(Schema.Array(schema)))(result.stdout);
131 if (Result.isFailure(decoded))
132 return yield* failure(input.path, "Forgejo returned an invalid response.", decoded.failure);
133 const rows = decoded.success ?? [];
134 const links = /^link:\s*(.*)$/im.exec(result.stderr)?.[1];
135 return {
136 rows,
137 more: rows.length > 0 && (links === undefined || /rel="?next"?/i.test(links)),
138 };
139 });
140 // Use a stable, small page size that also works with Forgejo's default maximum of 50.
141 const page = Effect.fn("ForgejoPullRequestProvider.page")(function* <A>(
142 input: ForgejoCli.ForgejoApiInput,
143 schema: Schema.Codec<A, unknown, never, never>,
144 limit = 500,
145 ) {
146 const items: A[] = [];
147 for (let index = 1; items.length < limit; index++) {
148 const { rows, more } = yield* readPage(input, schema, index);
149 items.push(...rows);
150 if (!more) return { items, truncated: false };
151 }
152 return { items, truncated: true };
153 });
154 const write = (input: ForgejoCli.ForgejoApiInput) => request(input).pipe(Effect.asVoid);
155 const getPull = (input: ProviderRepositoryRef & { readonly number: number }) =>
156 read(
157 {
158 cwd: input.cwd,
159 repository: input.repository,
160 host: input.host,
161 path: pullPath(input),
162 },
163 ForgejoPullRequest,
164 );
165 const getRepo = (input: ProviderRepositoryRef) =>
166 read({ ...input, path: repoPath(input) }, ForgejoRepository);
167 const getViewer = (input: {
168 readonly cwd: string;
169 readonly repository?: string;
170 readonly host?: string;
171 }) => read({ ...input, path: "user" }, ForgejoUser).pipe(Effect.map((user) => user.login));
172 const permissions = (
173 repo: typeof ForgejoRepository.Type,
174 pr: typeof ForgejoPullRequest.Type,
175 viewer: string,
176 ): PullRequestViewerPermissions => {
177 const canWrite = repo.permissions?.push ?? false;
178 const canEdit = canWrite || pr.user?.login === viewer;
179 const active = !repo.archived;
180 return {
181 actions: active
182 ? CAPABILITIES.actions.filter((action) =>
183 action === "merge" || action === "update-branch" ? canWrite : canEdit,
184 )
185 : [],
186 comment: active && (!pr.is_locked || canWrite),
187 resolve: false,
188 verdicts: active
189 ? pr.user?.login === viewer
190 ? ["comment"]
191 : CAPABILITIES.review.verdicts
192 : [],
193 requestReviewers: active && canEdit,
194 labels: active && canWrite,
195 updateMethods:
196 active && canWrite ? (repo.allow_rebase_update ? ["merge", "rebase"] : ["merge"]) : [],
197 };
198 };
199 const getPermissions = Effect.fn("ForgejoPullRequestProvider.getPermissions")(function* (
200 input: ProviderRepositoryRef & { readonly number: number },
201 ) {
202 const [repo, pr, viewer] = yield* Effect.all(
203 [getRepo(input), getPull(input), getViewer(input)],
204 { concurrency: 3 },
205 );
206 return permissions(repo, pr, viewer);
207 });
208 const readChecks = Effect.fn("ForgejoPullRequestProvider.readChecks")(function* (
209 input: ProviderRepositoryRef,
210 pr: typeof ForgejoPullRequest.Type,
211 ) {
212 const branch = read(
213 {
214 ...input,
215 path: `${repoPath(input)}/branches/${pr.base.ref.split("/").map(encodeURIComponent).join("/")}`,
216 },
217 ForgejoBranchStatusChecks,
218 ).pipe(
219 Effect.catchTags({
220 PullRequestProviderError: (error) => {
221 if (
222 isForgejoCliError(error.cause) &&
223 (error.cause.reason === "forbidden" || error.cause.reason === "not-found")
224 ) {
225 return Effect.succeed({});
226 }
227 return Effect.fail(error);
228 },
229 }),
230 );
231 const [statuses, policy] = yield* Effect.all(
232 [
233 page(
234 {
235 ...input,
236 path: `${repoPath(input)}/statuses/${encodeURIComponent(pr.head.sha)}?sort=recentupdate`,
237 },
238 ForgejoStatus,
239 ),
240 branch,
241 ],
242 { concurrency: 2 },
243 );
244 return markRequiredForgejoChecks(forgejoChecks(statuses.items, pr.html_url), policy);
245 });
246 const unsupported = (operation: string) =>
247 Effect.fail(failure(operation, `Forgejo does not expose ${operation} through its API.`));
248 const provider: PullRequestProviderApi = {
249 kind: SourceControlProviderKind.make("forgejo"),
250 capabilities: CAPABILITIES,
251 getViewer,
252 listChangeRequests: Effect.fn("ForgejoPullRequestProvider.listChangeRequests")(
253 function* (input) {
254 const offset = input.cursor?.delivered ?? 0;
255 const items: ReturnType<typeof forgejoChangeRequest>[] = [];
256 const state = input.state === "merged" ? "closed" : input.state;
257 const query = {
258 ...input,
259 path: `${repoPath(input)}/pulls?state=${state}&sort=recentupdate`,
260 };
261 // Self-hosted servers may cap pages below 50. Establish their actual page size before
262 // translating the service's row offset into an API page number.
263 const first = yield* readPage(query, Schema.NullOr(ForgejoPullRequest), 1);
264 const pageSize = first.rows.length || 50;
265 const firstIndex = Math.floor(offset / pageSize) + 1;
266 let consumed = 0;
267 let more = true;
268 for (let index = firstIndex; more && consumed < input.limit; index++) {
269 const result =
270 index === 1 ? first : yield* readPage(query, Schema.NullOr(ForgejoPullRequest), index);
271 const rows = result.rows;
272 const start = index === firstIndex ? offset % pageSize : 0;
273 const countBefore = consumed;
274 for (const row of rows.slice(start)) {
275 if (consumed >= input.limit) break;
276 consumed++;
277 if (row) items.push(forgejoChangeRequest(row));
278 }
279 more = result.more || rows.length - start > consumed - countBefore;
280 }
281 return { items, truncated: more, continues: true, cursorAdvance: consumed };
282 },
283 ),
284 getChangeRequestSummary: (input) => getPull(input).pipe(Effect.map(forgejoChangeRequest)),
285 getChangeRequestChecks: Effect.fn("ForgejoPullRequestProvider.getChangeRequestChecks")(
286 function* (input) {
287 const pr = yield* getPull(input);
288 return { state: forgejoChangeRequest(pr).state, checks: yield* readChecks(input, pr) };
289 },
290 ),
291 getChangeRequest: Effect.fn("ForgejoPullRequestProvider.getChangeRequest")(function* (input) {
292 const [pr, repo, viewer] = yield* Effect.all(
293 [getPull(input), getRepo(input), getViewer(input)],
294 { concurrency: 3 },
295 );
296 const checks = yield* readChecks(input, pr);
297 return {
298 ...forgejoChangeRequest(pr),
299 headSha: pr.head.sha,
300 body: pr.body ?? "",
301 changedFiles: pr.changed_files ?? 0,
302 reviewers: (pr.requested_reviewers ?? []).flatMap((user) => {
303 const actor = forgejoActor(user);
304 return actor ? [actor] : [];
305 }),
306 checks,
307 baseComparison: !pr.merge_base
308 ? "unknown"
309 : pr.merge_base === pr.base.sha
310 ? "up-to-date"
311 : "behind",
312 viewerPermissions: permissions(repo, pr, viewer),
313 mergeCapabilities: {
314 merge: repo.allow_merge_commits ?? true,
315 squash: repo.allow_squash_merge ?? true,
316 rebase: repo.allow_rebase ?? true,
317 },
318 } satisfies ProviderChangeRequestDetail;
319 }),
320 getViewerPermissions: getPermissions,
321 getChangeRequestActivity: Effect.fn("ForgejoPullRequestProvider.getChangeRequestActivity")(
322 function* (input) {
323 const [comments, reviews, commits, reactions, viewer] = yield* Effect.all(
324 [
325 // Issue comments ignore page/limit; fetch this unpaginated endpoint once.
326 readArray({ ...input, path: `${issuePath(input)}/comments` }, ForgejoComment).pipe(
327 Effect.map((items) => ({
328 items: items.slice(0, 500),
329 truncated: items.length > 500,
330 })),
331 ),
332 page({ ...input, path: `${pullPath(input)}/reviews` }, ForgejoReview),
333 // Without these, each commit lists its files and a big merge outgrows the output limit.
334 page(
335 { ...input, path: `${pullPath(input)}/commits?files=false&verification=false` },
336 ForgejoCommit,
337 ),
338 page({ ...input, path: `${issuePath(input)}/reactions` }, ForgejoReaction),
339 getViewer(input),
340 ],
341 { concurrency: 5 },
342 );
343 const reviewComments = yield* Effect.forEach(
344 reviews.items.filter((review) => review.comments_count > 0 && review.state !== "PENDING"),
345 (review) =>
346 readArray(
347 { ...input, path: `${pullPath(input)}/reviews/${review.id}/comments` },
348 ForgejoReviewComment,
349 ),
350 { concurrency: 4 },
351 );
352 const allInline = reviewComments.flat();
353 const inline = allInline.slice(0, 500);
354 const entries = [
355 ...comments.items.map((comment) => ({
356 comment: forgejoComment(comment),
357 reactionId: String(comment.id),
358 })),
359 ...reviews.items
360 .filter((review) => review.state !== "PENDING" && review.state !== "REQUEST_REVIEW")
361 .map((review) => ({
362 comment: forgejoReview(review),
363 reactionId: reviewCommentId(review),
364 })),
365 ...inline.map((comment) => ({
366 comment: {
367 ...forgejoComment(comment),
368 kind: "review-comment" as const,
369 path: comment.path,
370 },
371 reactionId: String(comment.id),
372 })),
373 ];
374 const enriched = yield* Effect.forEach(
375 entries,
376 ({ comment, reactionId }) =>
377 (reactionId === undefined
378 ? Effect.succeed([])
379 : readArray(
380 { ...input, path: `${repoPath(input)}/issues/comments/${reactionId}/reactions` },
381 ForgejoReaction,
382 )
383 ).pipe(
384 Effect.map((rows) => ({ ...comment, reactions: forgejoReactions(rows, viewer) })),
385 ),
386 { concurrency: 4 },
387 );
388 const byId = new Map(enriched.map((comment) => [comment.id, comment]));
389 const timeline = enriched.toSorted((a, b) => a.createdAt.localeCompare(b.createdAt));
390 return {
391 comments: timeline,
392 commentCount: timeline.length,
393 commentsTruncated:
394 comments.truncated || reviews.truncated || allInline.length > inline.length,
395 reviewThreads: inline.map((comment) => ({
396 ...forgejoReviewThread(comment),
397 comments: [byId.get(String(comment.id)) ?? forgejoComment(comment)],
398 })),
399 commits: commits.items.map(forgejoCommit),
400 reactions: forgejoReactions(reactions.items, viewer),
401 };
402 },
403 ),
404 getFileRevisions: Effect.fn("ForgejoPullRequestProvider.getFileRevisions")(function* (input) {
405 const result = yield* request({ ...input, path: `${pullPath(input)}.diff` });
406 if (result.stdoutTruncated) {
407 return yield* failure("getFileRevisions", "Forgejo diff exceeded the output limit.");
408 }
409 const revisions = new Map(parseDiffFileRevisions(result.stdout));
410 for (const path of input.paths) {
411 if (!revisions.has(path)) revisions.set(path, "");
412 }
413 return { revisions, complete: true };
414 }),
415 getDiff: (input) =>
416 request({
417 ...input,
418 path: input.commit
419 ? `${repoPath(input)}/git/commits/${encodeURIComponent(input.commit)}.diff`
420 : `${pullPath(input)}.diff`,
421 }).pipe(
422 Effect.map((result) => ({
423 patch: result.stdout,
424 truncated: result.stdoutTruncated,
425 nextCursor: null,
426 })),
427 ),
428 getDiffFileContents: Effect.fn("ForgejoPullRequestProvider.getDiffFileContents")(
429 function* (input) {
430 const pr = yield* getPull(input);
431 const commit = input.commit
432 ? yield* read(
433 {
434 ...input,
435 path: `${repoPath(input)}/git/commits/${encodeURIComponent(input.commit)}?files=false&verification=false`,
436 },
437 ForgejoCommit,
438 )
439 : null;
440 const oldRef = commit ? commit.parents[0]?.sha : pr.merge_base || pr.base.sha;
441 const newRef = input.commit ?? pr.head.sha;
442 const content = (repository: string, ref: string, path: string) =>
443 read(
444 {
445 ...input,
446 repository,
447 path: `${repoPath({ ...input, repository })}/contents/${path.split("/").map(encodeURIComponent).join("/")}?ref=${encodeURIComponent(ref)}`,
448 },
449 Schema.Struct({ content: Schema.String, encoding: Schema.Literal("base64") }),
450 ).pipe(Effect.map((file) => Buffer.from(file.content, "base64").toString("utf8")));
451 const [oldContents, newContents] = yield* Effect.all(
452 [
453 input.changeType === "new" || !oldRef
454 ? Effect.succeed("")
455 : content(input.repository, oldRef, input.oldPath),
456 input.changeType === "deleted"
457 ? Effect.succeed("")
458 : content(pr.head.repo?.full_name ?? input.repository, newRef, input.newPath),
459 ],
460 { concurrency: 2 },
461 );
462 return { oldContents, newContents };
463 },
464 ),
465 runAction: (input) => {
466 switch (input.action) {
467 case "merge":
468 return write({
469 ...input,
470 path: `${pullPath(input)}/merge`,
471 method: "POST",
472 body: { Do: input.mergeMethod ?? "merge" },
473 });
474 case "close":
475 case "reopen":
476 return write({
477 ...input,
478 path: pullPath(input),
479 method: "PATCH",
480 body: { state: input.action === "close" ? "closed" : "open" },
481 });
482 case "update-branch":
483 return write({
484 ...input,
485 path: `${pullPath(input)}/update?style=${input.updateMethod ?? "merge"}`,
486 method: "POST",
487 });
488 default:
489 return unsupported(input.action);
490 }
491 },
492 updateChangeRequest: (input) =>
493 write({
494 ...input,
495 path: pullPath(input),
496 method: "PATCH",
497 body: {
498 ...(input.title === undefined ? {} : { title: input.title }),
499 ...(input.body === undefined ? {} : { body: input.body }),
500 },
501 }),
502 comment: (input) =>
503 write({
504 ...input,
505 path: `${issuePath(input)}/comments`,
506 method: "POST",
507 body: { body: input.body },
508 }),
509 updateComment: (input) =>
510 write({
511 ...input,
512 path: `${repoPath(input)}/issues/comments/${encodeURIComponent(input.commentId)}`,
513 method: "PATCH",
514 body: { body: input.body },
515 }),
516 submitReview: Effect.fn("ForgejoPullRequestProvider.submitReview")(function* (input) {
517 const pr = yield* getPull(input);
518 yield* write({
519 ...input,
520 path: `${pullPath(input)}/reviews`,
521 method: "POST",
522 body: {
523 event:
524 input.verdict === "approve"
525 ? "APPROVED"
526 : input.verdict === "request-changes"
527 ? "REQUEST_CHANGES"
528 : "COMMENT",
529 body: input.body,
530 commit_id: pr.head.sha,
531 comments: input.comments.map((comment) => {
532 const position = comment.position;
533 const old =
534 position.kind === "deleted" ||
535 (position.kind === "context" && position.side === "left");
536 return {
537 path: old ? (comment.oldPath ?? comment.path) : comment.path,
538 body: comment.body,
539 old_position: old ? position.oldLine : 0,
540 new_position: old ? 0 : position.newLine,
541 };
542 }),
543 },
544 });
545 }),
546 listReviewerCandidates: Effect.fn("ForgejoPullRequestProvider.listReviewerCandidates")(
547 function* (input) {
548 const [pr, users] = yield* Effect.all(
549 [getPull(input), page({ ...input, path: `${repoPath(input)}/assignees` }, ForgejoUser)],
550 { concurrency: 2 },
551 );
552 return {
553 candidates: users.items
554 .filter((user) => user.login !== pr.user?.login)
555 .flatMap((user) => {
556 const actor = forgejoActor(user);
557 return actor
558 ? [
559 {
560 ...actor,
561 id: user.login,
562 kind: "user" as const,
563 isRequested:
564 pr.requested_reviewers?.some((reviewer) => reviewer.login === user.login) ??
565 false,
566 },
567 ]
568 : [];
569 }),
570 truncated: users.truncated,
571 };
572 },
573 ),
574 setReviewerRequest: (input) =>
575 write({
576 ...input,
577 path: `${pullPath(input)}/requested_reviewers`,
578 method: input.requested ? "POST" : "DELETE",
579 body: { reviewers: input.reviewers.map((reviewer) => reviewer.id) },
580 }),
581 listLabelCandidates: Effect.fn("ForgejoPullRequestProvider.listLabelCandidates")(
582 function* (input) {
583 const [pr, labels] = yield* Effect.all(
584 [getPull(input), page({ ...input, path: `${repoPath(input)}/labels` }, ForgejoLabel)],
585 { concurrency: 2 },
586 );
587 return {
588 candidates: labels.items.map((label) => ({
589 name: label.name,
590 color: label.color ?? null,
591 description: label.description ?? null,
592 isApplied: pr.labels?.some((applied) => applied.id === label.id) ?? false,
593 })),
594 truncated: labels.truncated,
595 };
596 },
597 ),
598 setLabels: Effect.fn("ForgejoPullRequestProvider.setLabels")(function* (input) {
599 const labels = yield* page({ ...input, path: `${repoPath(input)}/labels` }, ForgejoLabel);
600 const selected = labels.items.filter((label) => input.labels.includes(label.name));
601 if (selected.length !== input.labels.length)
602 return yield* failure("setLabels", "One or more requested labels could not be found.");
603 if (input.applied)
604 yield* write({
605 ...input,
606 path: `${issuePath(input)}/labels`,
607 method: "POST",
608 body: { labels: selected.map((label) => label.id) },
609 });
610 else
611 yield* Effect.forEach(
612 selected,
613 (label) =>
614 write({ ...input, path: `${issuePath(input)}/labels/${label.id}`, method: "DELETE" }),
615 { concurrency: 1 },
616 );
617 }),
618 setReaction: Effect.fn("ForgejoPullRequestProvider.setReaction")(function* (input) {
619 let commentId = input.subjectId;
620 if (commentId?.startsWith("review:")) {
621 const reviewId = /^review:([1-9]\d*)$/.exec(commentId)?.[1];
622 if (!reviewId) return yield* failure("setReaction", "Invalid Forgejo review ID.");
623 const review = yield* read(
624 { ...input, path: `${pullPath(input)}/reviews/${reviewId}` },
625 ForgejoReview,
626 );
627 commentId = reviewCommentId(review);
628 if (!commentId)
629 return yield* failure(
630 "setReaction",
631 "Forgejo did not return a comment ID for this review.",
632 );
633 }
634 if (commentId && !/^[1-9]\d*$/.test(commentId))
635 return yield* failure("setReaction", "Invalid Forgejo comment ID.");
636 yield* write({
637 ...input,
638 path: commentId
639 ? `${repoPath(input)}/issues/comments/${commentId}/reactions`
640 : `${issuePath(input)}/reactions`,
641 method: input.reacted ? "POST" : "DELETE",
642 body: { content: FORGEJO_REACTIONS[input.content] },
643 });
644 }),
645 replyToThread: () => unsupported("thread replies"),
646 setThreadResolution: () => unsupported("thread resolution"),
647 };
648 return provider;
649});