1
mirror of https://github.com/jakejarvis/domainstack.io.git synced 2025-12-02 19:33:48 -05:00

feat: add dynamic OpenSearch route implementation and remove static xml file

This commit is contained in:
2025-11-16 12:37:51 -05:00
parent 7fdc418ffe
commit d2a4e451f9
2 changed files with 21 additions and 8 deletions

View File

@@ -0,0 +1,21 @@
import { NextResponse } from "next/server";
import { BASE_URL } from "@/lib/constants/app";
export async function GET() {
const xml = `<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Domainstack</ShortName>
<Description>Open a Domainstack report for a given domain name</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">${BASE_URL}/favicon.ico</Image>
<Url type="text/html" template="${BASE_URL}/{searchTerms}" />
<Url type="application/opensearchdescription+xml" rel="self" template="${BASE_URL}/opensearch.xml" />
</OpenSearchDescription>`;
return new NextResponse(xml, {
headers: {
"Content-Type": "application/opensearchdescription+xml",
"Cache-Control": "public, max-age=86400",
},
});
}

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Domainstack</ShortName>
<Description>Search Domainstack by domain name</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">https://domainstack.io/favicon.ico</Image>
<Url type="text/html" template="https://domainstack.io/{searchTerms}"/>
</OpenSearchDescription>