added image proxy to speed up image results, fixed broken wiki link, downscaled librex related images
|
@ -15,23 +15,18 @@
|
|||
$image = $xpath->evaluate(".//img[@data-src]", $result)[0];
|
||||
|
||||
$url = $xpath->evaluate(".//a/@href", $result)[0]->textContent;
|
||||
$url = check_for_privacy_frontend($url);
|
||||
$url = check_for_privacy_frontend($url);
|
||||
|
||||
if (!empty($image))
|
||||
{
|
||||
$alt = $image->getAttribute("alt");
|
||||
$src = $image->getAttribute("data-src");
|
||||
|
||||
$thumbnail = $image->getAttribute("data-src");
|
||||
|
||||
if (!empty($alt))
|
||||
{
|
||||
$ch = curl_init($src);
|
||||
curl_setopt_array($ch, $config->curl_settings);
|
||||
array_push($chs, $ch);
|
||||
curl_multi_add_handle($mh, $ch);
|
||||
|
||||
array_push($results,
|
||||
array (
|
||||
"base64" => "",
|
||||
"thumbnail" => $thumbnail,
|
||||
"alt" => htmlspecialchars($alt),
|
||||
"url" => htmlspecialchars($url)
|
||||
)
|
||||
|
@ -40,17 +35,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
$running = null;
|
||||
do {
|
||||
curl_multi_exec($mh, $running);
|
||||
} while ($running);
|
||||
|
||||
for ($i=0; count($chs)>$i; $i++)
|
||||
{
|
||||
$img_base64 = base64_encode(curl_multi_getcontent($chs[$i]));
|
||||
$results[$i]["base64"] = $img_base64;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
@ -60,12 +44,12 @@
|
|||
|
||||
foreach($results as $result)
|
||||
{
|
||||
$src = $result["base64"];
|
||||
$thumbnail = $result["thumbnail"];
|
||||
$alt = $result["alt"];
|
||||
$url = $result["url"];
|
||||
|
||||
echo "<a title=\"$alt\" href=\"$url\" target=\"_blank\">";
|
||||
echo "<img src=\"data:image/jpeg;base64,$src\" height=\"200\">";
|
||||
echo "<img src=\"engines/google/image_proxy.php?url=$thumbnail\">";
|
||||
echo "</a>";
|
||||
}
|
||||
|
||||
|
|
11
engines/google/image_proxy.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
$config = require "../../config.php";
|
||||
require "../../misc/tools.php";
|
||||
|
||||
$image = $_REQUEST["url"];
|
||||
$image_src = request($image);
|
||||
|
||||
header("Content-Type: image/jpeg");
|
||||
echo $image_src;
|
||||
?>
|
|
@ -142,7 +142,10 @@
|
|||
|
||||
echo "<p class=\"special-result-container\">";
|
||||
if (array_key_exists("image", $special["special_response"]))
|
||||
echo "<img src=\"data:image/jpeg;base64," . $special["special_response"]["image"] . "\">";
|
||||
{
|
||||
$image_url = $special["special_response"]["image"];
|
||||
echo "<img src=\"engines/google/image_proxy.php?url=$image_url\">";
|
||||
}
|
||||
echo $response;
|
||||
echo "<a href=\"$source\" target=\"_blank\">$source</a>";
|
||||
echo "</p>";
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
{
|
||||
$description = substr($first_page["extract"], 0, 250) . "...";
|
||||
|
||||
$source = check_for_privacy_frontend("https://wikipedia.org/wiki/$query_encoded");
|
||||
$source = check_for_privacy_frontend("https://wikipedia.org/wiki/$query");
|
||||
$response = array(
|
||||
"special_response" => array(
|
||||
"response" => htmlspecialchars($description),
|
||||
|
@ -21,10 +21,8 @@
|
|||
|
||||
if (array_key_exists("thumbnail", $first_page))
|
||||
{
|
||||
$img_url = $first_page["thumbnail"]["source"];
|
||||
$img_src = request($img_url);
|
||||
$base64_src = base64_encode($img_src);
|
||||
$response["special_response"]["image"] = $base64_src;
|
||||
$image_url = $first_page["thumbnail"]["source"];
|
||||
$response["special_response"]["image"] = $image_url;
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
|
BIN
favicon.ico
Normal file
After Width: | Height: | Size: 1.6 KiB |
|
@ -7,7 +7,6 @@
|
|||
<meta name="referrer" content="no-referrer"/>
|
||||
<link rel="stylesheet" type="text/css" href="static/css/styles.css"/>
|
||||
<link title="LibreX search" type="application/opensearchdescription+xml" href="/opensearch.xml?method=POST" rel="search"/>
|
||||
<link rel="shortcut icon" href="static/images/librex.png" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php
|
||||
echo "static/css/";
|
||||
if (isset($_COOKIE["theme"]) || isset($_REQUEST["theme"]))
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<button type="submit" class="hide"></button>
|
||||
<input type="hidden" name="p" value="0">
|
||||
<div class="sub-search-button-wrapper">
|
||||
<button name="type" value="0"><img src="static/images/text_result.png" alt="text result" />Text</button>
|
||||
<button name="type" value="0"><img src="static/images/text_result.png" alt="text result" />General</button>
|
||||
<button name="type" value="1"><img src="static/images/image_result.png" alt="image result" />Images</button>
|
||||
<button name="type" value="2"><img src="static/images/video_result.png" alt="video result" />Videos</button>
|
||||
<button name="type" value="3"><img src="static/images/torrent_result.png" alt="torrent result" />Torrents</button>
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
--main-bg: #202124;
|
||||
--main-fg: #e8eaed;
|
||||
|
||||
--alt-fg: #bd93f9;
|
||||
|
||||
--result-link-fg: #8ab4f8;
|
||||
--result-fg: #999da2;
|
||||
|
||||
|
@ -13,4 +11,4 @@
|
|||
|
||||
--footer-fg: #999da2;
|
||||
--footer-bg: #171717;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
--main-bg: #2f3136;
|
||||
--main-fg: #dcddde;
|
||||
|
||||
--alt-fg: #bd93f9;
|
||||
|
||||
--result-link-fg: #747ff4;
|
||||
--result-fg: #dcddde;
|
||||
|
||||
|
@ -13,4 +11,4 @@
|
|||
|
||||
--footer-fg: #dcddde;
|
||||
--footer-bg: #36393f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
--main-bg: #fff;
|
||||
--main-fg: #202124;
|
||||
|
||||
--alt-fg: #bd93f9;
|
||||
|
||||
--result-link-fg: #1a0dab;
|
||||
--result-fg: #70757a;
|
||||
|
||||
|
@ -13,4 +11,4 @@
|
|||
|
||||
--footer-fg: #70757a;
|
||||
--footer-bg: #f2f2f2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
--main-bg: #011627;
|
||||
--main-fg: #d6deeb;
|
||||
|
||||
--alt-fg: #bd93f9;
|
||||
|
||||
--result-link-fg: #5f7e97;
|
||||
--result-fg: #d6deeb;
|
||||
|
||||
|
@ -13,4 +11,4 @@
|
|||
|
||||
--footer-fg: #d6deeb;
|
||||
--footer-bg: #011627;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
--main-bg: #3B4252;
|
||||
--main-fg: #E5E9F0;
|
||||
|
||||
--alt-fg: #bd93f9;
|
||||
|
||||
--result-link-fg: #88C0D0;
|
||||
--result-fg: #D8DEE9;
|
||||
|
||||
|
@ -13,4 +11,4 @@
|
|||
|
||||
--footer-fg: #D8DEE9;
|
||||
--footer-bg: #2E3440;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,11 @@ a,
|
|||
text-decoration: none;
|
||||
}
|
||||
|
||||
.text-result-wrapper a:visited h2 {
|
||||
color: var(--alt-fg);
|
||||
.text-result-wrapper a:visited h2,
|
||||
.special-result-container a,
|
||||
.sub-search-button-wrapper button
|
||||
{
|
||||
color: #bd93f9;
|
||||
}
|
||||
|
||||
a:hover, .text-result-wrapper h2:hover {
|
||||
|
@ -106,7 +109,6 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
.sub-search-button-wrapper button {
|
||||
border: none;
|
||||
background-color: inherit;
|
||||
color: var(--alt-fg);
|
||||
font-size: 18px;
|
||||
margin-right: 25px;
|
||||
}
|
||||
|
@ -187,7 +189,6 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
.special-result-container a {
|
||||
display: flex;
|
||||
margin-top: 10px;
|
||||
color: var(--alt-fg);
|
||||
font-size:14px;
|
||||
}
|
||||
|
||||
|
@ -229,9 +230,7 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
}
|
||||
|
||||
.image-result-container img {
|
||||
border: 1px solid var(--button-bg);
|
||||
width: 350px;
|
||||
height: 200px;
|
||||
border: 2px solid var(--button-bg);
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
|
@ -269,6 +268,22 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.X {
|
||||
color: #bd93f9;
|
||||
}
|
||||
|
||||
.seeders {
|
||||
color: #50fa7b;
|
||||
}
|
||||
|
||||
.leechers {
|
||||
color: #ff79c6;
|
||||
}
|
||||
|
||||
/* mobile view */
|
||||
@media only screen and (max-width: 900px) {
|
||||
.search-container input {
|
||||
|
@ -346,19 +361,3 @@ a:hover, .text-result-wrapper h2:hover {
|
|||
font-size: 55px;
|
||||
}
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.X {
|
||||
color: #bd93f9;
|
||||
}
|
||||
|
||||
.seeders {
|
||||
color: #50fa7b;
|
||||
}
|
||||
|
||||
.leechers {
|
||||
color: #ff79c6;
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 5 KiB After Width: | Height: | Size: 907 B |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 425 B |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 524 B |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 514 B |