Skip to content
Snippets Groups Projects
Commit 739d1360 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

now directly generating the new proxy links

parent 7cc3df20
No related branches found
No related tags found
3 merge requests!1895Development,!1809Development,!1808Resolve "Generate new Proxy URLs"
......@@ -360,17 +360,37 @@ class Result
# Erstellt aus einem Link einen Proxy-Link für unseren Proxy-Service
public function generateProxyLink($link)
{
if (!$link) {
if (!$link || empty($link)) {
return "";
}
# Link to our new Proxy software:
$pw = md5(env('PROXY_PASSWORD') . $link);
$parts = parse_url($link);
$host = null;
$path = null;
$proxyUrl = base64_encode(str_rot13($link));
$proxyUrl = urlencode(str_replace("/", "<<SLASH>>", $proxyUrl));
$proxyUrl = "https://proxy.metager.de/";
return "https://proxy.metager.de/" . $pw . "/" . $proxyUrl;
if(!empty($parts["host"])){
$proxyUrl .= $parts["host"];
if(!empty($parts["path"])){
$proxyUrl .= "/" . trim($parts["path"], "/");
}
}
// We need to generate the correct password for the Proxy URLs
// It's an hmac sha256 hash of the url having the proxy password as secret
$password = hash_hmac("sha256", $link, env("PROXY_PASSWORD", "unsecure_password"));
$urlParameters = [
"url" => $link,
"password" => $password,
];
$params = http_build_query($urlParameters, "", "&", PHP_QUERY_RFC3986);
$proxyUrl .= "?" . $params;
return $proxyUrl;
}
/* Liest aus einer URL alle Informationen aus
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment