Renaming plugin.

This commit is contained in:
2026-03-20 12:00:07 -04:00
parent da6357fcfb
commit 215a438e56
8 changed files with 69 additions and 69 deletions

View File

@@ -7,7 +7,7 @@ require "net/http"
require "uri"
require "timeout"
module UrlToArticle
module BookmarkUrl
class ArticleExtractor
NOISE_SELECTORS = %w[
script style noscript iframe nav footer header
@@ -80,7 +80,7 @@ module UrlToArticle
# ------------------------------------------------------------------ #
def fetch_html
Timeout.timeout(SiteSetting.url_to_article_fetch_timeout) do
Timeout.timeout(SiteSetting.bookmark_url_fetch_timeout) do
response = do_get(@uri)
if response.is_a?(Net::HTTPRedirection) && response["location"]
@@ -100,10 +100,10 @@ module UrlToArticle
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
http.open_timeout = 5
http.read_timeout = SiteSetting.url_to_article_fetch_timeout
http.read_timeout = SiteSetting.bookmark_url_fetch_timeout
req = Net::HTTP::Get.new(uri.request_uri)
req["User-Agent"] = "Mozilla/5.0 (compatible; Discourse/url-to-article)"
req["User-Agent"] = "Mozilla/5.0 (compatible; Discourse/bookmark-url)"
req["Accept"] = "text/html,application/xhtml+xml"
req["Accept-Language"] = "en-US,en;q=0.9"
@@ -335,7 +335,7 @@ module UrlToArticle
# ------------------------------------------------------------------ #
def truncate(text)
max = SiteSetting.url_to_article_max_content_length
max = SiteSetting.bookmark_url_max_content_length
return text if text.length <= max
text[0...max] + "\n\n*[Content truncated — visit the original article for the full text.]*"
end