From 2d26c65c712abe87aa8512d33c0e2e9d016bbac0 Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 26 Nov 2023 18:34:31 +0200 Subject: [PATCH] draft explore page #2 --- src/webui/explore.php | 319 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 319 insertions(+) create mode 100644 src/webui/explore.php diff --git a/src/webui/explore.php b/src/webui/explore.php new file mode 100644 index 0000000..e0be239 --- /dev/null +++ b/src/webui/explore.php @@ -0,0 +1,319 @@ + $config->manticore->server->host, + 'port' => $config->manticore->server->port, + ] +); + +// Init index +$index = $client->index( + $config->manticore->index->document->name +); + +// Get totals +$total = $index->search('') + ->option('cutoff', 0) + ->limit(0) + ->get() + ->getTotal(); + +$placeholder = sprintf( + _('Search in %s documents %s'), + number_format( + $total + ), + $config->webui->search->index->request->url->enabled ? _('or enter new address to crawl...') : false +); + +// Get document data +$document = $index->getDocumentById( + isset($_GET['i']) ? $_GET['i'] : 0 +); + +// Get icon +$hostname = parse_url( + $document->url, + PHP_URL_HOST +); + +$identicon = new \Jdenticon\Identicon(); + +$identicon->setValue( + $hostname +); + +$identicon->setSize(36); + +$identicon->setStyle( + [ + 'backgroundColor' => 'rgba(255, 255, 255, 0)', + 'padding' => 0 + ] +); + +$icon = $identicon->getImageDataUri('webp'); + +// Get snaps info +$snaps = []; + +?> + + + + + <?php echo _('Yo! explore') ?> + + + + +
+
+

+ + +
+
+
+ +
+ title) && empty($document->description) && empty($document->keywords)) { ?> + + + title)) { ?> +

title) ?>

+ + description)) { ?> + description) ?> + + keywords)) { ?> + keywords) ?> + + + + url)) ?> + +
+
+

+ identicon +

+ code)) { ?> +

+ code == 200) { ?> +

code ?>

+ +

+ code ?> +

+ + + mime)) { ?> +

+

mime ?>

+ + size)) { ?> +

+

size ?>

+ + time)) { ?> +

+

time) ?> / time ?>

+ + +

+ $snap) { ?> +

+ + time) ?> / time ?> + +

+ + +
+ +
+ +
+ +
+ + \ No newline at end of file