Loading examples/sveltekit-sample/README.md +30 −30 Original line number Diff line number Diff line Loading @@ -27,16 +27,16 @@ Before you begin, ensure you have the following installed: ### 1. Clone the Repository ```bash ~~~~ bash git clone https://github.com/fedify-dev/fedify.git cd fedify/examples/sveltekit-sample ``` ~~~~ ### 2. Install Dependencies ```bash ~~~~ bash pnpm install ``` ~~~~ ### 3. Environment Setup Loading @@ -47,9 +47,9 @@ The application uses in-memory storage by default, so no additional database set ### Start the Development Server ```bash ~~~~ bash pnpm dev ``` ~~~~ The development server will start on `http://localhost:5173` by default. Loading @@ -60,11 +60,11 @@ The development server will start on `http://localhost:5173` by default. The federation setup is configured in `src/lib/federation.ts`: ```typescript ~~~~ typescript const federation = createFederation({ kv: new MemoryKvStore(), // In-memory storage for development }); ``` ~~~~ #### Key Configuration Options: Loading @@ -87,12 +87,12 @@ const federation = createFederation({ The application includes support for proxy headers via `x-forwarded-fetch`. This is configured in `src/lib/handles.ts`: ```typescript ~~~~ typescript export const replaceHost: Handle = async ({ event, resolve }) => { event.request = await getXForwardedRequest(event.request); return resolve(event); }; ``` ~~~~ This is useful when deploying behind reverse proxies or using tunneling services like ngrok. Loading @@ -105,20 +105,20 @@ But if you don't use proxy or tunnel, the handle is unnecessary. 1. Start the development server: ```bash ~~~~ bash pnpm dev ``` ~~~~ 2. Access the demo user profile: ``` ~~~~ curl http://localhost:5173/users/demo ``` ~~~~ 3. The ActivityPub actor endpoint is available at: ``` ~~~~ curl -H "Accept: application/activity+json" http://localhost:5173/users/demo ``` ~~~~ ### 2. Following from `activitypub.academy` Loading @@ -128,16 +128,16 @@ To test federation with `activitypub.academy`: 1. Deploy the application to a public server or use a tunneling service: ```bash ~~~~ bash # Using Fedify CLI to tunnel fedify tunnel 5173 ``` ~~~~ 2. From your `activitypub.academy` account, search for and follow: ``` ~~~~ @demo@6c10b40c63d9e1ce7da55667ef0ef8b4.serveo.net ``` ~~~~ 3. The application will automatically: - Receive the follow request Loading @@ -148,7 +148,7 @@ To test federation with `activitypub.academy`: To create additional actors, modify `src/lib/federation.ts`: ```typescript ~~~~ typescript // Add more identifiers const IDENTIFIERS = ["demo", "alice", "bob"]; Loading @@ -161,7 +161,7 @@ federation.setActorDispatcher( // ... actor creation logic }, ); ``` ~~~~ ### 4. Activity Monitoring Loading @@ -175,7 +175,7 @@ The application logs activities to the console. Monitor the development console Extend the inbox listeners to handle additional ActivityPub activities: ```typescript ~~~~ typescript federation .setInboxListeners("/users/{identifier}/inbox", "/inbox") .on(Follow, async (context, follow) => { Loading @@ -187,12 +187,12 @@ federation .on(Like, async (context, like) => { // Add custom like handling }); ``` ~~~~ 🏗️ Project Structure -------------------- ``` ~~~~ src/ ├── app.css # Global styles ├── app.d.ts # TypeScript app declarations Loading Loading @@ -224,16 +224,16 @@ src/ └── [id]/ ├── +page.server.ts # Individual post server logic └── +page.svelte # Individual post page ``` ~~~~ 🚀 Deployment ------------- ### Production Build ```bash ~~~~ bash pnpm build ``` ~~~~ pnpm preview Loading @@ -244,7 +244,7 @@ pnpm preview ### Example Deployment Commands ```bash ~~~~ bash # Build for production pnpm build Loading @@ -253,7 +253,7 @@ pnpm preview # Or deploy to your preferred platform # (Vercel, Netlify, Docker, etc.) ``` ~~~~ 🤝 Contributing --------------- Loading examples/sveltekit-sample/src/routes/+page.server.ts +1 −1 Original line number Diff line number Diff line import type { PageServerLoad } from "./$types"; import { relationStore } from "../lib/store"; export const load: PageServerLoad = async ({ request, url }) => { export const load: PageServerLoad = ({ request, url }) => { const forwardedHost = request.headers.get("x-forwarded-host"); const host = forwardedHost || request.headers.get("host") || url.host; Loading examples/sveltekit-sample/src/routes/users/[identifier]/posts/[id]/+page.server.ts +0 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ import { getPost, getUser } from "$lib/fetch"; export const load: PageServerLoad = async ({ request, params }) => { try { // const req = await getXForwardedRequest(request); const ctx = fedi.createContext(request, undefined); const { identifier, id } = params; Loading packages/next/README.md +1 −1 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ type ErrorHandlers = Omit<FederationFetchOptions<unknown>, "contextData">; * {@link Federation} object. * * @example * ```ts * ```ts ignore * import { fedifyWith } from "@fedify/next"; * import { federation } from "./federation"; * Loading Loading
examples/sveltekit-sample/README.md +30 −30 Original line number Diff line number Diff line Loading @@ -27,16 +27,16 @@ Before you begin, ensure you have the following installed: ### 1. Clone the Repository ```bash ~~~~ bash git clone https://github.com/fedify-dev/fedify.git cd fedify/examples/sveltekit-sample ``` ~~~~ ### 2. Install Dependencies ```bash ~~~~ bash pnpm install ``` ~~~~ ### 3. Environment Setup Loading @@ -47,9 +47,9 @@ The application uses in-memory storage by default, so no additional database set ### Start the Development Server ```bash ~~~~ bash pnpm dev ``` ~~~~ The development server will start on `http://localhost:5173` by default. Loading @@ -60,11 +60,11 @@ The development server will start on `http://localhost:5173` by default. The federation setup is configured in `src/lib/federation.ts`: ```typescript ~~~~ typescript const federation = createFederation({ kv: new MemoryKvStore(), // In-memory storage for development }); ``` ~~~~ #### Key Configuration Options: Loading @@ -87,12 +87,12 @@ const federation = createFederation({ The application includes support for proxy headers via `x-forwarded-fetch`. This is configured in `src/lib/handles.ts`: ```typescript ~~~~ typescript export const replaceHost: Handle = async ({ event, resolve }) => { event.request = await getXForwardedRequest(event.request); return resolve(event); }; ``` ~~~~ This is useful when deploying behind reverse proxies or using tunneling services like ngrok. Loading @@ -105,20 +105,20 @@ But if you don't use proxy or tunnel, the handle is unnecessary. 1. Start the development server: ```bash ~~~~ bash pnpm dev ``` ~~~~ 2. Access the demo user profile: ``` ~~~~ curl http://localhost:5173/users/demo ``` ~~~~ 3. The ActivityPub actor endpoint is available at: ``` ~~~~ curl -H "Accept: application/activity+json" http://localhost:5173/users/demo ``` ~~~~ ### 2. Following from `activitypub.academy` Loading @@ -128,16 +128,16 @@ To test federation with `activitypub.academy`: 1. Deploy the application to a public server or use a tunneling service: ```bash ~~~~ bash # Using Fedify CLI to tunnel fedify tunnel 5173 ``` ~~~~ 2. From your `activitypub.academy` account, search for and follow: ``` ~~~~ @demo@6c10b40c63d9e1ce7da55667ef0ef8b4.serveo.net ``` ~~~~ 3. The application will automatically: - Receive the follow request Loading @@ -148,7 +148,7 @@ To test federation with `activitypub.academy`: To create additional actors, modify `src/lib/federation.ts`: ```typescript ~~~~ typescript // Add more identifiers const IDENTIFIERS = ["demo", "alice", "bob"]; Loading @@ -161,7 +161,7 @@ federation.setActorDispatcher( // ... actor creation logic }, ); ``` ~~~~ ### 4. Activity Monitoring Loading @@ -175,7 +175,7 @@ The application logs activities to the console. Monitor the development console Extend the inbox listeners to handle additional ActivityPub activities: ```typescript ~~~~ typescript federation .setInboxListeners("/users/{identifier}/inbox", "/inbox") .on(Follow, async (context, follow) => { Loading @@ -187,12 +187,12 @@ federation .on(Like, async (context, like) => { // Add custom like handling }); ``` ~~~~ 🏗️ Project Structure -------------------- ``` ~~~~ src/ ├── app.css # Global styles ├── app.d.ts # TypeScript app declarations Loading Loading @@ -224,16 +224,16 @@ src/ └── [id]/ ├── +page.server.ts # Individual post server logic └── +page.svelte # Individual post page ``` ~~~~ 🚀 Deployment ------------- ### Production Build ```bash ~~~~ bash pnpm build ``` ~~~~ pnpm preview Loading @@ -244,7 +244,7 @@ pnpm preview ### Example Deployment Commands ```bash ~~~~ bash # Build for production pnpm build Loading @@ -253,7 +253,7 @@ pnpm preview # Or deploy to your preferred platform # (Vercel, Netlify, Docker, etc.) ``` ~~~~ 🤝 Contributing --------------- Loading
examples/sveltekit-sample/src/routes/+page.server.ts +1 −1 Original line number Diff line number Diff line import type { PageServerLoad } from "./$types"; import { relationStore } from "../lib/store"; export const load: PageServerLoad = async ({ request, url }) => { export const load: PageServerLoad = ({ request, url }) => { const forwardedHost = request.headers.get("x-forwarded-host"); const host = forwardedHost || request.headers.get("host") || url.host; Loading
examples/sveltekit-sample/src/routes/users/[identifier]/posts/[id]/+page.server.ts +0 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ import { getPost, getUser } from "$lib/fetch"; export const load: PageServerLoad = async ({ request, params }) => { try { // const req = await getXForwardedRequest(request); const ctx = fedi.createContext(request, undefined); const { identifier, id } = params; Loading
packages/next/README.md +1 −1 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ type ErrorHandlers = Omit<FederationFetchOptions<unknown>, "contextData">; * {@link Federation} object. * * @example * ```ts * ```ts ignore * import { fedifyWith } from "@fedify/next"; * import { federation } from "./federation"; * Loading