v0.9 So close, but it doesn't work still...
This commit is contained in:
		
							
								
								
									
										10
									
								
								plugin.rb
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								plugin.rb
									
									
									
									
									
								
							@@ -4,13 +4,13 @@
 | 
			
		||||
 | 
			
		||||
# name: discourse-legacy_links
 | 
			
		||||
# about: A plugin to handle legacy Gossamer Forums URLs
 | 
			
		||||
# version: 0.8
 | 
			
		||||
# version: 0.9
 | 
			
		||||
# authors: saint@federated.computer
 | 
			
		||||
# url: https://gitea.federated.computer/saint/discourse-legacy_links.git
 | 
			
		||||
 | 
			
		||||
# require 'digest'
 | 
			
		||||
 | 
			
		||||
# enabled_site_setting :discourse_legacy_routing_enabled
 | 
			
		||||
# enabled_site_setting :discourse_legacy_links_enabled
 | 
			
		||||
 | 
			
		||||
# after_initialize do
 | 
			
		||||
after_initialize do
 | 
			
		||||
@@ -24,6 +24,11 @@ after_initialize do
 | 
			
		||||
    class CustomPostController < ::ApplicationController
 | 
			
		||||
      # Match URLs that include a post_id at the end or query parameter
 | 
			
		||||
      # Main action triggered when the route is matched.
 | 
			
		||||
      def test
 | 
			
		||||
        Rails.logger.warn "[WARN WARN WARN WARN WARN WARN WARN WARN WARN WARN AMDG JMJ PAX WARN WARN WARN WARN]"
 | 
			
		||||
        render plain: 'Test route'
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def index
 | 
			
		||||
        Rails.logger.warn "[DEBUG] Reached the index action"
 | 
			
		||||
 | 
			
		||||
@@ -123,6 +128,7 @@ after_initialize do
 | 
			
		||||
 | 
			
		||||
    # Register custom routes to handle legacy URLs
 | 
			
		||||
    Discourse::Application.routes.append do
 | 
			
		||||
      get '/test_route' => 'custom_post#test'
 | 
			
		||||
      get '/forum/*path' => 'discourse_legacy_links/custom_post#index'
 | 
			
		||||
      get '/forum' => 'discourse_legacy_links/custom_post#index'
 | 
			
		||||
    end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user