Skip to content

Commit 65ec8f0

Browse files
committed
Update
1 parent 0c7e2df commit 65ec8f0

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

tools/searxng.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
<!DOCTYPE html>
66
<html>
7-
<head><meta charset="utf-8"><title>SearXNG Redirector</title></head>
7+
<head>
8+
<meta charset="utf-8">
9+
<link rel="search" type="application/opensearchdescription+xml" title="SearXNG" href="{{ site.url }}/tools/searxng.xml">
10+
<title>SearXNG Redirector</title>
11+
</head>
812
<body>
9-
Accepts SearXNG <a target="_blank" href="https://docs.searxng.org/dev/search_api.html">GET parameters</a>.
1013
<script type="module">
1114
import { detectAll } from '/assets/js/vendor/tinyld.min.js';
1215

@@ -16,7 +19,7 @@
1619
const params = new URLSearchParams(window.location.search);
1720

1821
const loadInstances = async () => {
19-
const fallbacks = FALLBACKS.map(i => `https://${i}/`);
22+
const fallbacks = FALLBACKS.map(i => `https://${i}/`); // TODO: load from cache
2023
if (params.get('fast') === 1) return fallbacks;
2124

2225
const response = await fetch('https://searx.space/data/instances.json');
@@ -80,6 +83,9 @@
8083
if (query) {
8184
redirect(targetUrl, query);
8285
} else {
86+
document.body.innerHTML = '<p>Accepts SearXNG <a target="_blank" href="https://docs.searxng.org/dev/search_api.html">GET parameters</a> + special optional parameter <code>fast=1</code> to use hardcoded instances.</p>';
87+
//window.external.AddSearchProvider('searxng.xml'); // FIXME
88+
8389
const input = document.createElement('input');
8490
const form = document.createElement('form');
8591

tools/searxng.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
permalink: /tools/searxng.xml
3+
---
4+
5+
<?xml version="1.0" encoding="UTF-8"?>
6+
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
7+
<ShortName>SearXNG</ShortName>
8+
<Description>SearXNG Redirector</Description>
9+
<InputEncoding>UTF-8</InputEncoding>
10+
<Image width="32" height="32" type="image/png">assets/favicon-32x32.png</Image>
11+
<Url type="text/html" method="GET" template="{{ site.url }}/tools/searxng?q={searchTerms}&amp;fast=1&image_proxy=True" />
12+
</OpenSearchDescription>

0 commit comments

Comments
 (0)