Put details in an (optional) .env file

main
Terence Eden 2024-06-26 09:27:32 +01:00
rodzic cb5d5b7603
commit 012a925c64
3 zmienionych plików z 22 dodań i 8 usunięć

12
.env.example 100644
Wyświetl plik

@ -0,0 +1,12 @@
# Type the @ username that you want. Do not include an '@'.
USERNAME="example"
# This is the user's 'real' name.
REALNAME="A single file ActivityPub Server"
# This is the bio of your user. HTML can be used
SUMMARY ="<a href='https://gitlab.com/edent/activitypub-single-php-file/'>Get the source code</a>!"
# Password for sending messages
PASSWORD=""
# Generate locally or from https://cryptotools.net/rsagen
# Newlines must be replaced with '\n'
KEY_PRIVATE="-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----"
KEY_PUBLIC="-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----"

1
.gitignore vendored 100644
Wyświetl plik

@ -0,0 +1 @@
.env

Wyświetl plik

@ -23,19 +23,20 @@
// 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 here, or in the .env file
$env = parse_ini_file('.env');
// Edit these:
$username = rawurlencode("example"); // Type the @ username that you want. Do not include an "@".
$realName = "E. Xample. Jr."; // This is the user's "real" name.
$summary = "Some text about the user."; // This is the bio of your user.
$username = rawurlencode( $env["USERNAME"] ); // Type the @ username that you want. Do not include an "@".
$realName = $env["REALNAME"]; // This is the user's "real" name.
$summary = $env["SUMMARY"]; // This is the bio of your user.
// Generate locally or from https://cryptotools.net/rsagen
// Newlines must be replaced with "\n"
$key_private = "-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----";
$key_public = "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----";
$key_private = str_replace('\n', "\n", $env["KEY_PRIVATE"] );
$key_public = str_replace('\n', "\n", $env["KEY_PUBLIC"] );
// Password for sending messages
$password = "P4ssW0rd";
$password = $env["PASSWORD"];
/** No need to edit anything below here. But please go exploring! **/
@ -681,7 +682,7 @@ HTML;
}
// Has the user has been specifically CC'd?
if ( isset( $object["cc"] ) ) {
if ( isset( $object["cc"] ) && is_array( $object["cc"] ) ) {
$reply = in_array( "https://{$server}/{$username}", $object["cc"] );
} else {
$reply = false;