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