Merge branch 'feature/homepage' into 'main'
Feature: Hompage with basic user data See merge request edent/activitypub-single-php-file!1merge-requests/5/head
commit
a2e60df3a4
41
index.php
41
index.php
|
@ -20,6 +20,7 @@
|
||||||
// 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.";
|
||||||
|
@ -74,7 +75,7 @@
|
||||||
// Routing:
|
// Routing:
|
||||||
// The .htaccess changes /whatever to /?path=whatever
|
// The .htaccess changes /whatever to /?path=whatever
|
||||||
// This runs the function of the path requested.
|
// This runs the function of the path requested.
|
||||||
!empty( $_GET["path"] ) ? $path = $_GET["path"] : die();
|
!empty( $_GET["path"] ) ? $path = $_GET["path"] : home();
|
||||||
switch ($path) {
|
switch ($path) {
|
||||||
case ".well-known/webfinger":
|
case ".well-known/webfinger":
|
||||||
webfinger();
|
webfinger();
|
||||||
|
@ -331,6 +332,44 @@
|
||||||
return $headers;
|
return $headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// User Interface for Homepage:
|
||||||
|
// This creates a basic HTML page. This content appears when someone visits the root of your site.
|
||||||
|
function home() {
|
||||||
|
global $username, $server, $realName, $siteTitle, $summary;
|
||||||
|
echo <<< HTML
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en-GB">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>{$siteTitle}</title>
|
||||||
|
<style>
|
||||||
|
body { background-color: #F5F5F5; }
|
||||||
|
*{font-family:sans-serif;font-size:1.1em;}
|
||||||
|
h1, h2, h3, p { text-align: center; }
|
||||||
|
h2 { font-size: 0.9em; }
|
||||||
|
h3 { font-size: 0.70em; }
|
||||||
|
p {font-style: italic; }
|
||||||
|
img { display:block; margin-left: auto; margin-right: auto; width: 120px; align: center; }
|
||||||
|
footer { text-align: center; font-size:smaller; font-weight:italic; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>{$siteTitle}</h1>
|
||||||
|
<span class="h-card">
|
||||||
|
<img src="icon.png" alt="icon" class="u-photo " width="140px" />
|
||||||
|
<h2><span class="p-name">{$realName}</span></h2>
|
||||||
|
<h3><a class="p-nickname u-url" href="https://{$server}">@{$username}@{$server}</a></h3>
|
||||||
|
<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:
|
||||||
// This creates a basic HTML form. Type in your message and your password. It then POSTs the data to the `/send` endpoint.
|
// This creates a basic HTML form. Type in your message and your password. It then POSTs the data to the `/send` endpoint.
|
||||||
function write() {
|
function write() {
|
||||||
|
|
Ładowanie…
Reference in New Issue