Files

33 lines
840 B
Ruby
Raw Permalink Normal View History

2026-03-18 11:10:07 -04:00
# frozen_string_literal: true
2026-03-20 12:00:07 -04:00
# name: discourse-bookmark-url
2026-03-18 11:10:07 -04:00
# about: Scrapes a URL pasted into the topic title and populates the composer body with the article content
# version: 0.1.0
2026-03-18 11:48:57 -04:00
# authors: Robert Johnson
2026-03-20 12:00:07 -04:00
# url: https://code.draft13.com/robert/discourse-bookmark-url
2026-03-18 11:10:07 -04:00
2026-03-20 12:00:07 -04:00
enabled_site_setting :bookmark_url_enabled
2026-03-18 11:10:07 -04:00
after_initialize do
2026-03-20 12:00:07 -04:00
require_relative "lib/bookmark_url/article_extractor"
2026-03-18 11:10:07 -04:00
2026-03-20 12:00:07 -04:00
module ::BookmarkUrl
PLUGIN_NAME = "discourse-bookmark-url"
2026-03-18 11:10:07 -04:00
class Engine < ::Rails::Engine
engine_name PLUGIN_NAME
2026-03-20 12:00:07 -04:00
isolate_namespace BookmarkUrl
2026-03-18 11:10:07 -04:00
end
end
2026-03-20 12:00:07 -04:00
require_relative "app/controllers/bookmark_url/articles_controller"
2026-03-18 11:10:07 -04:00
2026-03-20 12:00:07 -04:00
BookmarkUrl::Engine.routes.draw do
2026-03-18 11:10:07 -04:00
post "/extract" => "articles#extract"
end
Discourse::Application.routes.append do
2026-03-20 12:00:07 -04:00
mount BookmarkUrl::Engine, at: "/bookmark-url"
2026-03-18 11:10:07 -04:00
end
end