feat: add fediverse comments server render mode support
This commit is contained in:
parent
9559abd0aa
commit
30cdde0fc2
6 changed files with 983 additions and 90 deletions
|
@ -24,17 +24,19 @@ export const siteConfig = {
|
|||
fediverse: {
|
||||
// use Mastodon (compatible) api to search posts and parse replies
|
||||
// it will search for the post's link by default
|
||||
// the comments are rendered at the client side (by now)
|
||||
// a reverse proxy is required in pure client-side rendering mode to get the posts from the fediverse instance
|
||||
useReverseProxy: true,
|
||||
renderOnServer: false, // render comments on server-side or client-side, may different from the astro config
|
||||
// the comments are rendered at the client side by default
|
||||
// but if you want to deploy site on Cloudflare pages or so you can set it to true.
|
||||
// (but in pure SSG mode, the comments will be rendered at build time, which mean delayed updates,maybe?)
|
||||
// a reverse proxy is recommended in pure client-side rendering mode to get the posts from the fediverse instance
|
||||
// that requires to be authorized to use search api the instance
|
||||
useReverseProxy: false,
|
||||
reverseProxyUrl: '', // the url of the reverse proxy, usually a cloudflare worker proxying the search api
|
||||
// the reverse proxy should be able to handle the following request:
|
||||
// GET /api/v1/search?q={query}&type=statuses&account_id=12345678
|
||||
// GET /api/v1/statuses/12345678/context
|
||||
// response body should be returned from the origin fediverse instance as-is.
|
||||
// response body should be returned from the origin (fediverse instance) as-is.
|
||||
accountId: '', // the account id to search posts from, can be got from api like: https://{instance}/api/v1/accounts/{username without domain part}
|
||||
// for development purpose only (by now):
|
||||
// TODO: render the comments on the server-side when in server-side render/hybrid render mode
|
||||
instanceDomain: '', // the domain of the fediverse instance to search posts from
|
||||
useV2api: true, // use /api/v2/search instead of /api/v1/search to search on instance using newer version of mastodon/pleroma/akkoma
|
||||
token: process.env.MASTODON_API_TOKEN, // the token to use to authenticate with the fediverse instance, usually a read:search-only token
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue