Compare commits

...

3 Commits

Author SHA1 Message Date
Dionysus 9bc1c1e9a6
Added config and opensearch 2023-11-12 16:21:32 -05:00
Dionysus f7d942abf8
Updated to the latest version 2023-11-12 16:11:17 -05:00
Dionysus 1ffb41a09a
Updated to the latest version 2023-11-12 16:08:50 -05:00
31 changed files with 452 additions and 109 deletions

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
/config.php
/opensearch.xml

View File

@ -13,6 +13,10 @@
<br>
## Matrix
If there's an important announcement, we do have a Matrix chatroom which you can join over at #librey:ahwx.org.
### Instances
You can find a list of instances on any LibreY instance by accessing /instances.php.<br>
@ -25,8 +29,10 @@ Instance list on [@codedipper](https://github.com/codedipper)'s instance:<br>
[Tor](http://librex.revvybrr6pvbx4n3j4475h4ghw4elqr4t5xo2vtd3gfpu2nrsnhh57id.onion/instances.php)<br>
[I2P](http://revekebotog64xrrammtsmjwtwlg3vqyzwdurzt2pu6botg4bejq.b32.i2p/instances.php)<br>
<br>
[@Ahwxorg](https://github.com/Ahwxorg)'s instance:<br>
[@Ahwxorg](https://github.com/Ahwxorg)'s instances:<br>
[search.ahwx.org](https://search.ahwx.org/instances.php)<br>
[Tor](http://wn5jl6fxlzzfenlyu3lc4q7jpw2saplrywxvxtvqbguotwd4y5cjeuqd.onion/instances.php)<br>
[search2.ahwx.org](https://search.ahwx.org/instances.php)<br>
[Tor](http://hyy7rcvknwb22v4nnoar635wntiwr4uwzhiuyimemyl4fz6k7tahj5id.onion/instances.php)<br>
<br>
[@davidovski](https://github.com/davidovski)'s instance:<br>
@ -46,4 +52,3 @@ LibreY gives you text results from DuckDuckGo or Google, images from Qwant, and
| LibreY | ✅ | ✅ | ✅ | ✅ | ✅ |
| SearXNG | ❓ Not user friendly | ❓ Only host can set it | ✅ | ✅ | ❌ |
| Whoogle | ✅ | ❓ Only host can set it | ❌ | ❌ | ❌ |

View File

@ -1,6 +1,7 @@
<?php
require "misc/tools.php";
require "misc/search_engine.php";
require "locale/localization.php";
$opts = load_opts();

161
config.php Normal file
View File

@ -0,0 +1,161 @@
<?php
return (object) array(
// e.g.: fr -> https://google.fr/
"google_domain" => "com",
// Results will be in this language
"language" => "",
"number_of_results" => 10,
// You can use any Invidious instance here
"invidious_instance_for_video_results" => "https://watch.supernets.org/",
"disable_bittorent_search" => false,
"bittorent_trackers" => "&tr=http://nyaa.tracker.wf:7777/announce&tr=udp://open.stealth.si:80/announce&tr=udp://tracker.opentrackr.org:1337/announce&tr=udp://exodus.desync.com:6969/announce&tr=udp://tracker.torrent.eu.org:451/announce",
"disable_hidden_service_search" => false,
// Fallback to another librex instance if google search fails
// This may greatly increase the time it takes to get a result, if a direct search is not possible
"instance_fallback" => true,
// how long in minutes to put google/other instances on cooldown if they aren't responding
"request_cooldown" => 25,
// how long in minutes to store results for in the cache
"cache_time" => 20,
/*
Preset privacy friendly frontends for users, these can be overwritten by users in the settings
e.g.: Preset the invidious instance URL: "instance_url" => "https://yewtu.be",
*/
"frontends" => array(
"invidious" => array(
"instance_url" => "https://watch.supernets.org/",
"project_url" => "https://docs.invidious.io/instances/",
"original_name" => "YouTube",
"original_url" => "youtube.com"
),
"rimgo" => array(
"instance_url" => "",
"project_url" => "https://codeberg.org/video-prize-ranch/rimgo#instances",
"original_name" => "Imgur",
"original_url" => "imgur.com"
),
"scribe" => array(
"instance_url" => "",
"project_url" => "https://git.sr.ht/~edwardloveall/scribe/tree/main/docs/instances.md",
"original_name" => "Medium",
"original_url" => "medium.com"
),
"gothub" => array(
"instance_url" => "",
"project_url" => "https://codeberg.org/gothub/gothub#instances",
"original_name" => "GitHub",
"original_url" => "github.com"
),
"nitter" => array(
"instance_url" => "",
"project_url" => "https://github.com/zedeus/nitter/wiki/Instances",
"original_name" => "Twitter",
"original_url" => "twitter.com"
),
"libreddit" => array(
"instance_url" => "",
"project_url" => "https://github.com/libreddit/libreddit-instances/blob/master/instances.md",
"original_name" => "Reddit",
"original_url" => "reddit.com"
),
"proxitok" => array(
"instance_url" => "",
"project_url" => "https://github.com/pablouser1/ProxiTok/wiki/Public-instances",
"original_name" => "TikTok",
"original_url" => "tiktok.com"
),
"wikiless" => array(
"instance_url" => "",
"project_url" => "https://github.com/Metastem/wikiless#instances",
"original_name" => "Wikipedia",
"original_url" => "wikipedia.org"
),
"quetre" => array(
"instance_url" => "",
"project_url" => "https://github.com/zyachel/quetre#instances",
"original_name" => "Quora",
"original_url" => "quora.com"
),
"libremdb" => array(
"instance_url" => "",
"project_url" => "https://github.com/zyachel/libremdb#instances",
"original_name" => "IMDb",
"original_url" => "imdb.com"
),
"breezewiki" => array(
"instance_url" => "",
"project_url" => "https://docs.breezewiki.com/Links.html",
"original_name" => "Fandom",
"original_url" => "fandom.com"
),
"anonymousoverflow" => array(
"instance_url" => "",
"project_url" => "https://github.com/httpjamesm/AnonymousOverflow#clearnet-instances",
"original_name" => "StackOverflow",
"original_url" => "stackoverflow.com"
),
"suds" => array(
"instance_url" => "",
"project_url" => "https://git.vern.cc/cobra/Suds/src/branch/main/instances.json",
"original_name" => "Snopes",
"original_url" => "snopes.com"
),
"biblioreads" => array(
"instance_url" => "",
"project_url" => "https://github.com/nesaku/BiblioReads#instances",
"original_name" => "Goodreads",
"original_url" => "goodreads.com"
)
),
"preferred_engines" => array(
/* replace with "text" => "duckduckgo" to use duckduckgo instead
* (recommended if being ratelimited */
//"text" => "google"
"text" => "duckduckgo"
),
/*
To send requests trough a proxy uncomment CURLOPT_PROXY and CURLOPT_PROXYTYPE:
CURLOPT_PROXYTYPE options:
CURLPROXY_HTTP
CURLPROXY_SOCKS4
CURLPROXY_SOCKS4A
CURLPROXY_SOCKS5
CURLPROXY_SOCKS5_HOSTNAME
!!! ONLY CHANGE THE OTHER OPTIONS IF YOU KNOW WHAT YOU ARE DOING !!!
*/
"curl_settings" => array(
// CURLOPT_PROXY => "ip:port",
// CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:116.0) Gecko/20100101 Firefox/116.0", // For a normal Windows 10 PC running Firefox x64
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_WHATEVER,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP,
CURLOPT_REDIR_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP,
CURLOPT_MAXREDIRS => 5,
CURLOPT_TIMEOUT => 3,
CURLOPT_VERBOSE => false,
CURLOPT_FOLLOWLOCATION => true
)
);
?>

View File

@ -10,8 +10,7 @@
<div class="donate-container">
<!-- librex dev -->
<h2>
Donate to the original developer of Libre<span class="Y">X</span>, a
project LibreY tries to improve.
<?php printftext("donate_original_developer", "Libre<span class=\"Y\">X</span>")?>
</h2>
<div class="flexbox-column">
@ -46,11 +45,9 @@
<hr class="small-line" />
<!-- librey dev -->
<h2>
Donate to the person that forked LibreX into Libre<span class="Y"
>Y</span
>
</h2>
<h2>
<?php printftext("donate_fork", "Libre<span class=\"Y\">X</span>")?>
</h2>
<div class="qr-box">
<div class="inner-wrap">

View File

@ -21,7 +21,7 @@
array_push($results,
array (
"title" => $title ? htmlspecialchars($title) : "No description provided",
"title" => $title ? htmlspecialchars($title) : TEXTS["result_no_description"],
"url" => htmlspecialchars($url),
// base_url is to be removed in the future, see #47
"base_url" => htmlspecialchars(get_base_url($url)),

View File

@ -4,12 +4,12 @@
$url = $_REQUEST["url"];
$response = request($url);
$response = request($url, $config->curl_settings);
$xpath = get_xpath($response);
$magnet = $xpath->query("//main/div/div/div/div/div/ul/li/a/@href")[0]->textContent;
$magnet_without_tracker = explode("&tr=", $magnet)[0];
$magnet = $magnet_without_tracker . $config->bittorent_trackers;
header("Location: $magnet")
?>
?>

View File

@ -38,7 +38,7 @@
echo "<div class=\"text-result-container\">";
if (empty($results)) {
echo "<p>There are no results. Please try different keywords!</p>";
echo "<p>" . TEXTS["failure_empty"] . "</p>";
return;
}

View File

@ -25,7 +25,7 @@
$leechers = $torrent["peers"];
$size = $torrent["size"];
$magnet = "magnet:?xt=urn:btih:$hash&dn=$name_encoded$this->opts->bittorrent_trackers";
$magnet = "magnet:?xt=urn:btih:$hash&dn=$name_encoded" . $this->opts->bittorrent_trackers;
array_push($results,
array (

View File

@ -49,6 +49,8 @@
if (!$instance)
break;
if (!filter_var($instance, FILTER_VALIDATE_URL) || !filter_var($_SERVER["HTTP_HOST"], FILTER_VALIDATE_URL))
continue;
if (parse_url($instance)["host"] == parse_url($_SERVER['HTTP_HOST'])["host"])
continue;
@ -67,7 +69,7 @@
return array(
"error" => array(
"message" => "No results found. Unable to fallback to other instances."
"message" => TEXTS["failure_fallback"]
)
);
}

View File

@ -3,7 +3,7 @@
public function get_request_url() {
$page = $this->page / 10 + 1; // qwant has a different page system
$query = urlencode($this->query);
return "https://lite.qwant.com/?q=$query&t=images&p=$page";
}
@ -15,7 +15,7 @@
return $results;
foreach($xpath->query("//a[@rel='noopener']") as $result)
{
{
$image = $xpath->evaluate(".//img", $result)[0];
if ($image)
@ -28,25 +28,29 @@
$alt = $image->getAttribute("alt");
$thumbnail = urlencode($image->getAttribute("src"));
array_push($results,
array_push($results,
array (
"thumbnail" => urldecode(htmlspecialchars($thumbnail)),
"alt" => htmlspecialchars($alt),
"url" => htmlspecialchars($real_url)
)
);
}
}
return $results;
}
public static function print_results($results, $opts) {
echo "<div class=\"image-result-container\">";
foreach($results as $result)
{
if (!$result
|| !array_key_exists("url", $result)
|| !array_key_exists("alt", $result))
continue;
$thumbnail = urlencode($result["thumbnail"]);
$alt = $result["alt"];
$url = $result["url"];

View File

@ -4,13 +4,16 @@
public function get_request_url() {
$split_query = explode(" ", $this->query);
$reversed_split_q = array_reverse($split_query);
$word_to_define = $reversed_split_q[1];
$word_to_define = $reversed_split_q[1] == "define" ? $reversed_split_q[0] : $reversed_split_q[1];
return "https://api.dictionaryapi.dev/api/v2/entries/en/$word_to_define";
}
public function parse_results($response) {
$json_response = json_decode($response, true);
if (!$json_response)
return array();
if (!array_key_exists("title", $json_response))
{
$definition = $json_response[0]["meanings"][0]["definitions"][0]["definition"];
@ -23,7 +26,7 @@
)
);
}
}
}
?>

View File

@ -13,7 +13,7 @@
if ($amount_to_convert != 0)
return 1;
}
else if (strpos($query_lower, "mean") && count($split_query) >= 2) // definition
else if ((strpos($query_lower, "mean") || str_starts_with($query_lower, "define")) && count($split_query) >= 2) // definition
{
return 2;
}

View File

@ -14,6 +14,8 @@
public function parse_results($response) {
$json_response = json_decode($response, true);
if (!$json_response)
return array();
$first_page = array_values($json_response["query"]["pages"])[0];

View File

@ -1,7 +1,6 @@
<?php
class DuckDuckGoRequest extends EngineRequest {
function get_request_url()
{
public function get_request_url() {
$query_encoded = str_replace("%22", "\"", urlencode($this->query));
$results = array();
@ -53,7 +52,7 @@
// base_url is to be removed in the future, see #47
"base_url" => htmlspecialchars(get_base_url($url)),
"description" => $description == null ?
"No description was provided for this site." :
TEXTS["result_no_description"] :
htmlspecialchars($description->textContent)
)
);

View File

@ -46,11 +46,8 @@
if ($url == null)
continue;
if (!empty($results)) // filter duplicate results, ignore special result
{
if (end($results)["url"] == $url->textContent)
if (!empty($results) && array_key_exists("url", $results) && end($results)["url"] == $url->textContent)
continue;
}
$url = $url->textContent;
@ -64,7 +61,7 @@
// base_url is to be removed in the future, see #47
"base_url" => htmlspecialchars(get_base_url($url)),
"description" => $description == null ?
"No description was provided for this site." :
TEXTS["result_no_description"] :
htmlspecialchars($description->textContent)
)
);
@ -72,7 +69,7 @@
if (empty($results) && !str_contains($response, "Our systems have detected unusual traffic from your computer network.")) {
$results["error"] = array(
"message" => "There are no results. Please try different keywords!"
"message" => TEXTS["failure_empty"]
);
}

View File

@ -11,7 +11,7 @@
if (in_array($requested_root_domain, $allowed_domains))
{
$image = $url;
$image_src = request($image);
$image_src = request($image, $config->curl_settings);
header("Content-Type: image/png");
echo $image_src;

View File

@ -1,4 +1,3 @@
<?php require "misc/header.php"; ?>
<title>SuperLibreX</title>
</head>
@ -10,7 +9,7 @@
<input type="hidden" name="t" value="0"/>
<input type="submit" class="hide"/>
<div class="search-button-wrapper">
<button name="t" value="0" type="submit">Surfs Up 🏄🌊</button>
<button name="t" value="0" type="submit">Surfs Up 🏄♂🌊</button>
</div>
</form>
<?php require "misc/footer.php"; ?>

View File

@ -29,22 +29,29 @@
"librey": true
},
{
"clearnet": "https://librex.zzls.xyz/",
"tor": "http://librex.zzlsghu6mvvwyy75mvga6gaf4znbp3erk5xwfzedb4gg6qqh2j6rlvid.onion/",
"i2p": "http://zzlsaymhcfla7vibo3a223bybeecu3bd5z6rmw2u4y76maqeu76q.b32.i2p/",
"country": "CL",
"librey": true
"clearnet": "https://ly.owo.si/",
"tor": "http://ly.pk47sgwhncn5cgidm7bofngmh7lc7ukjdpk5bjwfemmyp27ovl25ikyd.onion/",
"i2p": "http://d4vi3tvfui2rfzsxr33tin4a6542heulf4mhkokdpbhbcejlg3la.b32.i2p/",
"country": "DE",
"librey": true
},
{
"clearnet": "https://lx.vern.cc/",
"tor": "http://lx.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion/",
"i2p": "http://vernziqfqvweijfaacmwazohgpdo2bt2ib2jlupt2pwwu27bhgxq.b32.i2p/",
{
"clearnet": "https://librey.danyaal.xyz/",
"tor": "http://libreytvcxak42f3p7nxh3filsp2pjqesjii5f5e4eivs2gpcn77tdid.onion/",
"i2p": "http://libreyqmoa2iuihoyyscolhaymrxxgdrmkgmiufnyaukwub2c7ya.b32.i2p/",
"country": "GB",
"librey": true
},
{
"clearnet": "https://librey.org/",
"tor": "http://jxhkfulu6wpdl4apuy4dyivuowmpprvsd7e3el2z73crq7fmyv7rjkyd.onion/",
"i2p": null,
"country": "US",
"librey": true
},
{
"clearnet": "https://librey.org/",
"tor": "http://jxhkfulu6wpdl4apuy4dyivuowmpprvsd7e3el2z73crq7fmyv7rjkyd.onion/",
"clearnet": "https://librex.supernets.org/",
"tor": "http://ouosr2fq3lktngcvbz4r4op2lab5hbiz5y6g6toorsgieb7elet76jad.onion/",
"i2p": null,
"country": "US",
"librey": true
@ -56,20 +63,6 @@
"country": "GB",
"librey": true
},
{
"clearnet": "https://librey.spaceint.fr/",
"tor": null,
"i2p": null,
"country": "FR",
"librey": true
},
{
"clearnet": "https://librey.bloatcat.tk/",
"tor": null,
"i2p": null,
"country": "IS",
"librey": true
},
{
"clearnet": "https://search.funami.tech/",
"tor": null,
@ -106,11 +99,11 @@
"librey": true
},
{
"clearnet": "https://librex.yogeshlamichhane.com.np/",
"tor": null,
"i2p": null,
"country": "FI",
"librey": true
"clearnet": "https://librex.yogeshlamichhane.com.np/",
"tor": null,
"i2p": null,
"country": "FI",
"librey": true
},
{
"clearnet": "https://librey.baczek.me/",
@ -127,25 +120,11 @@
"librey": true
},
{
"clearnet": "https://librex.supernets.org/",
"tor": "http://ouosr2fq3lktngcvbz4r4op2lab5hbiz5y6g6toorsgieb7elet76jad.onion/",
"i2p": null,
"country": "US",
"librey": true
},
{
"clearnet": "https://lx.owo.si/",
"tor": "http://lx.pk47sgwhncn5cgidm7bofngmh7lc7ukjdpk5bjwfemmyp27ovl25ikyd.onion/",
"i2p": "http://d4vi3tvfui2rfzsxr33tin4a6542heulf4mhkokdpbhbcejlg3la.b32.i2p/",
"country": "DE",
"librey": false
},
{
"clearnet": "https://search.tildevarsh.in/",
"clearnet": "https://search.seitan-ayoub.lol/",
"tor": null,
"i2p": null,
"country": "IN",
"librey": false
"country": "DE",
"librey": true
},
{
"clearnet": "https://librex.myroware.eu/",

View File

@ -51,7 +51,7 @@
list_instances($librey_instances);
?>
<p>The following instances are running the older <a href="https://github.com/hnhx/librex">LibreX</a>:</p>
<p><?php printftext("instances_librex", "<a href=\"https://github.com/hnhx/librex\">LibreX</a>")?>:</p>
<?php
list_instances($librex_instances);
?>

53
locale/en.php Normal file
View File

@ -0,0 +1,53 @@
<?php
return array(
"page_title" => "LibreY search",
"search_button" => "Search with LibreY",
"torrent_search_button" => "Search torrents with LibreY",
"source_code_link" => "Source",
"instances_link" => "Instances",
"settings_link" => "Settings",
"api_link" => "API",
"donate_link" => "Donate ❤️",
"latest_commit" => "Latest commit: %s",
"category_general" => "General",
"category_images" => "Images",
"category_videos" => "Videos",
"category_torrents" => "Torrents",
"category_tor" => "Tor",
"feature_disabled" => "The host has disabled this feature :C",
"settings_title" => "Settings",
"settings_theme" => "Theme",
"settings_special_disabled" => "Disable special queries (e.g.: currency conversion)",
"settings_frontends" => "Privacy friendly frontends",
"settings_frontends_description" => "For an example if you want to view YouTube without getting spied on, click on \"Invidious\", find the instance that is most suitable for you then paste it in (correct format: https://example.com)",
"settings_frontends_disable" => "Disable frontends",
"settings_search_settings" => "Search settings",
"settings_language" => "Language",
"settings_number_of_results" => "Number of results per page",
"settings_safe_search" => "Safe search",
"settings_save" => "Save",
"settings_reset" => "Reset",
"failure_fallback" => "No results found. Unable to fallback to other instances.",
"failure_empty" => "No results found. Please try different keywords!",
"result_no_description" => "No description was provided for this site.",
"instances_librex" => "The following instances are running the older %s",
"donate_original_developer" => "Donate to the original developer of %s, a
project LibreY tries to improve.",
"donate_fork" => "Donate to the person that forked %s into LibreY"
);
?>

28
locale/localization.php Normal file
View File

@ -0,0 +1,28 @@
<?php
function printtext($key) {
echo TEXTS[$key];
}
function printftext() {
$argv = func_get_args();
$key = array_shift($argv);
vprintf(TEXTS[$key], $argv);
}
// default to language "en"
$locale = "en";
if (array_key_exists("HTTP_ACCEPT_LANGUAGE", $_SERVER)) {
$accept_language_header = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
foreach(explode(",", explode(";", $accept_language_header)[0]) as $header_language) {
if (file_exists("locale/$header_language.php")) {
$locale = $header_language;
break;
}
}
}
define("TEXTS", require "locale/$locale.php");
?>

52
locale/nl.php Normal file
View File

@ -0,0 +1,52 @@
<?php
return array(
"page_title" => "LibreY search",
"search_button" => "Zoek met LibreY",
"torrent_search_button" => "Zoek naar torrents met LibreY",
"source_code_link" => "Broncode",
"instances_link" => "Instances",
"settings_link" => "Instellingen",
"api_link" => "API",
"donate_link" => "Doneer ❤️",
"latest_commit" => "Laatste commit: %s",
"category_general" => "Algemeem",
"category_images" => "Foto's",
"category_videos" => "Videos",
"category_torrents" => "Torrents",
"category_tor" => "Tor",
"feature_disabled" => "De host heeft deze functie uitgeschakeld :C",
"settings_title" => "Instellingen",
"settings_theme" => "Thema",
"settings_special_disabled" => "Schakel speciale zoekopdrachten uit (bijvoorbeeld: valutaconversie)",
"settings_frontends" => "Privacyvriendelijke frontends",
"settings_frontends_description" => "Als je - bijvoorbeeld - naar YouTube wil kijken zonder bespioneerd te worden, klik dan op \"Invidious\", zoek een instance die het best voor jou is en plak de URL hier in (correct formaat: https://example.com)",
"settings_frontends_disable" => "Frontends uitschakelen",
"settings_search_settings" => "Zoek-gerelateerde instellingen",
"settings_language" => "Taal",
"settings_number_of_results" => "Resulaten per pagina (in nummers)",
"settings_safe_search" => "Safe search",
"settings_save" => "Opslaan",
"settings_reset" => "Reset",
"failure_fallback" => "Geen resultaten gevonden. Kan niet terugvallen op andere instances.",
"failure_empty" => "Geen resultaten gevonden. Probeer een andere zoekterm/andere keywords!",
"result_no_description" => "Voor deze website is geen omschrijving gegeven.",
"instances_librex" => "De volgende instances draaien de oudere versie; %s",
"donate_original_developer" => "Doneer aan de originele ontwikkelaar van %s, een project dat LibreY probeert te verbeteren.",
"donate_fork" => "Doneer aan de persoon die %s heeft geforkt naar LibreY"
);
?>

53
locale/sv.php Normal file
View File

@ -0,0 +1,53 @@
<?php
return array(
"page_title" => "LibreY search",
"search_button" => "Sök med LibreY",
"torrent_search_button" => "Sök torrents med LibreY",
"source_code_link" => "Källkod",
"instances_link" => "Instanser",
"settings_link" => "Inställningar",
"api_link" => "API",
"donate_link" => "Donera ❤️",
"latest_commit" => "Senaste commit: %s",
"category_general" => "Allmänt",
"category_images" => "Bilder",
"category_videos" => "Videor",
"category_torrents" => "Torrents",
"category_tor" => "Tor",
"feature_disabled" => "Funktionen är inaktiverad av serverägaren :C",
"settings_title" => "Inställningar",
"settings_theme" => "Tema",
"settings_special_disabled" => "Inaktivera specialförfrågningar (t.ex. valutaomvandlare)",
"settings_frontends" => "Privata frontends",
"settings_frontends_description" => "För om du vill titta på YouTube utan att bli spionerad på, klicka på \"Invidious\", hitta den instans som passar dig bäst och klistra in (korrekt format: https://example.com)",
"settings_frontends_disable" => "Stäng av frontends",
"settings_search_settings" => "Sökinställningar",
"settings_language" => "Språk",
"settings_number_of_results" => "Antal resultat per sida",
"settings_safe_search" => "Safe search",
"settings_save" => "Spara",
"settings_reset" => "Återställ",
"failure_fallback" => "Inga resultat hittades. Gick inte att använda andra instanser som reservlösning.",
"failure_empty" => "Inga resultat hittades. Var god försök med andra nyckelord!",
"result_no_description" => "Ingen beskrivning finns för denna webbplats.",
"instances_librex" => "Följande instanser kör den äldre %s",
"donate_original_developer" => "Donera till orginalutvecklaren av %s, ett
projekt som LibreY försöker förbättra.",
"donate_fork" => "Donera till personen som forkade %s till LibreY"
);
?>

View File

@ -3,8 +3,8 @@
<a href="./settings.php">Settings</a>
<a href="./api.php" target="_blank">API</a>
<a href="./donate.php">Donate</a>
<a href="http://ouosr2fq3lktngcvbz4r4op2lab5hbiz5y6g6toorsgieb7elet76jad.onion/">Onion</a>
<a href="https://supernets.org/">SuperNETs</a>
<a href="http://ouosr2fq3lktngcvbz4r4op2lab5hbiz5y6g6toorsgieb7elet76jad.onion/">Onion</a>
<a href="https://supernets.org/">SuperNETs</a>
</div>
</body>
</html>

View File

@ -1,3 +1,4 @@
<?php require "locale/localization.php"; ?>
<!DOCTYPE html >
<html lang="en">
<head>
@ -6,7 +7,7 @@
<meta name="description" content="A privacy respecting meta search engine."/>
<meta name="referrer" content="no-referrer"/>
<link rel="stylesheet" type="text/css" href="static/css/styles.css"/>
<link title="LibreY search" type="application/opensearchdescription+xml" href="opensearch.xml?method=POST" rel="search"/>
<link title="<?php printtext("page_title"); ?>" type="application/opensearchdescription+xml" href="opensearch.xml?method=POST" rel="search"/>
<link rel="stylesheet" type="text/css" href="<?php
$theme = $_REQUEST["theme"] ?? trim(htmlspecialchars($_COOKIE["theme"] ?? "dark"));
echo "static/css/" . $theme . ".css";

View File

@ -120,7 +120,7 @@
case 3:
if ($opts->disable_bittorent_search) {
echo "<p class=\"text-result-container\">The host disabled this feature! :C</p>";
echo "<p class=\"text-result-container\">" . TEXTS["feature_disabled"] . "</p>";
break;
}
@ -129,7 +129,7 @@
case 4:
if ($opts->disable_hidden_service_search) {
echo "<p class=\"text-result-container\">The host disabled this feature! :C</p>";
echo "<p class=\"text-result-container\">" . TEXTS["feature_disabled"] . "</p>";
break;
}
require "engines/ahmia/hidden_service.php";

View File

@ -77,11 +77,9 @@
return $xpath;
}
function request($url) {
$config ??= require "config.php";
function request($url, $conf) {
$ch = curl_init($url);
curl_setopt_array($ch, $config->curl_settings);
curl_setopt_array($ch, $conf);
$response = curl_exec($ch);
return $response;

11
opensearch.xml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>SuperLibreX</ShortName>
<Description>Framework and javascript free privacy respecting meta search engine</Description>
<InputEncoding>UTF-8</InputEncoding>
<LongName>SuperLibreX search</LongName>
<Url rel="results" type="text/html" method="get" template="https://librex.supernets.org/search.php?q={searchTerms}" />
<Url type="application/opensearchdescription+xml"
rel="self"
template="/opensearch.xml?method=GET" />
</OpenSearchDescription>

View File

@ -65,7 +65,7 @@
continue;
}
echo "<a " . (($category_index == $opts->type) ? "class=\"active\" " : "") . "href=\"./search.php?q=" . urlencode($opts->query) . "&p=0&t=" . $category_index . "\"><img src=\"static/images/" . $category . "_result.png\" alt=\"" . $category . " result\" />" . ucfirst($category) . "</a>";
echo "<a " . (($category_index == $opts->type) ? "class=\"active\" " : "") . "href=\"./search.php?q=" . urlencode($opts->query) . "&p=0&t=" . $category_index . "\"><img src=\"static/images/" . $category . "_result.png\" alt=\"" . $category . " result\" />" . TEXTS["category_$category"] . "</a>";
}
?>
</div>

View File

@ -33,14 +33,14 @@
require "misc/header.php";
?>
<title>LibreY - Settings</title>
<title>LibreY - <?php printtext("settings_title");?></title>
</head>
<body>
<div class="misc-container">
<h1>Settings</h1>
<form method="post" enctype="multipart/form-data" autocomplete="off">
<div>
<label for="theme">Theme:</label>
<label for="theme"><?php printtext("settings_theme");?>:</label>
<select name="theme">
<?php
$themes = "<option value=\"dark\">Dark</option>
@ -70,12 +70,12 @@
</select>
</div>
<div>
<label>Disable special queries (e.g.: currency conversion)</label>
<label><?php printtext("settings_special_disabled");?></label>
<input type="checkbox" name="disable_special" <?php echo $opts->disable_special ? "checked" : ""; ?> >
</div>
<h2>Privacy friendly frontends</h2>
<p>For an example if you want to view YouTube without getting spied on, click on "Invidious", find the instance that is most suitable for you then paste it in (correct format: https://example.com)</p>
<h2><?php printtext("settings_frontends");?></h2>
<p><?php printtext("settings_frontends_description");?></p>
<div class="settings-textbox-container">
<?php
foreach($opts->frontends as $frontend => $data)
@ -90,14 +90,14 @@
?>
</div>
<div>
<label>Disable frontends</label>
<label><?php printtext("settings_frontends_disable");?></label>
<input type="checkbox" name="disable_frontends" <?php echo $opts->disable_frontends ? "checked" : ""; ?> >
</div>
<h2>Search settings</h2>
<h2><?php printtext("settings_search_settings");?></h2>
<div class="settings-textbox-container">
<div>
<span>Language</span>
<span><?php printtext("settings_language");?></span>
<select name="language">
<?php
@ -116,18 +116,18 @@
</select>
</div>
<div>
<label>Number of results per page</label>
<label><?php printtext("settings_number_of_results");?></label>
<input type="number" name="number_of_results" value="<?php echo htmlspecialchars($opts->number_of_results ?? "10") ?>" >
</div>
</div>
<div>
<label>Safe search</label>
<label><?php printtext("settings_safe_search");?></label>
<input type="checkbox" name="safe_search" <?php echo $opts->safe_search ? "checked" : ""; ?> >
</div>
<div>
<button type="submit" name="save" value="1">Save</button>
<button type="submit" name="reset" value="1">Reset</button>
<button type="submit" name="save" value="1"><?php printtext("settings_save");?></button>
<button type="submit" name="reset" value="1"><?php printtext("settings_reset");?></button>
</div>
</form>
</div>