mirror of
https://github.com/Ahwxorg/Binternet.git
synced 2026-03-11 08:54:37 +00:00
retrying the image proxy
This commit is contained in:
parent
b20f3e9c0f
commit
a0d145c5c0
2 changed files with 13 additions and 19 deletions
|
|
@ -1,21 +1,15 @@
|
|||
<?php
|
||||
|
||||
$config = require "config.php";
|
||||
require "misc/tools.php";
|
||||
require "misc/tools.php";
|
||||
|
||||
$url = $_REQUEST["url"];
|
||||
$requested_root_domain = get_root_domain($url);
|
||||
$url = $_REQUEST["url"];
|
||||
$allowed_domains = array("pinimg.com", "i.pinimg.com", "pinterest.com");
|
||||
|
||||
$allowed_domains = array("pinimg.com", "i.pinimg.com", "pinterest.com");
|
||||
|
||||
if (in_array($requested_root_domain, $allowed_domains))
|
||||
{
|
||||
$image = $url;
|
||||
$image_src = request($image);
|
||||
|
||||
header("Content-Type: image/jpeg");
|
||||
echo $image_src;
|
||||
}
|
||||
if (in_array(get_root_domain($url), $allowed_domains))
|
||||
{
|
||||
header("Content-Type: image/jpeg");
|
||||
echo request($url);
|
||||
}
|
||||
?>
|
||||
|
||||
// basically stolen from LibreX - https://github.com/hnhx/LibreX
|
||||
// somewhat stolen from github.com/hnhx/librex
|
||||
|
|
|
|||
|
|
@ -194,10 +194,10 @@
|
|||
|
||||
function request($url)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$ch = curl_init($url);
|
||||
curl_setopt_array($ch, $config->curl_settings);
|
||||
// curl_setopt_array($ch, $config->curl_settings);
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$response = curl_exec($ch);
|
||||
|
||||
return $response;
|
||||
|
|
@ -241,4 +241,4 @@
|
|||
}
|
||||
?>
|
||||
|
||||
//basically stolen from LibreX - https://github.com/hnhx/LibreX
|
||||
//basically completely stolen from LibreX - https://github.com/hnhx/LibreX
|
||||
|
|
|
|||
Loading…
Reference in a new issue