This PR enhances the search functionality by adding OpenSearch support and enabling search queries from URL parameters.
+12
-37
Diff
round #0
+1
.gitignore
+1
.gitignore
+1
index.html
+1
index.html
···
10
10
<meta property="og:description" content="Browse the public data on atproto" />
11
11
<meta property="description" content="Browse the public data on atproto" />
12
12
<link rel="manifest" href="/manifest.json" />
13
+
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="PDSls">
13
14
<link rel="preconnect" href="https://fonts.bunny.net" />
14
15
<link href="https://fonts.bunny.net/css?family=roboto-mono:400" rel="stylesheet" />
15
16
<link href="https://fonts.cdnfonts.com/css/pecita" rel="stylesheet" />
+2
-2
package.json
+2
-2
package.json
···
4
4
"type": "module",
5
5
"scripts": {
6
6
"start": "vite",
7
-
"predev": "node scripts/generate-oauth-metadata.js",
7
+
"predev": "node scripts/generate-metadata.js",
8
8
"dev": "vite",
9
-
"prebuild": "node scripts/generate-oauth-metadata.js",
9
+
"prebuild": "node scripts/generate-metadata.js",
10
10
"build": "vite build",
11
11
"serve": "vite preview"
12
12
},
-35
scripts/generate-oauth-metadata.js
-35
scripts/generate-oauth-metadata.js
···
1
-
import { mkdirSync, writeFileSync } from "fs";
2
-
import { dirname } from "path";
3
-
import { fileURLToPath } from "url";
4
-
5
-
const __filename = fileURLToPath(import.meta.url);
6
-
const __dirname = dirname(__filename);
7
-
8
-
const domain = process.env.APP_DOMAIN || "pdsls.dev";
9
-
const protocol = process.env.APP_PROTOCOL || "https";
10
-
const baseUrl = `${protocol}://${domain}`;
11
-
12
-
const metadata = {
13
-
client_id: `${baseUrl}/oauth-client-metadata.json`,
14
-
client_name: "PDSls",
15
-
client_uri: baseUrl,
16
-
logo_uri: `${baseUrl}/favicon.ico`,
17
-
redirect_uris: [`${baseUrl}/`],
18
-
scope: "atproto repo:*?action=create repo:*?action=update repo:*?action=delete blob:*/*",
19
-
grant_types: ["authorization_code", "refresh_token"],
20
-
response_types: ["code"],
21
-
token_endpoint_auth_method: "none",
22
-
application_type: "web",
23
-
dpop_bound_access_tokens: true,
24
-
};
25
-
26
-
const outputPath = `${__dirname}/../public/oauth-client-metadata.json`;
27
-
28
-
try {
29
-
mkdirSync(dirname(outputPath), { recursive: true });
30
-
writeFileSync(outputPath, JSON.stringify(metadata, null, 2) + "\n");
31
-
console.log(`Generated OAuth metadata for ${baseUrl}`);
32
-
} catch (error) {
33
-
console.error("Failed to generate OAuth metadata:", error);
34
-
process.exit(1);
35
-
}
+8
src/components/search.tsx
+8
src/components/search.tsx
···
128
128
129
129
window.addEventListener("paste", handlePaste);
130
130
onCleanup(() => window.removeEventListener("paste", handlePaste));
131
+
132
+
const requestUrl = new URL(location.href);
133
+
const requestQuery = requestUrl.searchParams.get("q");
134
+
if (requestQuery != null) {
135
+
requestUrl.searchParams.delete("q");
136
+
history.replaceState(null, "", requestUrl.toString());
137
+
processInput(requestQuery);
138
+
}
131
139
});
132
140
133
141
createEffect(() => {
History
1 round
0 comments
launchpadx.top
submitted
#0
expand 0 comments
closed without merging