Add opensearch description

This commit is contained in:
2022-12-26 21:56:40 +01:00
parent 76673842b7
commit 560cd9c72c
2 changed files with 14 additions and 1 deletions

View File

@ -121,6 +121,7 @@ function send_html(): void
echo '<meta name="author" content="Daniel Winzen">';
echo '<meta name="viewport" content="width=device-width, initial-scale=1">';
echo '<meta name="description" content="Huge link list of Tor hidden service onions. All the darknet links you need in one place.">';
echo '<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.php" title="'._('Onion link list').'"/>';
echo '<link rel="canonical" href="' . CANONICAL_URL . $_SERVER['SCRIPT_NAME'] . (empty($canonical_query) ? '' : '?' . http_build_query($canonical_query)) . '">';
echo '<link rel="alternate" href="' . CANONICAL_URL . $_SERVER['SCRIPT_NAME'] . (empty($canonical_query) ? '' : '?' . http_build_query($canonical_query)) . '" hreflang="x-default">';
alt_links();
@ -168,7 +169,7 @@ function send_html(): void
send_captcha();
echo "<input type=\"submit\" name=\"action\" value=\""._('Update')."\"></form></div>";
//search from
echo "<div class=\"col\"><form action=\"$_SERVER[SCRIPT_NAME]\" target=\"_self\" method=\"post\">";
echo "<div class=\"col\"><form action=\"$_SERVER[SCRIPT_NAME]\" target=\"_self\" method=\"post\" role=\"search\">";
echo "<input type=\"hidden\" name=\"pg\" value=\"$_REQUEST[newpg]\">";
echo "<input type=\"hidden\" name=\"lang\" value=\"$language\">";
echo "<p><label>"._('Search:')." <br><input name=\"q\" size=\"30\" placeholder=\""._('Search term')."\" value=\"";

12
www/opensearch.php Normal file
View File

@ -0,0 +1,12 @@
<?php
require_once(__DIR__.'/../common_config.php');
header('Content-Type: application/opensearchdescription+xml');
?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName><?php echo _('Onion link list'); ?></ShortName>
<Description><?php echo _('Search the onion link list'); ?></Description>
<Contact>daniel@danwin1210.de</Contact>
<Developer>Daniel Winzen</Developer>
<Image width="192" height="192" type="image/gif"><?php echo CANONICAL_URL; ?>/favicon.ico</Image>
<Url type="text/html" method="get" template="<?php echo CANONICAL_URL; ?>/onions.php?q={searchTerms}" />
</OpenSearchDescription>