From fe964b5f98a5571cbe55fa85addaec14b1ff6325 Mon Sep 17 00:00:00 2001 From: lolcat Date: Tue, 1 Dec 2026 18:55:57 -0500 Subject: [PATCH] seo bullshit --- robots.txt | 5 ++++- sitemap.php | 52 +++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/robots.txt b/robots.txt index d369893..485d758 100644 --- a/robots.txt +++ b/robots.txt @@ -19,5 +19,8 @@ Disallow: /videos Disallow: /news Disallow: /music Disallow: /proxy -Disallow: /api/v1/ac +Disallow: /resolver +Disallow: /api/ Allow: / + +Sitemap: https://4get.ca/sitemap diff --git a/sitemap.php b/sitemap.php index 80bda66..0bfb212 100644 --- a/sitemap.php +++ b/sitemap.php @@ -3,33 +3,63 @@ header("Content-Type: application/xml"); include "data/config.php"; -$domain = - htmlspecialchars( - (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" ? "https" : "http") . - '://' . $_SERVER["HTTP_HOST"] - ); +$host = strtolower(explode(":", $_SERVER["HTTP_HOST"], 2)[0]); + +// detect if 4get should serve the HTTPS endpoint +if( + preg_match( + '/\.(onion|i2p)$/', + strtolower($host), + $match + ) +){ + + $ssl = false; + $src = $match[1]; +}elseif( + is_string( + filter_var( + $host, + FILTER_VALIDATE_IP + ) + ) || + $host == "localhost" +){ + + $ssl = false; + $src = "localhost"; +}else{ + + $ssl = true; +} + +$domain = ($ssl ? "https" : "http") . "://" . $_SERVER["HTTP_HOST"]; echo '' . '' . '' . - '' . $domain . '/' . + '' . htmlspecialchars($domain) . '' . '2023-07-31T07:56:12+03:00' . '' . '' . - '' . $domain . '/about' . + '' . htmlspecialchars($domain) . '/settings' . '2023-07-31T07:56:12+03:00' . '' . '' . - '' . $domain . '/instances' . + '' . htmlspecialchars($domain) . '/instances' . + '' . date('Y-m-d\TH:i:sP') . '' . + '' . + '' . + '' . htmlspecialchars($domain) . '/api.txt' . '2023-07-31T07:56:12+03:00' . '' . '' . - '' . $domain . '/settings' . + '' . htmlspecialchars($domain) . '/about' . '2023-07-31T07:56:12+03:00' . '' . '' . - '' . $domain . '/api.txt' . - '2023-07-31T07:56:12+03:00' . + '' . htmlspecialchars($domain) . '/donate' . + '2026-00-31T07:56:12+03:00' . '' . '';