added weather and tor check special query, fixed an issue with search types, removed an offline instance
This commit is contained in:
parent
ddaceff4e5
commit
e72cc442bf
7 changed files with 84 additions and 21 deletions
|
@ -17,7 +17,6 @@
|
|||
| [librex.extravi.dev](https://librex.extravi.dev/) | [✅](http://ncblhz7q4sfbf755bdbhebfzxcpypz7ewafgi4agatecojz7pln4i3id.onion/) | [✅](http://rra33hiaf6nmby7jfpqe2gqmng3jnzkvbu2n7jgce7vbhoyuhzya.b32.i2p/) | 🇩🇪 DE |
|
||||
| [lx.vern.cc](https://lx.vern.cc/) | [✅](http://lx.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion/) | [✅](http://vernziqfqvweijfaacmwazohgpdo2bt2ib2jlupt2pwwu27bhgxq.b32.i2p/) | 🇺🇸 US |
|
||||
| [search.davidovski.xyz](https://search.davidovski.xyz/) | ❌ | ❌ | 🇬🇧 UK |
|
||||
| [librex.kitscomputer.tk](https://librex.kitscomputer.tk/) | ❌ | ❌ | 🇺🇸 US |
|
||||
| [search.funami.tech](https://search.funami.tech/) | ❌ | ❌ | 🇰🇷 KR |
|
||||
| [librex.catalyst.sx](https://librex.catalyst.sx/) | ❌ | ❌ | 🇺🇸 US |
|
||||
| [search.madreyk.xyz](https://search.madreyk.xyz/) | ❌ | ❌ | 🇩🇪 DE |
|
||||
|
|
|
@ -21,17 +21,25 @@
|
|||
{
|
||||
if (strpos($query_lower, "ip"))
|
||||
{
|
||||
return 4;
|
||||
return 3;
|
||||
}
|
||||
else if (strpos($query_lower, "user agent") || strpos($query_lower, "ua"))
|
||||
{
|
||||
return 5;
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
else if (strpos($query_lower, "weather") !== false)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
else if (strpos($query_lower, "tor") !== false)
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
else if (3 > count(explode(" ", $query))) // wikipedia
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
return 7;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -67,7 +75,13 @@
|
|||
$word_to_define = $reversed_split_q[1];
|
||||
$url = "https://api.dictionaryapi.dev/api/v2/entries/en/$word_to_define";
|
||||
break;
|
||||
case 3:
|
||||
case 5:
|
||||
$url = "https://wttr.in/@" . $_SERVER["REMOTE_ADDR"] . "?format=j1";
|
||||
break;
|
||||
case 6:
|
||||
$url = "https://check.torproject.org/torbulkexitlist";
|
||||
break;
|
||||
case 7:
|
||||
$url = "https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts%7Cpageimages&exintro&explaintext&redirects=1&pithumbsize=500&titles=$query_encoded";
|
||||
break;
|
||||
}
|
||||
|
@ -98,18 +112,27 @@
|
|||
require "engines/special/definition.php";
|
||||
$special_result = definition_results($query, curl_multi_getcontent($special_ch));
|
||||
break;
|
||||
|
||||
case 3:
|
||||
require "engines/special/wikipedia.php";
|
||||
$special_result = wikipedia_results($query, curl_multi_getcontent($special_ch));
|
||||
break;
|
||||
case 4:
|
||||
require "engines/special/ip.php";
|
||||
$special_result = ip_result();
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
require "engines/special/user_agent.php";
|
||||
$special_result = user_agent_result();
|
||||
break;
|
||||
case 5:
|
||||
require "engines/special/weather.php";
|
||||
$special_result = weather_results(curl_multi_getcontent($special_ch));
|
||||
break;
|
||||
case 6:
|
||||
require "engines/special/tor.php";
|
||||
$special_result = tor_result(curl_multi_getcontent($special_ch));
|
||||
break;
|
||||
case 7:
|
||||
require "engines/special/wikipedia.php";
|
||||
$special_result = wikipedia_results($query, curl_multi_getcontent($special_ch));
|
||||
break;
|
||||
}
|
||||
|
||||
if ($special_result != null)
|
||||
|
@ -175,7 +198,7 @@
|
|||
|
||||
array_shift($results);
|
||||
}
|
||||
|
||||
|
||||
echo "<div class=\"text-result-container\">";
|
||||
|
||||
foreach($results as $result)
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
{
|
||||
return array(
|
||||
"special_response" => array(
|
||||
"response" => $_SERVER["REMOTE_ADDR"],
|
||||
"response" => $_SERVER["REMOTE_ADDR"],
|
||||
"source" => null
|
||||
)
|
||||
);
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
|
18
engines/special/tor.php
Normal file
18
engines/special/tor.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
function tor_result($response)
|
||||
{
|
||||
$formatted_response = "It seems like you are not using Tor";
|
||||
if (strpos($response, $_SERVER["REMOTE_ADDR"]) !== false)
|
||||
{
|
||||
$formatted_response = "It seems like you are using Tor";
|
||||
}
|
||||
|
||||
$source = "https://check.torproject.org";
|
||||
return array(
|
||||
"special_response" => array(
|
||||
"response" => $formatted_response,
|
||||
"source" => $source
|
||||
)
|
||||
);
|
||||
}
|
||||
?>
|
26
engines/special/weather.php
Normal file
26
engines/special/weather.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
function weather_results($response)
|
||||
{
|
||||
$json_response = json_decode($response, true);
|
||||
|
||||
if ($json_response)
|
||||
{
|
||||
$current_weather = $json_response["current_condition"][0];
|
||||
|
||||
$temp_c = $current_weather["temp_C"];
|
||||
$temp_f = $current_weather["temp_F"];
|
||||
$description = $current_weather["weatherDesc"][0]["value"];
|
||||
|
||||
$formatted_response = "$description - $temp_c °C | $temp_f °F";
|
||||
|
||||
$source = "https://wttr.in";
|
||||
return array(
|
||||
"special_response" => array(
|
||||
"response" => htmlspecialchars($formatted_response),
|
||||
"source" => $source
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
|
@ -18,12 +18,6 @@
|
|||
"i2p": null,
|
||||
"country": "UK"
|
||||
},
|
||||
{
|
||||
"clearnet": "https://librex.kitscomputer.tk/",
|
||||
"tor": null,
|
||||
"i2p": null,
|
||||
"country": "US"
|
||||
},
|
||||
{
|
||||
"clearnet": "https://search.funami.tech/",
|
||||
"tor": null,
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
echo "<input type=\"hidden\" name=\"$key\" value=\"$value\"/>";
|
||||
}
|
||||
}
|
||||
|
||||
$type = isset($_REQUEST["t"]) ? (int) $_REQUEST["t"] : 0;
|
||||
echo "<button class=\"hide\" name=\"t\" value=\"$type\"/></button>";
|
||||
?>
|
||||
<button type="submit" class="hide"></button>
|
||||
<input type="hidden" name="p" value="0">
|
||||
|
@ -47,7 +50,7 @@
|
|||
$config = require "config.php";
|
||||
require "misc/tools.php";
|
||||
|
||||
$type = isset($_REQUEST["t"]) ? (int) $_REQUEST["t"] : 0;
|
||||
|
||||
$page = isset($_REQUEST["p"]) ? (int) $_REQUEST["p"] : 0;
|
||||
|
||||
$start_time = microtime(true);
|
||||
|
|
Loading…
Reference in a new issue