diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css index 6a9459fc0..1673b2149 100644 --- a/docs/.vitepress/theme/custom.css +++ b/docs/.vitepress/theme/custom.css @@ -41,8 +41,8 @@ --vp-c-indigo-darker: hsl(var(--indigo-h-s) 10%); --vp-c-indigo-soft: hsl(var(--indigo-h-s) 10% / 0.75); - --vp-c-divider-light-1: hsl(var(--neutral-h-s) 50% / 0.25); - --vp-c-divider-light-2: hsl(var(--neutral-h-s) 50% / 0.125); + --vp-c-divider-light-1: hsl(var(--neutral-h-s) 50% / 0.2); + --vp-c-divider-light-2: hsl(var(--neutral-h-s) 50% / 0.1); --vp-c-divider-dark-1: hsl(var(--neutral-h-s) 50% / 0.5); --vp-c-divider-dark-2: hsl(var(--neutral-h-s) 50% / 0.33); diff --git a/docs/introduction.md b/docs/introduction.md index a6cb504de..b7d57d3ec 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -8,9 +8,9 @@ Any application that supports [the Micropub protocol](https://micropub.spec.indi ```sh POST /micropub HTTP/1.1 -Host: indiekit.mywebsite.com +Host: indiekit.website.example Content-Type: application/x-www-form-urlencoded -Authorization: Bearer XXXXXXX +Authorization: Bearer [ACCESS_TOKEN] h=entry &content=Hello+world @@ -39,22 +39,27 @@ Note the `mp-syndicate-to` property in the above example. If you’ve configured You can then send a second `POST` request, this time to `https://indiekit.website.example/syndicate` along with your access token which you can find on your server’s status page: ```sh -POST /syndicate HTTP/1.1 -Host: indiekit.mywebsite.com -Content-Type: application/x-www-form-urlencoded - -token=XXXXXXX +POST /syndicate?token=[ACCESS_TOKEN] HTTP/1.1 +Host: indiekit.website.example +Accept: application/json ``` -This will tell Indiekit to syndicate the most recent un-syndicated post to the third-party websites listed in the front matter. +This will tell Indiekit to syndicate the most recent un-syndicated post to the third-party websites listed in a post’s front matter. ::: tip ### Use an outgoing webhook on Netlify -Netlify allows [posting to an outgoing webhook](https://docs.netlify.com/site-deploys/notifications/#outgoing-webhooks) once a deploy has succeeded. +If you are using [Netlify](https://www.netlify.com) to host your website, you can send a notification to the syndication endpoint once a deployment has been completed. + +First, create an environment variable for your Indiekit server called `WEBHOOK_SECRET` and give it a secret, hard-to-guess value. + +Then on Netlify, in your site’s ‘Build & Deploy’ settings, add an [outgoing webhook](https://docs.netlify.com/site-deploys/notifications/#outgoing-webhooks) with the following values: + +* **Event to listen for:** ‘Deploy succeeded’ +* **URL to notify:** `[YOUR_INDIEKIT_URL]/syndicate` +* **JWS secret token:** The same value you used for `WEBHOOK_SECRET` -In ‘URL to notify’, enter your server’s syndication endpoint with your access token as the `token` parameter, for example: `https://indiekit.website.example/syndicate?token=XXXXXXX`. ::: Once this has been completed, Indiekit will update the post, replacing `mp-syndicate-to` with a `syndication` property listing the location of each syndicated copy: diff --git a/package-lock.json b/package-lock.json index 1b7e5d6ac..effaec516 100644 --- a/package-lock.json +++ b/package-lock.json @@ -62,30 +62,39 @@ } }, "helpers/access-token": { + "name": "@indiekit-test/token", "license": "MIT" }, "helpers/config": { + "name": "@indiekit-test/config", "license": "MIT" }, "helpers/fixtures": { + "name": "@indiekit-test/fixtures", "license": "MIT" }, "helpers/frontend": { + "name": "@indiekit-test/frontend", "license": "MIT" }, "helpers/media-data": { + "name": "@indiekit-test/media-data", "license": "MIT" }, "helpers/mock-agent": { + "name": "@indiekit-test/mock-agent", "license": "MIT" }, "helpers/post-data": { + "name": "@indiekit-test/post-data", "license": "MIT" }, "helpers/publication": { + "name": "@indiekit-test/publication", "license": "MIT" }, "helpers/server": { + "name": "@indiekit-test/server", "license": "MIT", "dependencies": { "get-port": "^6.1.2" @@ -103,9 +112,11 @@ } }, "helpers/session": { + "name": "@indiekit-test/session", "license": "MIT" }, "helpers/store": { + "name": "@indiekit-test/store", "license": "MIT" }, "node_modules/@algolia/autocomplete-core": { @@ -21790,6 +21801,7 @@ } }, "packages/endpoint-auth": { + "name": "@indiekit/endpoint-auth", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -21815,6 +21827,7 @@ } }, "packages/endpoint-files": { + "name": "@indiekit/endpoint-files", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -21828,6 +21841,7 @@ } }, "packages/endpoint-image": { + "name": "@indiekit/endpoint-image", "version": "1.0.0-beta.0", "license": "MIT", "dependencies": { @@ -21840,6 +21854,7 @@ } }, "packages/endpoint-json-feed": { + "name": "@indiekit/endpoint-json-feed", "version": "1.0.0-beta.0", "license": "MIT", "dependencies": { @@ -21851,6 +21866,7 @@ } }, "packages/endpoint-media": { + "name": "@indiekit/endpoint-media", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -21876,6 +21892,7 @@ } }, "packages/endpoint-micropub": { + "name": "@indiekit/endpoint-micropub", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -21905,6 +21922,7 @@ } }, "packages/endpoint-posts": { + "name": "@indiekit/endpoint-posts", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -21921,6 +21939,7 @@ } }, "packages/endpoint-share": { + "name": "@indiekit/endpoint-share", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -21934,11 +21953,13 @@ } }, "packages/endpoint-syndicate": { + "name": "@indiekit/endpoint-syndicate", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { "@indiekit/error": "^1.0.0-beta.1", "express": "^4.17.1", + "jsonwebtoken": "^9.0.0", "undici": "^5.2.0" }, "engines": { @@ -21946,6 +21967,7 @@ } }, "packages/error": { + "name": "@indiekit/error", "version": "1.0.0-beta.1", "license": "MIT", "engines": { @@ -21953,6 +21975,7 @@ } }, "packages/frontend": { + "name": "@indiekit/frontend", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -21979,6 +22002,7 @@ } }, "packages/indiekit": { + "name": "@indiekit/indiekit", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -22002,6 +22026,7 @@ "express-fileupload": "^1.4.0", "express-rate-limit": "^6.2.0", "i18n": "^0.15.0", + "jsonwebtoken": "^9.0.0", "keyv": "^4.2.0", "keyv-mongodb": "^3.0.0", "lodash": "^4.17.21", @@ -22030,6 +22055,7 @@ } }, "packages/preset-hugo": { + "name": "@indiekit/preset-hugo", "version": "1.0.0-alpha.18", "license": "MIT", "dependencies": { @@ -22050,6 +22076,7 @@ } }, "packages/preset-jekyll": { + "name": "@indiekit/preset-jekyll", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -22068,6 +22095,7 @@ } }, "packages/store-bitbucket": { + "name": "@indiekit/store-bitbucket", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -22079,6 +22107,7 @@ } }, "packages/store-file-system": { + "name": "@indiekit/store-file-system", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -22089,6 +22118,7 @@ } }, "packages/store-ftp": { + "name": "@indiekit/store-ftp", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -22100,6 +22130,7 @@ } }, "packages/store-gitea": { + "name": "@indiekit/store-gitea", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -22111,6 +22142,7 @@ } }, "packages/store-github": { + "name": "@indiekit/store-github", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -22122,6 +22154,7 @@ } }, "packages/store-gitlab": { + "name": "@indiekit/store-gitlab", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -22133,6 +22166,7 @@ } }, "packages/syndicator-internet-archive": { + "name": "@indiekit/syndicator-internet-archive", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -22144,6 +22178,7 @@ } }, "packages/syndicator-mastodon": { + "name": "@indiekit/syndicator-mastodon", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -22158,6 +22193,7 @@ } }, "packages/syndicator-twitter": { + "name": "@indiekit/syndicator-twitter", "version": "1.0.0-beta.1", "license": "MIT", "dependencies": { @@ -23985,6 +24021,7 @@ "requires": { "@indiekit/error": "^1.0.0-beta.1", "express": "^4.17.1", + "jsonwebtoken": "^9.0.0", "undici": "^5.2.0" } }, @@ -24036,6 +24073,7 @@ "express-fileupload": "^1.4.0", "express-rate-limit": "^6.2.0", "i18n": "^0.15.0", + "jsonwebtoken": "^9.0.0", "keyv": "^4.2.0", "keyv-mongodb": "^3.0.0", "lodash": "^4.17.21", diff --git a/packages/endpoint-posts/includes/endpoint-posts-syndicate.njk b/packages/endpoint-posts/includes/endpoint-posts-syndicate.njk index 46e190213..407431e92 100644 --- a/packages/endpoint-posts/includes/endpoint-posts-syndicate.njk +++ b/packages/endpoint-posts/includes/endpoint-posts-syndicate.njk @@ -1,6 +1,6 @@