From b9470f9a6d99592200682ed42b4ff545761faee4 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 19 Dec 2022 21:40:32 +0300 Subject: use DiskCache::instance method, switch to Config::get_self_url() instead of deprecated get_self_url_prefix() --- init.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/init.php b/init.php index 484a22d..32adc9e 100644 --- a/init.php +++ b/init.php @@ -22,7 +22,7 @@ class Af_Proxy_Http extends Plugin { function init($host) { $this->host = $host; - $this->cache = new DiskCache("images"); + $this->cache = DiskCache::instance("images"); $host->add_hook($host::HOOK_RENDER_ARTICLE, $this, 150); $host->add_hook($host::HOOK_RENDER_ARTICLE_CDM, $this, 150); @@ -56,7 +56,7 @@ class Af_Proxy_Http extends Plugin { // - called without user context // - session-spefific token is invalid if ( - strpos($url, get_self_url_prefix()) === 0 || + strpos($url, Config::get_self_url()) === 0 || empty($_SESSION["uid"]) || $_REQUEST['af_proxy_http_token'] != $_SESSION['af_proxy_http_token']) { header("Location: $url"); @@ -109,7 +109,7 @@ class Af_Proxy_Http extends Plugin { private function rewrite_url_if_needed(string $url, bool $all_remote = false) : string { /* don't rewrite urls pointing to ourselves */ - if (strpos($url, get_self_url_prefix()) === 0) + if (strpos($url, Config::get_self_url()) === 0) return $url; /* we don't need to handle URLs where local cache already exists, tt-rss rewrites those automatically */ @@ -119,7 +119,7 @@ class Af_Proxy_Http extends Plugin { if ($all_remote) { $host = parse_url($url, PHP_URL_HOST); - $self_host = parse_url(get_self_url_prefix(), PHP_URL_HOST); + $self_host = parse_url(Config::get_self_url(), PHP_URL_HOST); $is_remote = $host != $self_host; } else { -- cgit v1.2.3