From 8088a8aff907d7b8e00fa3a31dbd47418846b647 Mon Sep 17 00:00:00 2001 From: blankie Date: Sat, 9 Dec 2023 16:41:25 +1100 Subject: [PATCH] Fix proxying hashtags https://anarres.family/@ashten@social.platypus-sandbox.com/111532064387673301 --- htmlhelper.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htmlhelper.cpp b/htmlhelper.cpp index f9745e7..5dd7ca5 100644 --- a/htmlhelper.cpp +++ b/htmlhelper.cpp @@ -116,7 +116,8 @@ static inline void preprocess_html(const httplib::Request& req, const std::strin } } -static std::regex mention_class_re("\\bmention\\b"); +// examples of mention and hashtag: https://anarres.family/@ashten@social.platypus-sandbox.com/111532064387673301 +static std::regex proxy_class_re("\\b(mention|hashtag)\\b"); static inline void preprocess_link(const httplib::Request& req, const std::string& domain_name, lxb_dom_element_t* element) { using namespace std::string_literals; @@ -147,9 +148,8 @@ static inline void preprocess_link(const httplib::Request& req, const std::strin instance_url_base.set(CURLUPART_SCHEME, "https"); instance_url_base.set(CURLUPART_HOST, domain_name); - // .mention is used in note and posts // Instance base is used for link fields - if (std::regex_search(cls, mention_class_re) || starts_with(href_url, instance_url_base)) { + if (std::regex_search(cls, proxy_class_re) || starts_with(href_url, instance_url_base)) { // Proxy this instance's URLs to Coyote href = proxy_mastodon_url(req, std::move(href));