Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dist/commands/execute-verified.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/commands/execute-verified.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/commands/execute-verified.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ async function executeNote(operation: string, options: Options, globals: Globals
if (operation === "profile") return queryRequest(account(globals), `/api/v1/reader/feed/profile/${segment(options, "userId")}`, globals, [["limit", num(options, "limit", 20)]]);
if (operation === "get") return request(account(globals), `/api/v1/reader/feed/${segment(options, "entityKey")}`, globals);
if (operation === "drafts") return queryRequest(publication(options), "/api/v1/feed/drafts", globals, [["limit", num(options, "limit", 20)]]);
if (operation === "create") return mutate(account(globals), "/api/v1/comment/feed", globals, options, "POST", { bodyJson: textToProseMirror(str(options, "text")), replyMinimumRole: str(options, "replyMinimumRole", "everyone") }, "Publishes a Note.");
// The trailing slash matters: Substack's Cloudflare edge answers POST /api/v1/comment/feed (no slash) with a 403 HTML page for every caller, signed in or not.
if (operation === "create") return mutate(account(globals), "/api/v1/comment/feed/", globals, options, "POST", { bodyJson: textToProseMirror(str(options, "text")), replyMinimumRole: str(options, "replyMinimumRole", "everyone") }, "Publishes a Note.");
if (operation === "reply") return mutate(account(globals), `/api/v1/comment/${segment(options, "commentId")}/reply`, globals, options, "POST", { bodyJson: textToProseMirror(str(options, "text")) }, `Replies to Note ${str(options, "commentId")}.`);
if (operation === "delete") return mutate(account(globals), `/api/v1/comment/${segment(options, "commentId")}`, globals, options, "DELETE", undefined, `Deletes Note ${str(options, "commentId")}.`);
if (operation === "mark-seen") return mutate(account(globals), `/api/v1/reader/feed/${segment(options, "entityKey")}/seen`, globals, options, "POST", undefined, `Marks ${str(options, "entityKey")} as seen.`);
Expand Down
2 changes: 1 addition & 1 deletion tests/endpoint-coverage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe("verified authenticated endpoint coverage", () => {
await expectConfirmationRequired(args);
const { request, body } = await captureRequest([...args, "--confirm"]);
expect(request.method).toBe("POST");
expect(parsedUrl(request).pathname).toBe("/api/v1/comment/feed");
expect(parsedUrl(request).pathname).toBe("/api/v1/comment/feed/");
expect(JSON.parse(body)).toMatchObject({
replyMinimumRole: "everyone",
bodyJson: { type: "doc", attrs: { schemaVersion: "v1", title: null }, content: [
Expand Down
Loading