From 0fd28b960bc69b0d2e17513aa85547eb03022b11 Mon Sep 17 00:00:00 2001 From: saint Date: Mon, 9 Sep 2024 09:37:53 +1000 Subject: [PATCH] 0.39 Tweaks to see if we can get this stable. --- plugin.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/plugin.rb b/plugin.rb index 849e77a..f6f0625 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.38 +# version: 0.39 # authors: saint@federated.computer # url: https://gitea.federated.computer/saint/discourse-legacy_links.git @@ -21,11 +21,19 @@ 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 # This gives us access to post-related functionality and user authentication # class DiscourseLegacyLinks::CustomPostController < ::ApplicationController +# class LegacyLinksController::CustomPostController < ::ApplicationController class LegacyLinksController < ::ApplicationController::CustomPostController # layout false @@ -33,7 +41,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 :verify_authenticity_token, only: [:index2] +## skip_before_action :verify_authenticity_token, only: [:index2] # skip_before_action :verify_authenticity_token # skip_before_action :ensure_logged_in # skip_before_action :redirect_to_login_if_required @@ -162,10 +170,6 @@ after_initialize do # get '/forum/*path' => 'discourse_legacy_links/custom_post#index' # get '/forum' => 'discourse_legacy_links/custom_post#index' - DiscourseLegacyLinks::Engine.routes.draw do - get "/forum2" => "legacy_links#index2" - end - Discourse::Application.routes.append do mount ::DiscourseLegacyLinks::Engine, at: "/" end