Webmentions in topnav and config.ini

This commit is contained in:
sørenpeter 2024-12-12 17:25:06 +01:00
parent 61e3311bb6
commit 97a97122bb
4 changed files with 10 additions and 4 deletions

View file

@ -506,6 +506,9 @@ function getTwtsFromTwtxtString($url) {
$twtContent = str_replace("(#$hash)", '', $twtContent); $twtContent = str_replace("(#$hash)", '', $twtContent);
} }
// TODO: Make ?tag= filtering feature
$twtContent = replaceTagsFromTwt($twtContent);
// Interpret the content as markdown // Interpret the content as markdown
$Parsedown = new Parsedown(); $Parsedown = new Parsedown();
$twtContent = $Parsedown->text($twtContent); $twtContent = $Parsedown->text($twtContent);
@ -515,8 +518,6 @@ function getTwtsFromTwtxtString($url) {
//$twtContent = replaceImagesFromTwt($twtContent); //$twtContent = replaceImagesFromTwt($twtContent);
//$twtContent = replaceLinksFromTwt($twtContent); //$twtContent = replaceLinksFromTwt($twtContent);
// TODO: Make ?tag= filtering feature
$twtContent = replaceTagsFromTwt($twtContent);
// TODO: Get mentions // TODO: Get mentions
$mentions = getMentionsFromTwt($twtContent); $mentions = getMentionsFromTwt($twtContent);

View file

@ -47,6 +47,7 @@ $profile = getTwtsFromTwtxtString($config['public_txt_url']);
if($_SESSION['password']=="$password") {*/ // Hacky login ?> if($_SESSION['password']=="$password") {*/ // Hacky login ?>
<li><a href="<?= $baseURL ?>/refresh?url=<?= $url ?>"><i class="fa fa-refresh"></i><span>Refresh</span></a></li> <li><a href="<?= $baseURL ?>/refresh?url=<?= $url ?>"><i class="fa fa-refresh"></i><span>Refresh</span></a></li>
<li><a href="<?= $baseURL ?>"><i class="fa fa-comments-o"></i><span>Timeline</span></a></li> <li><a href="<?= $baseURL ?>"><i class="fa fa-comments-o"></i><span>Timeline</span></a></li>
<li><a href="<?= $baseURL ?>/profile?url=<?= $config['public_webmentions'] ?>"><i class="fa fa-at"></i><span>Mentions</span></a></li>
<li><a href="<?= $baseURL ?>/profile"><i class="fa fa-user-circle"></i><span>Profile</span></a></li> <li><a href="<?= $baseURL ?>/profile"><i class="fa fa-user-circle"></i><span>Profile</span></a></li>
<li><a href="<?= $baseURL ?>/gallery?url=<?= $config['public_txt_url'] ?>"><i class="fa fa-picture-o"></i><span>Gallery</span></a></li> <li><a href="<?= $baseURL ?>/gallery?url=<?= $config['public_txt_url'] ?>"><i class="fa fa-picture-o"></i><span>Gallery</span></a></li>
<li><a href="<?= $baseURL ?>/following"><i class="fa fa-users"></i><span>Following <?php // echo count($twtFollowingList); ?></span></a></li> <li><a href="<?= $baseURL ?>/following"><i class="fa fa-users"></i><span>Following <?php // echo count($twtFollowingList); ?></span></a></li>

View file

@ -37,6 +37,10 @@ twts_per_page = 50
; E-mail for comments ; E-mail for comments
email = "" email = ""
; Webmentions log file
webmentions_txt_path = "./mentions.txt"
public_webmentions = "https://example.com/timeline/mentions.txt"
[security] [security]
; Generate it with the TOTP module ; Generate it with the TOTP module
totp_digits = 10 totp_digits = 10

View file

@ -4,8 +4,8 @@
# http://creativecommons.org/publicdomain/zero/1.0/ # http://creativecommons.org/publicdomain/zero/1.0/
// Set path to your mentions twtxt file: // Set path to your mentions twtxt file:
$logfile = './mentions.txt'; /* Make sure file is writeable */ //$logfile = './mentions.txt'; /* Make sure file is writeable */
$logfile = $config['webmentions_txt_path'];
if (!isset($_POST['source']) || !isset($_POST['target'])) { if (!isset($_POST['source']) || !isset($_POST['target'])) {