diff --git a/plugin.rb b/plugin.rb index f6f0625..4bbe9c9 100644 --- a/plugin.rb +++ b/plugin.rb @@ -4,7 +4,7 @@ # name: discourse-legacy_links # about: A plugin to handle legacy Gossamer Forums URLs -# version: 0.39 +# version: 0.40 # authors: saint@federated.computer # url: https://gitea.federated.computer/saint/discourse-legacy_links.git @@ -21,13 +21,6 @@ after_initialize do class Engine < ::Rails::Engine engine_name "discourse_legacy_links" isolate_namespace DiscourseLegacyLinks - - # Define the routes for this engine - initializer "discourse_legacy_links.routes" do - DiscourseLegacyLinks::Engine.routes.draw do - get "/forum2" => "legacy_links#index2" - end - end end # Define the custom controller, inheriting from Discourse's CustomPostController @@ -40,7 +33,7 @@ after_initialize do # Skip certain before_actions for our index method. # This allows the route to be accessed directly via a browser - skip_before_action :check_xhr, only: [:index2] +## skip_before_action :check_xhr, only: [:index2] ## skip_before_action :verify_authenticity_token, only: [:index2] # skip_before_action :verify_authenticity_token # skip_before_action :ensure_logged_in @@ -153,7 +146,7 @@ after_initialize do end end end - # Register custom routes to handle legacy URLs + Rails.logger.warn "[DEBUG DEBUG DEBUG DEBUG DEBUG WOW WOW WOW]" # Rails.application.routes.routes.each do |route| # Rails.logger.warn "[ROUTE] #{route.path.spec}" @@ -170,6 +163,11 @@ after_initialize do # get '/forum/*path' => 'discourse_legacy_links/custom_post#index' # get '/forum' => 'discourse_legacy_links/custom_post#index' + # Register custom routes to handle legacy URLs + DiscourseLegacyLinks::Engine.routes.draw do + get "/forum2" => "legacy_links#index2" + end + Discourse::Application.routes.append do mount ::DiscourseLegacyLinks::Engine, at: "/" end