kopia lustrzana https://github.com/cloudflare/wildebeest
				
				
				
			
		
			
				
	
	
		
			28 wiersze
		
	
	
		
			666 B
		
	
	
	
		
			TypeScript
		
	
	
			
		
		
	
	
			28 wiersze
		
	
	
		
			666 B
		
	
	
	
		
			TypeScript
		
	
	
import type { Env } from 'wildebeest/backend/src/types/env'
 | 
						|
 | 
						|
const headers = {
 | 
						|
	'content-type': 'application/json',
 | 
						|
	'cache-control': 'max-age=259200, public',
 | 
						|
}
 | 
						|
 | 
						|
export const onRequest: PagesFunction<Env, any> = async ({ env }) => {
 | 
						|
	return handleRequest(env.DOMAIN)
 | 
						|
}
 | 
						|
 | 
						|
export async function handleRequest(domain: string): Promise<Response> {
 | 
						|
	const res = {
 | 
						|
		links: [
 | 
						|
			{
 | 
						|
				rel: 'http://nodeinfo.diaspora.software/ns/schema/2.0',
 | 
						|
				href: `https://${domain}/nodeinfo/2.0`,
 | 
						|
			},
 | 
						|
			{
 | 
						|
				rel: 'http://nodeinfo.diaspora.software/ns/schema/2.1',
 | 
						|
				href: `https://${domain}/nodeinfo/2.1`,
 | 
						|
			},
 | 
						|
		],
 | 
						|
	}
 | 
						|
 | 
						|
	return new Response(JSON.stringify(res), { headers })
 | 
						|
}
 |