You've already forked domainstack.io
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:
21
app/opensearch.xml/route.ts
Normal file
21
app/opensearch.xml/route.ts
Normal 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",
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user