Skip to content

Commit

Permalink
Fix more cors headers for well-known
Browse files Browse the repository at this point in the history
  • Loading branch information
llun committed Feb 23, 2025
1 parent 749946b commit 9aee147
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions app/api/well-known/node-info/2.0/route.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import { NextRequest } from 'next/server'

import { getConfig } from '@/lib/config'
import { VERSION } from '@/lib/constants'
import { HttpMethod } from '@/lib/utils/getCORSHeaders'
import { apiResponse, defaultOptions } from '@/lib/utils/response'

export const dynamic = 'force-dynamic'

export const GET = async () => {
const CORS_HEADERS = [HttpMethod.enum.OPTIONS, HttpMethod.enum.GET]

export const OPTIONS = defaultOptions(CORS_HEADERS)

export const GET = async (req: NextRequest) => {
const config = getConfig()
return Response.json({
return apiResponse(req, CORS_HEADERS, {
metadata: {
accountActivationRequired: true,
features: [],
Expand Down
12 changes: 10 additions & 2 deletions app/api/well-known/nodeinfo/route.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import { NextRequest } from 'next/server'

import { getConfig } from '@/lib/config'
import { HttpMethod } from '@/lib/utils/getCORSHeaders'
import { apiResponse, defaultOptions } from '@/lib/utils/response'

export const dynamic = 'force-dynamic'

export const GET = async () => {
const CORS_HEADERS = [HttpMethod.enum.OPTIONS, HttpMethod.enum.GET]

export const OPTIONS = defaultOptions(CORS_HEADERS)

export const GET = async (req: NextRequest) => {
const config = getConfig()

return Response.json({
return apiResponse(req, CORS_HEADERS, {
links: [
{
rel: 'http://nodeinfo.diaspora.software/ns/schema/2.0',
Expand Down

0 comments on commit 9aee147

Please sign in to comment.