Fix proxying hashtags
https://anarres.family/@ashten@social.platypus-sandbox.com/111532064387673301
This commit is contained in:
parent
bda0bff294
commit
8088a8aff9
|
@ -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) {
|
static inline void preprocess_link(const httplib::Request& req, const std::string& domain_name, lxb_dom_element_t* element) {
|
||||||
using namespace std::string_literals;
|
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_SCHEME, "https");
|
||||||
instance_url_base.set(CURLUPART_HOST, domain_name);
|
instance_url_base.set(CURLUPART_HOST, domain_name);
|
||||||
|
|
||||||
// .mention is used in note and posts
|
|
||||||
// Instance base is used for link fields
|
// 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
|
// Proxy this instance's URLs to Coyote
|
||||||
href = proxy_mastodon_url(req, std::move(href));
|
href = proxy_mastodon_url(req, std::move(href));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue