diff --git a/README.md b/README.md
index 7e1d412..eb38c23 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# discourse-url-to-article
+# discourse-bookmark-url
A Discourse plugin that detects when a URL is pasted into the **topic title** field and offers to scrape the page, extracting the article content (à la browser Reader Mode) and populating the **composer body** with a clean Markdown rendering.
@@ -25,7 +25,7 @@ hooks:
- exec:
cd: $home/plugins
cmd:
- - git clone https://code.draft13.com/robert/discourse-url-to-article.git
+ - git clone https://code.draft13.com/robert/discourse-bookmark-url.git
```
Then rebuild: `./launcher rebuild app`
@@ -36,12 +36,12 @@ Then rebuild: `./launcher rebuild app`
| Setting | Default | Description |
|---|---|---|
-| `url_to_article_enabled` | `true` | Enable/disable the plugin |
-| `url_to_article_auto_populate` | `false` | Populate body automatically without button click |
-| `url_to_article_max_content_length` | `50000` | Max chars extracted from a page |
-| `url_to_article_fetch_timeout` | `10` | Seconds before HTTP fetch times out |
-| `url_to_article_allowed_domains` | *(blank = all)* | Comma-separated domain allowlist |
-| `url_to_article_blocked_domains` | `localhost,127.0.0.1,…` | SSRF blocklist |
+| `bookmark_url_enabled` | `true` | Enable/disable the plugin |
+| `bookmark_url_auto_populate` | `false` | Populate body automatically without button click |
+| `bookmark_url_max_content_length` | `50000` | Max chars extracted from a page |
+| `bookmark_url_fetch_timeout` | `10` | Seconds before HTTP fetch times out |
+| `bookmark_url_allowed_domains` | *(blank = all)* | Comma-separated domain allowlist |
+| `bookmark_url_blocked_domains` | `localhost,127.0.0.1,…` | SSRF blocklist |
---
@@ -49,15 +49,15 @@ Then rebuild: `./launcher rebuild app`
### Frontend (Ember.js)
-`initializers/url-to-article.js` hooks into the `composer-editor` component and observes the `composer.model.title` property via Ember's observer system. When the title matches a bare URL pattern:
+`initializers/bookmark-url.js` hooks into the `composer-editor` component and observes the `composer.model.title` property via Ember's observer system. When the title matches a bare URL pattern:
1. A dismissible bar appears above the editor offering to import the article.
-2. On click (or automatically if `auto_populate` is on), it POSTs to `/url-to-article/extract`.
+2. On click (or automatically if `auto_populate` is on), it POSTs to `/bookmark-url/extract`.
3. The response populates `composer.model.reply` (body) and optionally updates the title.
### Backend (Ruby)
-`ArticleExtractor` in `lib/url_to_article/article_extractor.rb`:
+`ArticleExtractor` in `lib/bookmark_url/article_extractor.rb`:
1. **Fetches** the HTML via `Net::HTTP` with a browser-like User-Agent (follows one redirect).
2. **Extracts metadata** from Open Graph / Twitter Card / standard `` tags.
@@ -67,7 +67,7 @@ Then rebuild: `./launcher rebuild app`
### Security
-- Only authenticated users can call `/url-to-article/extract`.
+- Only authenticated users can call `/bookmark-url/extract`.
- Only `http`/`https` schemes are allowed.
- Configurable domain blocklist (loopback/private addresses blocked by default).
- Optional allowlist to restrict to specific domains.
@@ -97,7 +97,7 @@ Full article text in Markdown...
### Custom extraction logic
-Subclass or monkey-patch `UrlToArticle::ArticleExtractor` in a separate plugin to add site-specific selectors or post-processing.
+Subclass or monkey-patch `BookmarkUrl::ArticleExtractor` in a separate plugin to add site-specific selectors or post-processing.
### Paywall / JS-rendered sites
diff --git a/app/controllers/bookmark_url/articles_controller.rb b/app/controllers/bookmark_url/articles_controller.rb
index 992accc..584b59e 100644
--- a/app/controllers/bookmark_url/articles_controller.rb
+++ b/app/controllers/bookmark_url/articles_controller.rb
@@ -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) }
diff --git a/assets/javascripts/discourse/initializers/bookmark-url.js b/assets/javascripts/discourse/initializers/bookmark-url.js
index aa38d2e..711df23 100644
--- a/assets/javascripts/discourse/initializers/bookmark-url.js
+++ b/assets/javascripts/discourse/initializers/bookmark-url.js
@@ -17,12 +17,12 @@ const STRINGS = {
};
export default apiInitializer("1.8.0", (api) => {
- if (!api.container.lookup("site-settings:main").url_to_article_enabled) {
+ if (!api.container.lookup("site-settings:main").bookmark_url_enabled) {
return;
}
api.modifyClass("component:composer-editor", {
- pluginId: "url-to-article",
+ pluginId: "bookmark-url",
didInsertElement() {
this._super(...arguments);
@@ -75,30 +75,30 @@ export default apiInitializer("1.8.0", (api) => {
this._hideArticleBar();
const bar = document.createElement("div");
- bar.className = "url-to-article-bar";
+ bar.className = "bookmark-url-bar";
bar.innerHTML = `
- 📄
- ${STRINGS.bar_label}
-