summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/index.php b/index.php
index 069e1bc..20a663c 100644
--- a/index.php
+++ b/index.php
@@ -15,6 +15,8 @@ $url['query'] ??= '';
$client = new Client($geminiHost);
$response = $client->request("$url[path]$url[query]");
+$title = '';
+
if ($response->getStatusCode()->value == 20) {
ob_start();
$mime = explode(';', $response->getMeta())[0];
@@ -45,6 +47,10 @@ if ($response->getStatusCode()->value == 20) {
echo "</pre>";
}
else if ($line['type'] === 'heading') {
+ if (empty($title)) {
+ $title = $line['text'];
+ }
+
echo "<h$line[size]>$line[text]</h$line[size]>";
}
else if ($line['type'] === 'listitem') {
@@ -98,6 +104,7 @@ if ($response->getStatusCode()->value == 20) {
echo "Unhandled MIME type: $mime";
}
} else {
+ $title = $response->getHeader();
echo $response->getHeader();
}
@@ -109,6 +116,9 @@ $content = ob_get_clean();
<!doctype html>
<html>
<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title><?php echo $title; ?></title>
</head>
<body>
<?php echo $content; ?>