|
22 | 22 | const INSTANCES_URL = 'https://searx.space/data/instances.json'; |
23 | 23 | const INSTANCES = ['search.charliewhiskey.net', 'search.im-in.space', 'search.ipsys.bf', 'search.mycotrip.tech', 'search.ononoki.org', 'search.pollorebozado.com', 'search.rowie.at', 'search.system51.co.uk', 'search.undertale.uk', 'search.url4irl.com', 'searx.bndkt.io', 'searx.dresden.network', 'searx.foss.family', 'searx.oloke.xyz', 'searx.ox2.fr', 'searx.party', 'searx.perennialte.ch', 'searx.tiekoetter.com', 'searx.zhenyapav.com', 'searxng.shreven.org'] |
24 | 24 | const LANGUAGES = ['en']; |
| 25 | +const GET = '0'; |
25 | 26 | const TIMEOUT = 5000; |
26 | 27 | const ATTEMPTS = 10; |
27 | 28 | const CUSTOM_PARAMS = ['attempts', 'languages', 'fast', 'instances', 'timeout']; |
|
157 | 158 | newParams.set('image_proxy', params.get('image_proxy') || 'True'); |
158 | 159 |
|
159 | 160 | const timeout = Number(params.get('timeout')) || TIMEOUT; |
160 | | - const getMethod = params.get('get') === '1'; |
| 161 | + const getMethod = (params.get('get') || GET) === '1'; |
161 | 162 | for (let i = 0; i < shuffledInstances.length; i++) schedule(_ => { |
162 | 163 | window.stop(); |
163 | 164 | if (i > 0) { |
|
240 | 241 | document.body.appendChild(form); |
241 | 242 | input.focus(); |
242 | 243 |
|
243 | | - const pageUrl = `${window.location.protocol}//${window.location.pathname}`; |
| 244 | + const pageUrl = window.location.toString(); |
244 | 245 | const div = document.createElement('div'); |
245 | 246 | div.innerHTML = ` |
246 | 247 | <p>This page redirects to a <a rel="noopener noreferrer nofollow" href="${pageUrl}#q=" onclick="window.location.replace('${pageUrl}#q=')">random SearXNG</a> instance.</p> |
|
254 | 255 | <ul> |
255 | 256 | <li>normal SearXNG GET/POST <a rel="noopener" target="_blank" href="https://docs.searxng.org/dev/search_api.html">parameters</a> (<code>safesearch=0</code> and <code>image_proxy=True</code> are set by default)</li> |
256 | 257 | <li><code>languages</code> limit query-based language detection, fallbacks to the first language in the list when not detected (use <code>all</code> to fallback to SearXNG-based language detection instead); comma-separated, default is <code>${LANGUAGES.join(',')}</code></li> |
257 | | - <li><code>get</code> pass parameters to the instance using GET method; default is <code>0</code></li> |
| 258 | + <li><code>get</code> pass parameters to the instance using GET method; default is <code>${GET}</code></li> |
258 | 259 | <li><code>timeout</code> in milliseconds until attempting the next instance; default is <code>${TIMEOUT}</code></li> |
259 | 260 | <li><code>attempts</code> how many instances to try; default is <code>${ATTEMPTS}</code></li> |
260 | 261 | <li><code>fast</code> always use the predefined SearXNG instances rather than just as a fallback (no <a rel="noopener" target="_blank" href="${INSTANCES_URL}">API</a> will be used); default is <code>0</code></li> |
261 | 262 | <li><code>instances</code> the predefined instances (use <code>fast=1</code> to force the use of them); comma-separated, default is <code>${INSTANCES.join(',')}</code></li> |
262 | 263 | </ul> |
263 | 264 | ${pageUrl.startsWith('file:') ? '' : `<p>For local use (doesn't require any server): <code>wget ${pageUrl} -O searxng.html</code></p>`} |
| 265 | +<p>License: MIT/Apache-2.0</p> |
264 | 266 | <p>Additionally can be combined with the Violentmonkey userscripts:</p> |
265 | 267 | <ul> |
266 | 268 | <li><a rel="noopener" target="_blank" href="https://userscripts.codonaft.com/redirect-searxng-on-failure.js">redirect-searxng-on-failure.js</a> — turn search failures into the redirects</li> |
267 | | - <li><a rel="noopener" target="_blank" href="https://userscripts.codonaft.com/force-searxng-parameters.js">force-searxng-parameters.js</a> — always enable image proxy and disable SafeSearch</li> |
| 269 | + <li><a rel="noopener" target="_blank" href="https://userscripts.codonaft.com/force-searxng-parameters.js">force-searxng-parameters.js</a> — always enable image proxy, disable SafeSearch and more</li> |
268 | 270 | </ul> |
269 | 271 | <hr> |
270 | 272 | <p>Existing alternatives:</p> |
|
0 commit comments