← Commit history

Publish 0.1.2

Kyle Bergstedt ·f586bfc5c7 · ·parent 51c75de
3 files changed +8−5
VERSION+1−1
@@ -1 +1 @@-0.1.1+0.1.2
bin/adom-forum.cjs+5−2
@@ -20,7 +20,7 @@ const { basename, dirname, resolve: resolvePath, extname } = require('node:path' const { homedir } = require('node:os') const { createHash } = require('node:crypto') -const VERSION = '0.1.1'+const VERSION = '0.1.2'  // The CLI runs in the shared Linux runtime behind Hydrogen web, macOS, and // Windows alike. It depends only on Node 18+ (global fetch, FormData, Blob)@@ -102,7 +102,10 @@ function trustedHost(url) { async function api(method, path, { body, form, idempotencyKey } = {}) {   const url = `${baseUrl()}${path}`   const { token, source } = resolveToken()-  const headers = { 'user-agent': `adom-forum/${VERSION}`, accept: 'application/json' }+  // SvelteKit rejects form-encoded and multipart POSTs whose Origin does not+  // match the site (its CSRF guard), which covers the image upload. Sending+  // the forum's own origin satisfies it; JSON requests are unaffected.+  const headers = { 'user-agent': `adom-forum/${VERSION}`, accept: 'application/json', origin: baseUrl() }   if (token) {     if (!trustedHost(url)) fail(`refusing to send the Adom token to ${new URL(url).hostname}`)     headers.authorization = `Bearer ${token}`
page.json+2−2
@@ -4,7 +4,7 @@   "slug": "adom-forum",   "title": "Adom Forum",   "brief": "Post to and read the Adom Forum from the terminal, run by your AI. Start threads with Markdown and inline images, reply, and browse spaces. Posts made this way carry a 'via <agent>' badge so people can see an AI posted on your behalf.",-  "version": "0.1.1",+  "version": "0.1.2",   "visibility": "public",   "license": "MIT",   "install": {@@ -71,6 +71,6 @@   "engines": {     "node": ">=18"   },-  "changelog": "0.1.1: run on Node 18 (CommonJS entry); no functional change.",+  "changelog": "0.1.2: send Origin on API calls so image uploads pass the CSRF guard.",   "org": "adom" }\ No newline at end of file