Renaming plugin.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module UrlToArticle
|
||||
module BookmarkUrl
|
||||
class ArticlesController < ::ApplicationController
|
||||
requires_login
|
||||
before_action :ensure_enabled!
|
||||
@@ -18,14 +18,14 @@ module UrlToArticle
|
||||
url: result.url,
|
||||
}
|
||||
rescue => e
|
||||
Rails.logger.warn("[url-to-article] Extraction failed for #{@url}: #{e.message}")
|
||||
Rails.logger.warn("[bookmark-url] Extraction failed for #{@url}: #{e.message}")
|
||||
render json: { error: "Could not extract article: #{e.message}" }, status: :unprocessable_entity
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ensure_enabled!
|
||||
raise Discourse::NotFound unless SiteSetting.url_to_article_enabled
|
||||
raise Discourse::NotFound unless SiteSetting.bookmark_url_enabled
|
||||
end
|
||||
|
||||
def validate_url!
|
||||
@@ -42,7 +42,7 @@ module UrlToArticle
|
||||
end
|
||||
|
||||
# SSRF protection — block private/loopback addresses
|
||||
blocked_domains = SiteSetting.url_to_article_blocked_domains
|
||||
blocked_domains = SiteSetting.bookmark_url_blocked_domains
|
||||
.split(",").map(&:strip).reject(&:empty?)
|
||||
|
||||
if blocked_domains.any? { |d| uri.host&.include?(d) }
|
||||
@@ -50,7 +50,7 @@ module UrlToArticle
|
||||
end
|
||||
|
||||
# Optionally enforce an allowlist
|
||||
allowed_domains = SiteSetting.url_to_article_allowed_domains
|
||||
allowed_domains = SiteSetting.bookmark_url_allowed_domains
|
||||
.split(",").map(&:strip).reject(&:empty?)
|
||||
|
||||
if allowed_domains.any? && !allowed_domains.any? { |d| uri.host&.end_with?(d) }
|
||||
|
||||
Reference in New Issue
Block a user