# frozen_string_literal: true # name: discourse-url-to-article # 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-url-to-article enabled_site_setting :url_to_article_enabled after_initialize do require_relative "lib/url_to_article/article_extractor" module ::UrlToArticle PLUGIN_NAME = "discourse-url-to-article" class Engine < ::Rails::Engine engine_name PLUGIN_NAME isolate_namespace UrlToArticle end end require_relative "app/controllers/url_to_article/articles_controller" UrlToArticle::Engine.routes.draw do post "/extract" => "articles#extract" end Discourse::Application.routes.append do mount UrlToArticle::Engine, at: "/url-to-article" end end