Put details in an (optional) .env file
rodzic
cb5d5b7603
commit
012a925c64
|
@ -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-----"
|
|
@ -0,0 +1 @@
|
||||||
|
.env
|
17
index.php
17
index.php
|
@ -23,19 +23,20 @@
|
||||||
// You also need to provide a public/private keypair.
|
// You also need to provide a public/private keypair.
|
||||||
// The posting page is protected with a password that also needs to be set here.
|
// 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:
|
// Edit these:
|
||||||
$username = rawurlencode("example"); // Type the @ username that you want. Do not include an "@".
|
$username = rawurlencode( $env["USERNAME"] ); // Type the @ username that you want. Do not include an "@".
|
||||||
$realName = "E. Xample. Jr."; // This is the user's "real" name.
|
$realName = $env["REALNAME"]; // This is the user's "real" name.
|
||||||
$summary = "Some text about the user."; // This is the bio of your user.
|
$summary = $env["SUMMARY"]; // This is the bio of your user.
|
||||||
|
|
||||||
// Generate locally or from https://cryptotools.net/rsagen
|
// Generate locally or from https://cryptotools.net/rsagen
|
||||||
// Newlines must be replaced with "\n"
|
// Newlines must be replaced with "\n"
|
||||||
$key_private = "-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----";
|
$key_private = str_replace('\n', "\n", $env["KEY_PRIVATE"] );
|
||||||
$key_public = "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----";
|
$key_public = str_replace('\n', "\n", $env["KEY_PUBLIC"] );
|
||||||
|
|
||||||
// Password for sending messages
|
// Password for sending messages
|
||||||
$password = "P4ssW0rd";
|
$password = $env["PASSWORD"];
|
||||||
|
|
||||||
/** No need to edit anything below here. But please go exploring! **/
|
/** No need to edit anything below here. But please go exploring! **/
|
||||||
|
|
||||||
|
@ -681,7 +682,7 @@ HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has the user has been specifically CC'd?
|
// 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"] );
|
$reply = in_array( "https://{$server}/{$username}", $object["cc"] );
|
||||||
} else {
|
} else {
|
||||||
$reply = false;
|
$reply = false;
|
||||||
|
|
Ładowanie…
Reference in New Issue