Renaming plugin.
This commit is contained in:
26
README.md
26
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 `<meta>` 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user