custom search engine
This commit is contained in:
parent
6f9b40bb22
commit
00ab327993
2 changed files with 51 additions and 1 deletions
|
|
@ -39,7 +39,9 @@ export default function Route({ params }: { params: { route: string[] } }) {
|
|||
{
|
||||
service: window.chemical.getStore("service"),
|
||||
autoHttps: true,
|
||||
searchEngine: "https://www.google.com/search?q=%s",
|
||||
searchEngine:
|
||||
window.chemical.getStore("searchEngine") ||
|
||||
"https://www.google.com/search?q=%s",
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,20 @@ export default function ProxyOptions() {
|
|||
window.chemical.setStore("service", service);
|
||||
};
|
||||
|
||||
const [searchEngine, setSearchEngine] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
setSearchEngine(
|
||||
window.chemical.getStore("searchEngine") ||
|
||||
"https://www.google.com/search?q=%s"
|
||||
);
|
||||
}, []);
|
||||
|
||||
const searchEngineChanged = (service: string) => {
|
||||
setSearchEngine(service);
|
||||
window.chemical.setStore("searchEngine", service);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1 className="text-4xl font-semibold">Proxy</h1>
|
||||
|
|
@ -101,6 +115,40 @@ export default function ProxyOptions() {
|
|||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<p>Search Engines</p>
|
||||
<Select value={searchEngine} onValueChange={searchEngineChanged}>
|
||||
<SelectTrigger className="w-[180px]">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem value="https://www.google.com/search?q=%s">
|
||||
Google
|
||||
</SelectItem>
|
||||
<SelectItem value="https://duckduckgo.com/?q=%s&ia=web">
|
||||
DuckDuckGo
|
||||
</SelectItem>
|
||||
<SelectItem value="https://www.bing.com/search?q=%s">
|
||||
Bing
|
||||
</SelectItem>
|
||||
<SelectItem value="https://search.yahoo.com/search?p=%s">
|
||||
Yahoo
|
||||
</SelectItem>
|
||||
<SelectItem value="https://search.brave.com/search?q=%s">
|
||||
Brave
|
||||
</SelectItem>
|
||||
<SelectItem value="https://www.qwant.com/?q=%s&t=web">
|
||||
Qwant
|
||||
</SelectItem>
|
||||
<SelectItem value="https://searx.si/search?q=%s">
|
||||
SearXNG
|
||||
</SelectItem>
|
||||
<SelectItem value="https://www.ecosia.org/search?method=index&q=%s">
|
||||
Ecosia
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Form {...form}>
|
||||
<form
|
||||
onSubmit={form.handleSubmit(onSubmit)}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue