From 97a97122bb3ed8ea760342be8cc3760ab5c35449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?s=C3=B8renpeter?= Date: Thu, 12 Dec 2024 17:25:06 +0100 Subject: [PATCH] Webmentions in topnav and config.ini --- libs/twtxt.php | 5 +++-- partials/header.php | 1 + private/config_template.ini | 4 ++++ views/webmention_endpoint.php | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libs/twtxt.php b/libs/twtxt.php index bebbff2..7fd6b70 100644 --- a/libs/twtxt.php +++ b/libs/twtxt.php @@ -506,6 +506,9 @@ function getTwtsFromTwtxtString($url) { $twtContent = str_replace("(#$hash)", '', $twtContent); } + // TODO: Make ?tag= filtering feature + $twtContent = replaceTagsFromTwt($twtContent); + // Interpret the content as markdown $Parsedown = new Parsedown(); $twtContent = $Parsedown->text($twtContent); @@ -515,8 +518,6 @@ function getTwtsFromTwtxtString($url) { //$twtContent = replaceImagesFromTwt($twtContent); //$twtContent = replaceLinksFromTwt($twtContent); - // TODO: Make ?tag= filtering feature - $twtContent = replaceTagsFromTwt($twtContent); // TODO: Get mentions $mentions = getMentionsFromTwt($twtContent); diff --git a/partials/header.php b/partials/header.php index b00d86a..2872c62 100644 --- a/partials/header.php +++ b/partials/header.php @@ -47,6 +47,7 @@ $profile = getTwtsFromTwtxtString($config['public_txt_url']); if($_SESSION['password']=="$password") {*/ // Hacky login ?>
  • Refresh
  • Timeline
  • +
  • Mentions
  • Profile
  • Gallery
  • Following
  • diff --git a/private/config_template.ini b/private/config_template.ini index 69d2c3d..a49498c 100644 --- a/private/config_template.ini +++ b/private/config_template.ini @@ -37,6 +37,10 @@ twts_per_page = 50 ; E-mail for comments email = "" +; Webmentions log file +webmentions_txt_path = "./mentions.txt" +public_webmentions = "https://example.com/timeline/mentions.txt" + [security] ; Generate it with the TOTP module totp_digits = 10 diff --git a/views/webmention_endpoint.php b/views/webmention_endpoint.php index 8626846..addbc60 100644 --- a/views/webmention_endpoint.php +++ b/views/webmention_endpoint.php @@ -4,8 +4,8 @@ # http://creativecommons.org/publicdomain/zero/1.0/ // 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'])) {