From 81dc93802c32aa6f593a12b3f2efbe38dc9e31f7 Mon Sep 17 00:00:00 2001 From: lolcat Date: Mon, 22 Apr 2024 11:12:46 -0400 Subject: opensearch onion fix --- opensearch.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'opensearch.php') diff --git a/opensearch.php b/opensearch.php index fb51430..4bdf97c 100644 --- a/opensearch.php +++ b/opensearch.php @@ -5,14 +5,27 @@ include "data/config.php"; $domain = htmlspecialchars( - ((isset($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] == "on" || $_SERVER["HTTPS"] === 1)) ? "https" : "http") . + (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" ? "https" : "http") . '://' . $_SERVER["HTTP_HOST"] ); +if( + preg_match( + '/\.onion$/', + $domain + ) +){ + + $onion = true; +}else{ + + $onion = false; +} + echo '' . '' . - '' . htmlspecialchars(config::SERVER_NAME) . '' . + '' . htmlspecialchars(config::SERVER_NAME) . ($onion ? " (onion)" : "") . '' . 'UTF-8' . '' . $domain . '/favicon.ico' . ''; -- cgit v1.2.3