mirror of
https://github.com/polaroi8d/cactoide.git
synced 2026-03-21 21:55:27 +00:00
feat: add federation to README.md
This commit is contained in:
@@ -69,9 +69,9 @@ async function readFederationConfig(): Promise<FederationConfig | null> {
|
||||
*/
|
||||
async function fetchEventsFromInstance(instanceUrl: string): Promise<Event[]> {
|
||||
try {
|
||||
// Ensure URL has protocol and append /api/events
|
||||
// Ensure URL has protocol and append /api/federation/events
|
||||
|
||||
const apiUrl = `http://${instanceUrl}/api/events`;
|
||||
const apiUrl = `http://${instanceUrl}/api/federation/events`;
|
||||
|
||||
logger.debug({ apiUrl }, 'Fetching events from federated instance');
|
||||
|
||||
|
||||
@@ -6,8 +6,13 @@ import { eq, count } from 'drizzle-orm';
|
||||
import { logger } from '$lib/logger';
|
||||
import federationConfig from '../../../../../federation.config.js';
|
||||
|
||||
import { FEDERATION_INSTANCE } from '$env/static/private';
|
||||
|
||||
export const GET: RequestHandler = async () => {
|
||||
try {
|
||||
if (!FEDERATION_INSTANCE) {
|
||||
return json({ error: 'Federation API is not enabled on this instance' }, { status: 403 });
|
||||
}
|
||||
// Count public events
|
||||
const publicEventsCount = await database
|
||||
.select({ count: count() })
|
||||
@@ -31,4 +36,3 @@ export const GET: RequestHandler = async () => {
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user