Simplify home page

merge-requests/5/head
Terence Eden 2024-02-18 14:29:06 +00:00
rodzic a2e60df3a4
commit 80d4c9093e
1 zmienionych plików z 31 dodań i 41 usunięć

Wyświetl plik

@ -20,7 +20,6 @@
// This is where you set up your account's name and bio. You also need to provide a public/private keypair. The posting page is protected with a password that also needs to be set here. // This is where you set up your account's name and bio. You also need to provide a public/private keypair. The posting page is protected with a password that also needs to be set here.
// Set up the Actor's information // Set up the Actor's information
$siteTitle = "ActivityPub-Single-PHP-File";
$username = rawurlencode("example"); // Encoded as it is often used as part of a URl $username = rawurlencode("example"); // Encoded as it is often used as part of a URl
$realName = "E. Xample. Jr."; $realName = "E. Xample. Jr.";
$summary = "Some text about the user."; $summary = "Some text about the user.";
@ -78,18 +77,18 @@
!empty( $_GET["path"] ) ? $path = $_GET["path"] : home(); !empty( $_GET["path"] ) ? $path = $_GET["path"] : home();
switch ($path) { switch ($path) {
case ".well-known/webfinger": case ".well-known/webfinger":
webfinger(); webfinger(); // Mandatory. Static.
case rawurldecode( $username ): case rawurldecode( $username ):
username(); username(); // Mandatory. Static
case "following": case "following":
following(); following(); // Mandatory. Static
case "followers": case "followers":
followers(); followers(); // Mandatory. Could be dynamic
case "inbox": case "inbox":
inbox(); inbox(); // Mandatory. Only accepts follow requests.
case "write": case "write":
write(); write(); // User interface for writing posts
case "send": case "send": // API for posting content to the Fediverse
send(); send();
default: default:
die(); die();
@ -335,39 +334,30 @@
// User Interface for Homepage: // User Interface for Homepage:
// This creates a basic HTML page. This content appears when someone visits the root of your site. // This creates a basic HTML page. This content appears when someone visits the root of your site.
function home() { function home() {
global $username, $server, $realName, $siteTitle, $summary; global $username, $server, $realName, $summary;
echo <<< HTML echo <<< HTML
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-GB"> <html lang="en-GB">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>{$siteTitle}</title> <title>{$realName}</title>
<style> <style>
body { background-color: #F5F5F5; } body { text-align: center; font-family:sans-serif; font-size:1.1em; }
*{font-family:sans-serif;font-size:1.1em;} </style>
h1, h2, h3, p { text-align: center; } </head>
h2 { font-size: 0.9em; } <body>
h3 { font-size: 0.70em; } <span class="h-card">
p {font-style: italic; } <img src="icon.png" alt="icon" class="u-photo " width="140px" />
img { display:block; margin-left: auto; margin-right: auto; width: 120px; align: center; } <h1><span class="p-name">{$realName}</span></h1>
footer { text-align: center; font-size:smaller; font-weight:italic; } <h2><a class="p-nickname u-url" href="https://{$server}/{$username}">@{$username}@{$server}</a></h2>
</style> <p class="note">{$summary}</p>
</head> </span>
<body> <p><a href="https://gitlab.com/edent/activitypub-single-php-file/">This software is licenced under AGPL 3.0</a>.</p>
<h1>{$siteTitle}</h1> <p>This site is a basic <a href="https://www.w3.org/TR/activitypub/">ActivityPub</a> server designed to be <a href="https://shkspr.mobi/blog/2024/02/activitypub-server-in-a-single-file/">a lightweight educational tool</a>.</p>
<span class="h-card"> </body>
<img src="icon.png" alt="icon" class="u-photo " width="140px" /> </html>
<h2><span class="p-name">{$realName}</span></h2> HTML;
<h3><a class="p-nickname u-url" href="https://{$server}">@{$username}@{$server}</a></h3> die();
<p class="note">{$summary}</p>
</span>
<footer>
This site is a basic <a href="https://www.w3.org/TR/activitypub/">ActivityPub</a> server <a href="https://gitlab.com/edent/activitypub-single-php-file">designed to be a lightweight educational tool</a> by <a href="https://shkspr.mobi/blog/">Terence Eden</a>.
</footer>
</body>
</html>
HTML;
die();
} }
// User Interface for Writing: // User Interface for Writing: