added torrentgalaxy, added proxitok, fixed some HTML formatting

This commit is contained in:
hnhx 2022-05-11 20:08:16 +02:00
parent 6b45ca53fc
commit e9652789f5
10 changed files with 128 additions and 66 deletions

View File

@ -1,29 +1,28 @@
<h1 align="center">LibreX</h1>
<p float="left">
<img src="https://user-images.githubusercontent.com/49120638/164421187-2730b9d5-d5b9-4606-b6b9-145b11cfdb55.png" width=400>
<img src="https://user-images.githubusercontent.com/49120638/164421606-3a315cca-d44a-4efe-863d-5771661e66e3.png" width=400>
</p>
<p align="center">
<img src="https://user-images.githubusercontent.com/49120638/164422009-89fc8bab-6b36-4555-ada3-397a276bd2ce.png" width=400>
<img src="https://user-images.githubusercontent.com/49120638/164421187-2730b9d5-d5b9-4606-b6b9-145b11cfdb55.png" width="400">
<img src="https://user-images.githubusercontent.com/49120638/164421606-3a315cca-d44a-4efe-863d-5771661e66e3.png" width="400">
</p>
<p align="center">A privacy respecting free as in freedom meta search engine</p>
# Online instances
+ [librex.paranoid.cf](https://librex.paranoid.cf/) 🇨🇭
+ [search.davidovski.xyz](https://search.davidovski.xyz/) 🇬🇧
+ [librex.elpengu.com](https://librex.elpengu.com/) 🇫🇷
| URL | Country | TOR | I2P |
|-|-|-|-|
| [librex.beparanoid.de](https://librex.beparanoid.de/) | 🇨🇭 CH | [](http://librex.prnoid54e44a4bduq5due64jkk7wcnkxcp5kv3juncm7veptjcqudgyd.onion/) | [](http://fboseyskrqpi6yjiifvz4ryuoiswjezkqsfxfkm2vmbuhehbpr7q.b32.i2p/) |
| [search.davidovski.xyz](https://search.davidovski.xyz/) | 🇬🇧 UK | ❌ | ❌ |
| [librex.elpengu.com](https://librex.elpengu.com/) | 🇫🇷 FR | ❌ | ❌ |🇷
If you wish to get your instance added create an issue with the `new instance` label and this information:
<br>If you wish to get your instance added create an issue with the `new instance` label and this information:
+ the URL of your instance
+ the country where your instance is being hosted
Your request will be **rejected** if your instance:
+ contains JavaScript
+ contains ads
+ has been heavily modified
+ have cloudflare protection
# Features
+ Ad & JavaScript free
@ -39,20 +38,57 @@ Your request will be **rejected** if your instance:
+ Easy to setup
# Hosting
Hosting LibreX should be easy since no 3rd party PHP libs are used.<br/>
All you need is PHP with the curl and dom extension enabled.<br/><br/>
If you want to host it just for yourself a PHP development server should be enough:
Install the packages:
```
sudo apt install php php-fpm php-dom php-curl nginx
```
Clone LibreX:
```
git clone https://github.com/hnhx/librex.git
```
Make sure that the config and the opensearch file won't change when you do git pull:
```
cd librex
mv config.php.example config.php
sed -i 's/http:\/\/localhost/https:\/\/your.domain/g' opensearch.xml
cp librex_updater.service /etc/systemd/system/ # edit the service file first
systemctl enable --now librex_updater
sudo php -S 127.0.0.1:80
mv opensearch.xml.example opensearch.xml
```
<br/>
If you want to host an online instance you should consider using a production web server (e.g.: nginx).
Change opensearch.xml to point to your domain:
```
sed -i 's/http:\/\/localhost/https:\/\/your.domain/g' opensearch.xml
```
To keep LibreX up to date enable the LibreX systemd service:
```
cp librex_updater.service /etc/systemd/system/
systemctl enable --now librex_updater # edit the service file before you enable it
```
Example nginx config:
```
server {
listen 80;
server_name your.domain;
root /var/www/html/librex;
index index.php;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
```
Start the php-fpm and the nginx systemd service
```
sudo systemctl enable --now php7.4-fpm nginx # replace the version if its needed
```
Now LibreX should be running!
# API
Example API request: `.../api.php?q=gentoo&p=2&type=0` <br/><br/>
@ -61,11 +97,8 @@ Example API request: `.../api.php?q=gentoo&p=2&type=0` <br/><br/>
The API also supports both POST and GET requests.
# Donate
### Monero (XMR)
Address: `41dGQr9EwZBfYBY3fibTtJZYfssfRuzJZDSVDeneoVcgckehK3BiLxAV4FvEVJiVqdiW996zvMxhFB8G8ot9nBFqQ84VkuC`
### Bitcoin (BTC)
```bc1qs43kh6tvhch02dtsp7x7hcrwj8fwe4rzy7lp0h```
QR code:
<p align="left">
<img src="https://user-images.githubusercontent.com/49120638/160815173-dea8b0ee-1b1c-4ead-868d-01313ec28350.png">
</p>
### Monero (XMR)
```41dGQr9EwZBfYBY3fibTtJZYfssfRuzJZDSVDeneoVcgckehK3BiLxAV4FvEVJiVqdiW996zvMxhFB8G8ot9nBFqQ84VkuC```

View File

@ -18,6 +18,7 @@
"bibliogram" => "",
"nitter" => "",
"libreddit" => "",
"proxitok" => "",
"wikiless" => "",
/*
@ -38,12 +39,9 @@
// CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36",
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36",
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYSTATUS => false,
CURLOPT_VERBOSE => false
)

View File

@ -1,16 +1,20 @@
<?php require "misc/header.php"; ?>
<?php
require "misc/header.php";
// Feel free to add your donation options here, but please don't remove mine.
?>
<title>LibreX - Donate</title>
</head>
<body>
<div class="misc-container">
<h1>Donate</h1>
<h2>Support the host of this instance</h2>
<p>(Your donation thingy goes here...)</p>
<h2>Support the creator</h2>
<h3>Bitcoin (BTC):</h3>
<p>bc1qs43kh6tvhch02dtsp7x7hcrwj8fwe4rzy7lp0h</p>
<img src="static/images/btc.png" alt="btc qr code" width="150" height="150"/>
<h3>Monero (XMR):</h3>
<p>41dGQr9EwZBfYBY3fibTtJZYfssfRuzJZDSVDeneoVcgckehK3BiLxAV4FvEVJiVqdiW996zvMxhFB8G8ot9nBFqQ84VkuC</p>
<img src="static/images/xmr.png" alt="xmr qr code"/>
<img src="static/images/xmr.png" alt="xmr qr code" width="150" height="150"/>
</div>
<?php require "misc/footer.php"; ?>

View File

@ -8,6 +8,7 @@
require "engines/bittorrent/rutor.php";
require "engines/bittorrent/nyaa.php";
require "engines/bittorrent/yts.php";
require "engines/bittorrent/torrentgalaxy.php";
$query = urlencode($query);
@ -15,7 +16,8 @@
$thepiratebay_url,
$rutor_url,
$nyaa_url,
$yts_url
$yts_url,
$torrentgalaxy_url
);
$mh = curl_multi_init();
@ -52,6 +54,9 @@
case 3:
$results = array_merge($results, get_yts_results($response));
break;
case 4:
$results = array_merge($results, get_torrentgalaxy_results($response));
break;
}
}
@ -93,4 +98,4 @@
echo "</div>";
}
?>
?>

View File

@ -0,0 +1,34 @@
<?php
$torrentgalaxy_url = "https://torrentgalaxy.to/torrents.php?search=$query#results";
function get_torrentgalaxy_results($response)
{
global $config;
$xpath = get_xpath($response);
$results = array();
foreach($xpath->query("//div[@class='tgxtablerow txlight']") as $result)
{
$name = $xpath->evaluate(".//div[contains(@class, 'clickable-row')]", $result)[0]->textContent;
$magnet = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/a/@href", $result)[1]->textContent;
$magnet_without_tracker = explode("&tr=", $magnet)[0];
$magnet = $magnet_without_tracker . $config->bittorent_trackers;
$size = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span", $result)[0]->textContent;
$seeders = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span/font", $result)[1]->textContent;
$leechers = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span/font", $result)[2]->textContent;
array_push($results,
array (
"name" => $name,
"seeders" => (int) $seeders,
"leechers" => (int) $leechers,
"magnet" => $magnet,
"size" => $size,
"source" => "torrentgalaxy.to"
)
);
}
return $results;
}
?>

View File

@ -8,13 +8,10 @@
<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
<link rel="stylesheet" type="text/css" href="<?php
echo "static/css/";
if (isset($_COOKIE["theme"]) || isset($_REQUEST["theme"]))
echo (isset($_COOKIE["theme"]) ? $_COOKIE["theme"] : $_REQUEST["theme"]) . ".css";
else
echo "dark.css";
?>
"/>
?>"/>

View File

@ -35,7 +35,7 @@
function check_for_privacy_frontend($url)
{
if (strpos($url, "youtube.com"))
if (strpos($url, "youtube.com"))
$url = try_replace_with_frontend($url, "invidious", "youtube.com");
else if (strpos($url, "instagram.com"))
$url = try_replace_with_frontend($url, "bibliogram", "instagram.com");
@ -43,6 +43,8 @@
$url = try_replace_with_frontend($url, "nitter", "twitter.com");
else if (strpos($url, "reddit.com"))
$url = try_replace_with_frontend($url, "libreddit", "reddit.com");
else if (strpos($url, "tiktok.com"))
$url = try_replace_with_frontend($url, "proxitok", "tiktok.com");
else if (strpos($url, "wikipedia.org"))
$url = try_replace_with_frontend($url, "wikiless", "wikipedia.org");

View File

@ -21,6 +21,7 @@
better_setcookie("bibliogram");
better_setcookie("nitter");
better_setcookie("libreddit");
better_setcookie("proxitok");
better_setcookie("wikiless");
header("Location: ./settings.php");
@ -70,10 +71,8 @@
</select>
</div>
<div>
<label for="special">Disable special queries (e.g.: currency conversion)</label>
<input type="checkbox" name="disable_special"
<?php echo isset($_COOKIE["disable_special"]) ? "checked" : "\"\""; ?>
>
<label>Disable special queries (e.g.: currency conversion)</label>
<input type="checkbox" name="disable_special" <?php echo isset($_COOKIE["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>
@ -106,6 +105,13 @@
>
</div>
<div>
<a for="proxitok" href="https://github.com/pablouser1/ProxiTok/wiki/Public-instances" target="_blank">ProxiTok</a>
<input type="text" name="proxitok" placeholder="Replace TikTok" value=
<?php echo isset($_COOKIE["proxitok"]) ? $_COOKIE["proxitok"] : "\"$config->proxitok\""; ?>
>
</div>
<div>
<a for="wikiless" href="https://codeberg.org/orenom/wikiless" target="_blank">Wikiless</a>
<input type="text" name="wikiless" placeholder="Replace Wikipedia" value=
@ -117,24 +123,7 @@
<button type="submit" name="save" value="1">Save</button>
<button type="submit" name="reset" value="1">Reset</button>
</div>
<div>
<?php
if (!empty($_COOKIE))
{
echo "<p>If you use the Tor browser or just regularly delete cookies you can also set the settings as a query param:</p>";
$url = "?";
foreach ($_COOKIE as $key => $value)
$url .= "&$key=$value";
$url = substr_replace($url, "", 1, 1);
echo $url;
}
?>
</div>
</form>
</div>
<?php require "misc/footer.php"; ?>
<?php require "misc/footer.php"; ?>

BIN
static/images/btc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB