var/www/pages/index.php : whitespaces

This commit is contained in:
codeberg.org 2020-05-04 23:51:46 +02:00
parent 03508f2470
commit b7cbd00f1d

View file

@ -12,19 +12,19 @@ if ($request_url === "/") {
send_response(200, " send_response(200, "
<meta name='viewport' content='width=device-width, initial-scale=1.0'> <meta name='viewport' content='width=device-width, initial-scale=1.0'>
<html> <html>
<head> <head>
<title>Codeberg Pages</title> <title>Codeberg Pages</title>
</head> </head>
<body> <body>
<div style='height: 100%; display: flex; align-items: center; justify-content: center;'> <div style='height: 100%; display: flex; align-items: center; justify-content: center;'>
<center> <center>
<h1>Codeberg Pages. Static Pages for your Projects.</h1> <h1>Codeberg Pages. Static Pages for your Projects.</h1>
<p>Create a repo named 'pages' in your user account or org, push static content, HTML, style, fonts, images.</p> <p>Create a repo named 'pages' in your user account or org, push static content, HTML, style, fonts, images.</p>
<p>Share your rendered content via: <pre>https://" . $_SERVER["HTTP_HOST"] . "/&lt;username&gt;/</pre></p> <p>Share your rendered content via: <pre>https://" . $_SERVER["HTTP_HOST"] . "/&lt;username&gt;/</pre></p>
<p>Welcome to <a href='https://codeberg.org'>Codeberg.org</a>!</p> <p>Welcome to <a href='https://codeberg.org'>Codeberg.org</a>!</p>
</center> </center>
</div> </div>
</body> </body>
</html> </html>
"); ");
} }
@ -51,14 +51,14 @@ $command = "sh -c \"cd '$git_root' && /usr/bin/git ls-tree 'master:$file_url' >
exec($command, $output, $retval); exec($command, $output, $retval);
if ($retval === 0) { if ($retval === 0) {
if (substr($request_url, -1) !== "/") { if (substr($request_url, -1) !== "/") {
$h = "Location: $request_url/"; $h = "Location: " . $request_url . "/";
if ($_SERVER['QUERY_STRING'] !== "") if ($_SERVER['QUERY_STRING'] !== "")
$h .= "?" . $_SERVER['QUERY_STRING']; $h .= "?" . $_SERVER['QUERY_STRING'];
header($h); header($h);
exit(); exit();
} }
if ($file_url !== "") if ($file_url !== "")
$file_url .= "/"; $file_url .= "/";
$file_url .= "index.html"; $file_url .= "index.html";
} }