66 lines
1.4 KiB
PHP
66 lines
1.4 KiB
PHP
<?php
|
|
|
|
header("Content-Type: application/xml");
|
|
include "data/config.php";
|
|
|
|
$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
|
|
'<?xml version="1.0" encoding="UTF-8"?>' .
|
|
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' .
|
|
'<url>' .
|
|
'<loc>' . htmlspecialchars($domain) . '</loc>' .
|
|
'<lastmod>2023-07-31T07:56:12+03:00</lastmod>' .
|
|
'</url>' .
|
|
'<url>' .
|
|
'<loc>' . htmlspecialchars($domain) . '/settings</loc>' .
|
|
'<lastmod>2023-07-31T07:56:12+03:00</lastmod>' .
|
|
'</url>' .
|
|
'<url>' .
|
|
'<loc>' . htmlspecialchars($domain) . '/instances</loc>' .
|
|
'<lastmod>' . date('Y-m-d\TH:i:sP') . '</lastmod>' .
|
|
'</url>' .
|
|
'<url>' .
|
|
'<loc>' . htmlspecialchars($domain) . '/api.txt</loc>' .
|
|
'<lastmod>2023-07-31T07:56:12+03:00</lastmod>' .
|
|
'</url>' .
|
|
'<url>' .
|
|
'<loc>' . htmlspecialchars($domain) . '/about</loc>' .
|
|
'<lastmod>2023-07-31T07:56:12+03:00</lastmod>' .
|
|
'</url>' .
|
|
'<url>' .
|
|
'<loc>' . htmlspecialchars($domain) . '/donate</loc>' .
|
|
'<lastmod>2026-00-31T07:56:12+03:00</lastmod>' .
|
|
'</url>' .
|
|
'</urlset>';
|