import { importPostAction } from "../../../channels/[slug]/importPostAction"; import { jobResponse, ops, reqSlug, reqString } from "../_lib"; export const dynamic = "force-dynamic"; // POST { slug, url } -> { ok: true, jobId } // // ONE post by its URL — an X status (https://x.com//status/) or a // Bluesky post (https://bsky.app/profile//post/, or its at:// // URI) — into the posts archive of `slug`, a posts channel of that platform // that archives that account (release 27 S3b). Read through the channel's own // fetcher (gallery-dl for X, the public AppView for Bluesky) as an // `import-post` job on the platform's queue; the job's log ends with // `@@import-post {ok, slug, url, id, written, already?, post?, error?}`. A // post already archived is not read again. // // Every refusal is the action's own sentence: not a post URL, no such channel, // not a posts channel, a channel of another platform or whose fetcher cannot // read one post, another account's post, the platform held or cooling down. export async function POST(request: Request) { return ops(request, ["slug", "url"], async (body) => jobResponse(await importPostAction(reqSlug(body, "slug"), reqString(body, "url"))), ); }