DEV: Move discourse-affiliate to core (#33749)

https://meta.discourse.org/t/373574

Internal `/t/-/156778`
This commit is contained in:
Jarek Radosz
2025-07-22 15:07:59 +02:00
parent b8ae1d2076
commit 732b0ad0b7
61 changed files with 977 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
# frozen_string_literal: true
# name: discourse-affiliate
# about: Allows the creation of Amazon affiliate links on your forum.
# meta_topic_id: 101937
# version: 0.2
# authors: Régis Hanol (zogstrip), Sam Saffron
# url: https://github.com/discourse/discourse/tree/main/plugins/discourse-affiliate
enabled_site_setting :affiliate_enabled
after_initialize do
require File.expand_path(File.dirname(__FILE__) + "/lib/affiliate_processor")
on(:post_process_cooked) do |doc, post|
doc.css("a[href]").each { |a| a["href"] = AffiliateProcessor.apply(a["href"]) }
true
end
end