Browse Source

add yggo:manifest namespace

main
ghost 2 years ago
parent
commit
1ee2ac4f0b
  1. 16
      crontab/crawler.php
  2. 2
      public/index.php

16
crontab/crawler.php

@ -74,7 +74,7 @@ foreach ($db->getCrawlQueue(CRAWL_PAGE_LIMIT, time() - CRAWL_PAGE_SECONDS_OFFSET
$metaDescription = ''; $metaDescription = '';
$metaKeywords = ''; $metaKeywords = '';
$metaRobots = ''; $metaRobots = '';
$metaYggo = ''; $metaYggoManifest = '';
foreach (@$dom->getElementsByTagName('meta') as $meta) { foreach (@$dom->getElementsByTagName('meta') as $meta) {
@ -90,8 +90,8 @@ foreach ($db->getCrawlQueue(CRAWL_PAGE_LIMIT, time() - CRAWL_PAGE_SECONDS_OFFSET
$metaRobots = @$meta->getAttribute('content'); $metaRobots = @$meta->getAttribute('content');
} }
if (@$meta->getAttribute('name') == 'yggo') { if (@$meta->getAttribute('name') == 'yggo:manifest') {
$metaYggo = Filter::url(@$meta->getAttribute('content')); $metaYggoManifest = Filter::url(@$meta->getAttribute('content'));
} }
} }
@ -103,13 +103,13 @@ foreach ($db->getCrawlQueue(CRAWL_PAGE_LIMIT, time() - CRAWL_PAGE_SECONDS_OFFSET
CRAWL_HOST_DEFAULT_META_ONLY ? null : Filter::pageData($content)); CRAWL_HOST_DEFAULT_META_ONLY ? null : Filter::pageData($content));
// Update manifest registry // Update manifest registry
if (CRAWL_MANIFEST && !empty($metaYggo) && filter_var($metaYggo, FILTER_VALIDATE_URL) && preg_match(CRAWL_URL_REGEXP, $metaYggo)) { if (CRAWL_MANIFEST && !empty($metaYggoManifest) && filter_var($metaYggoManifest, FILTER_VALIDATE_URL) && preg_match(CRAWL_URL_REGEXP, $metaYggoManifest)) {
$metaYggoCRC32url = crc32($metaYggo); $metaYggoManifestCRC32 = crc32($metaYggoManifest);
if (!$db->getManifest($metaYggoCRC32url)) { if (!$db->getManifest($metaYggoManifestCRC32)) {
$db->addManifest($metaYggoCRC32url, $db->addManifest($metaYggoManifestCRC32,
$metaYggo, $metaYggoManifest,
(string) CRAWL_MANIFEST_DEFAULT_STATUS, (string) CRAWL_MANIFEST_DEFAULT_STATUS,
time()); time());
} }

2
public/index.php

@ -22,7 +22,7 @@ $placeholder = Filter::plural($totalPages, [sprintf(_('Over %s page or enter the
<title><?php echo _('YGGo! Web Search Engine') ?></title> <title><?php echo _('YGGo! Web Search Engine') ?></title>
<meta charset="utf-8" /> <meta charset="utf-8" />
<?php if (API_MANIFEST_ENABLED) { ?> <?php if (API_MANIFEST_ENABLED) { ?>
<meta name="yggo" content="<?php echo sprintf('%s/api.php?action=manifest', WEBSITE_DOMAIN) ?>" /> <meta name="yggo:manifest" content="<?php echo sprintf('%s/api.php?action=manifest', WEBSITE_DOMAIN) ?>" />
<?php } ?> <?php } ?>
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="<?php echo _('Javascript-less Open Source Web Search Engine') ?>" /> <meta name="description" content="<?php echo _('Javascript-less Open Source Web Search Engine') ?>" />

Loading…
Cancel
Save